From 9e7c523b485b62df84e56ebdbd9a02eaa38fb164 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 6 Apr 2016 18:22:53 -0400 Subject: [PATCH] update to newer glcxx library with Texture support --- Makefile | 1 + app.cc | 8 ++++---- glcxx | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e62ff56..b416200 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/app.cc b/app.cc index 3128b53..e96fdf2 100644 --- a/app.cc +++ b/app.cc @@ -22,7 +22,7 @@ static struct } uniforms; glm::mat4 modelview; glm::mat4 projection; -GLuint texture; +std::shared_ptr 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(); + 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); diff --git a/glcxx b/glcxx index e0f6651..dfb199c 160000 --- a/glcxx +++ b/glcxx @@ -1 +1 @@ -Subproject commit e0f6651161cdb03f75ede1bde0e1ac49f097c414 +Subproject commit dfb199cc8d7af3d322c4aeb65318e294caa85b56