update to newer glcxx library with Texture support

This commit is contained in:
Josh Holtrop 2016-04-06 18:22:53 -04:00
parent 78d3eca026
commit 9e7c523b48
3 changed files with 6 additions and 5 deletions

View File

@ -4,6 +4,7 @@ OBJS += glcxx/src/glcxx/Array.o
OBJS += glcxx/src/glcxx/Buffer.o
OBJS += glcxx/src/glcxx/Program.o
OBJS += glcxx/src/glcxx/Shader.o
OBJS += glcxx/src/glcxx/Texture.o
REPOS := glcxx glm
CCFLAGS := $(shell sdl2-config --cflags)

8
app.cc
View File

@ -22,7 +22,7 @@ static struct
} uniforms;
glm::mat4 modelview;
glm::mat4 projection;
GLuint texture;
std::shared_ptr<glcxx::Texture> texture;
GLubyte texture_data[16][16][4];
#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, 1,
-1, 1, 1, 0, 0, 1, 0, 1});
cube_array = make_shared<glcxx::Array>();
cube_array = glcxx::Array::create();
cube_array->bind();
cube_buffer->bind();
glEnableVertexAttribArray(0);
@ -91,9 +91,9 @@ bool init(void)
}
}
glGenTextures(1, &texture);
texture = glcxx::Texture::create();
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]);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

2
glcxx

@ -1 +1 @@
Subproject commit e0f6651161cdb03f75ede1bde0e1ac49f097c414
Subproject commit dfb199cc8d7af3d322c4aeb65318e294caa85b56