update to newer glcxx library with Texture support
This commit is contained in:
parent
78d3eca026
commit
9e7c523b48
1
Makefile
1
Makefile
@ -4,6 +4,7 @@ OBJS += glcxx/src/glcxx/Array.o
|
|||||||
OBJS += glcxx/src/glcxx/Buffer.o
|
OBJS += glcxx/src/glcxx/Buffer.o
|
||||||
OBJS += glcxx/src/glcxx/Program.o
|
OBJS += glcxx/src/glcxx/Program.o
|
||||||
OBJS += glcxx/src/glcxx/Shader.o
|
OBJS += glcxx/src/glcxx/Shader.o
|
||||||
|
OBJS += glcxx/src/glcxx/Texture.o
|
||||||
REPOS := glcxx glm
|
REPOS := glcxx glm
|
||||||
|
|
||||||
CCFLAGS := $(shell sdl2-config --cflags)
|
CCFLAGS := $(shell sdl2-config --cflags)
|
||||||
|
8
app.cc
8
app.cc
@ -22,7 +22,7 @@ static struct
|
|||||||
} uniforms;
|
} uniforms;
|
||||||
glm::mat4 modelview;
|
glm::mat4 modelview;
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
GLuint texture;
|
std::shared_ptr<glcxx::Texture> texture;
|
||||||
GLubyte texture_data[16][16][4];
|
GLubyte texture_data[16][16][4];
|
||||||
|
|
||||||
#define WIDTH 800
|
#define WIDTH 800
|
||||||
@ -58,7 +58,7 @@ bool init(void)
|
|||||||
1, -1, 1, 0, 0, 1, 1, 0,
|
1, -1, 1, 0, 0, 1, 1, 0,
|
||||||
1, 1, 1, 0, 0, 1, 1, 1,
|
1, 1, 1, 0, 0, 1, 1, 1,
|
||||||
-1, 1, 1, 0, 0, 1, 0, 1});
|
-1, 1, 1, 0, 0, 1, 0, 1});
|
||||||
cube_array = make_shared<glcxx::Array>();
|
cube_array = glcxx::Array::create();
|
||||||
cube_array->bind();
|
cube_array->bind();
|
||||||
cube_buffer->bind();
|
cube_buffer->bind();
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
@ -91,9 +91,9 @@ bool init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glGenTextures(1, &texture);
|
texture = glcxx::Texture::create();
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
texture->bind(GL_TEXTURE_2D);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, &texture_data[0][0][0]);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, &texture_data[0][0][0]);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
2
glcxx
2
glcxx
@ -1 +1 @@
|
|||||||
Subproject commit e0f6651161cdb03f75ede1bde0e1ac49f097c414
|
Subproject commit dfb199cc8d7af3d322c4aeb65318e294caa85b56
|
Loading…
x
Reference in New Issue
Block a user