mirror of https://github.com/aap/librw.git
fixed shader stuff
This commit is contained in:
parent
aff3dd5a0c
commit
c6c37da209
|
@ -3,10 +3,13 @@ SRC = main.cpp glshader.cpp math.cpp camera.cpp
|
||||||
OBJ = $(patsubst %.cpp, $(BUILDDIR)/%.o, $(SRC))
|
OBJ = $(patsubst %.cpp, $(BUILDDIR)/%.o, $(SRC))
|
||||||
DEP = $(patsubst %.cpp, $(BUILDDIR)/%.d, $(SRC))
|
DEP = $(patsubst %.cpp, $(BUILDDIR)/%.d, $(SRC))
|
||||||
RWDIR=$(HOME)/src/librw
|
RWDIR=$(HOME)/src/librw
|
||||||
LDLIBS=-pthread -lX11 -lXrandr -lXi -lXxf86vm -lGL -lGLEW -lm
|
#LDLIBS=-pthread -lX11 -lXrandr -lXi -lXxf86vm -lGL -lGLEW -lm
|
||||||
|
#STATICLIBS= $(RWDIR)/librw-opengl.a /usr/local/lib/libglfw3.a
|
||||||
|
LDLIBS=-pthread -lGL -lGLEW -lglfw
|
||||||
|
STATICLIBS=$(RWDIR)/librw-opengl.a
|
||||||
CFLAGS=-g -I$(RWDIR) -Wall -Wextra
|
CFLAGS=-g -I$(RWDIR) -Wall -Wextra
|
||||||
|
|
||||||
rwtest: $(OBJ) $(RWDIR)/librw-opengl.a /usr/local/lib/libglfw3.a
|
rwtest: $(OBJ) $(STATICLIBS)
|
||||||
$(CXX) $^ $(LDLIBS) -o $@
|
$(CXX) $^ $(LDLIBS) -o $@
|
||||||
|
|
||||||
$(BUILDDIR)/%.o: %.cpp
|
$(BUILDDIR)/%.o: %.cpp
|
||||||
|
|
|
@ -111,7 +111,6 @@ init(void)
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
glAlphaFunc(GL_GEQUAL, 0.5f);
|
glAlphaFunc(GL_GEQUAL, 0.5f);
|
||||||
const char *shadersrc =
|
const char *shadersrc =
|
||||||
"#version 120\n"
|
|
||||||
"#ifdef VERTEX\n"
|
"#ifdef VERTEX\n"
|
||||||
"uniform mat4 projMat;"
|
"uniform mat4 projMat;"
|
||||||
"uniform mat4 viewMat;"
|
"uniform mat4 viewMat;"
|
||||||
|
@ -144,11 +143,12 @@ init(void)
|
||||||
" gl_FragColor = v_color*c0;"
|
" gl_FragColor = v_color*c0;"
|
||||||
"}\n"
|
"}\n"
|
||||||
"#endif\n";
|
"#endif\n";
|
||||||
const char *srcarr[] = { "#define VERTEX", shadersrc };
|
const char *srcarr[] = { "#version 120\n",
|
||||||
GLint vertshader = rw::gl::compileShader(srcarr, 2, GL_VERTEX_SHADER);
|
"#define VERTEX\n", shadersrc };
|
||||||
|
GLint vertshader = rw::gl::compileShader(srcarr, 3, GL_VERTEX_SHADER);
|
||||||
assert(vertshader != 0);
|
assert(vertshader != 0);
|
||||||
srcarr[0] = "#define FRAGMENT";
|
srcarr[1] = "#define FRAGMENT\n";
|
||||||
GLint fragshader = rw::gl::compileShader(srcarr, 2, GL_FRAGMENT_SHADER);
|
GLint fragshader = rw::gl::compileShader(srcarr, 3, GL_FRAGMENT_SHADER);
|
||||||
assert(fragshader != 0);
|
assert(fragshader != 0);
|
||||||
program = rw::gl::linkProgram(vertshader, fragshader);
|
program = rw::gl::linkProgram(vertshader, fragshader);
|
||||||
assert(program != 0);
|
assert(program != 0);
|
||||||
|
|
Loading…
Reference in New Issue