From 0e7bec2977657859b770959d4586ac5d6a9d9e0f Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 28 Feb 2011 02:26:27 +0000 Subject: [PATCH] Use glClientActiveTexture() wherever it appears to make sense. --- src/debugquad.cpp | 8 ++++---- src/tileset.cpp | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/debugquad.cpp b/src/debugquad.cpp index c74458aa..a572e5f9 100644 --- a/src/debugquad.cpp +++ b/src/debugquad.cpp @@ -51,7 +51,7 @@ DebugQuad::DebugQuad() : data(new DebugQuadData()) { data->initialised = 0; - data->time = 0.0f; + data->time = RandF(10000.0f); drawgroup = DRAWGROUP_HUD; } @@ -114,7 +114,7 @@ void DebugQuad::TickDraw(float deltams) #endif glGenTextures(1, data->texlist); - glActiveTexture(GL_TEXTURE0); + glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, data->texlist[0]); for (int j = 0; j < 32; j++) for (int i = 0; i < 32; i++) @@ -178,7 +178,7 @@ void DebugQuad::TickDraw(float deltams) glEnableVertexAttribArray(attr_tex); /* Bind texture */ - glActiveTexture(GL_TEXTURE0); + glClientActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, data->texlist[0]); glBindBuffer(GL_ARRAY_BUFFER, data->buflist[0]); @@ -217,7 +217,7 @@ void DebugQuad::TickDraw(float deltams) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* Bind texture */ - glActiveTexture(GL_TEXTURE0); + glClientActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, data->texlist[0]); /* Bind vertex, color and texture coordinate buffers */ diff --git a/src/tileset.cpp b/src/tileset.cpp index 91a70feb..769f5fe4 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -136,9 +136,10 @@ void TileSet::TickDraw(float deltams) } glGenTextures(1, &data->texture); + glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, data->texture); - glTexImage2D(GL_TEXTURE_2D, 0, planes, w, h, 0, + glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, format, GL_UNSIGNED_BYTE, pixels); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -169,7 +170,10 @@ vec2i TileSet::GetCount() const void TileSet::Bind() { if (!data->img && data->texture) + { + glClientActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, data->texture); + } } void TileSet::BlitTile(uint32_t id, int x, int y, int z, int o,