Browse Source

Use glClientActiveTexture() wherever it appears to make sense.

legacy
Sam Hocevar sam 13 years ago
parent
commit
0e7bec2977
2 changed files with 9 additions and 5 deletions
  1. +4
    -4
      src/debugquad.cpp
  2. +5
    -1
      src/tileset.cpp

+ 4
- 4
src/debugquad.cpp View File

@@ -51,7 +51,7 @@ DebugQuad::DebugQuad()
: data(new DebugQuadData()) : data(new DebugQuadData())
{ {
data->initialised = 0; data->initialised = 0;
data->time = 0.0f;
data->time = RandF(10000.0f);


drawgroup = DRAWGROUP_HUD; drawgroup = DRAWGROUP_HUD;
} }
@@ -114,7 +114,7 @@ void DebugQuad::TickDraw(float deltams)
#endif #endif
glGenTextures(1, data->texlist); glGenTextures(1, data->texlist);


glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, data->texlist[0]); glBindTexture(GL_TEXTURE_2D, data->texlist[0]);
for (int j = 0; j < 32; j++) for (int j = 0; j < 32; j++)
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
@@ -178,7 +178,7 @@ void DebugQuad::TickDraw(float deltams)
glEnableVertexAttribArray(attr_tex); glEnableVertexAttribArray(attr_tex);


/* Bind texture */ /* Bind texture */
glActiveTexture(GL_TEXTURE0);
glClientActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, data->texlist[0]); glBindTexture(GL_TEXTURE_2D, data->texlist[0]);


glBindBuffer(GL_ARRAY_BUFFER, data->buflist[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); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


/* Bind texture */ /* Bind texture */
glActiveTexture(GL_TEXTURE0);
glClientActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, data->texlist[0]); glBindTexture(GL_TEXTURE_2D, data->texlist[0]);


/* Bind vertex, color and texture coordinate buffers */ /* Bind vertex, color and texture coordinate buffers */


+ 5
- 1
src/tileset.cpp View File

@@ -136,9 +136,10 @@ void TileSet::TickDraw(float deltams)
} }


glGenTextures(1, &data->texture); glGenTextures(1, &data->texture);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, data->texture); 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); format, GL_UNSIGNED_BYTE, pixels);


glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -169,7 +170,10 @@ vec2i TileSet::GetCount() const
void TileSet::Bind() void TileSet::Bind()
{ {
if (!data->img && data->texture) if (!data->img && data->texture)
{
glClientActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, data->texture); glBindTexture(GL_TEXTURE_2D, data->texture);
}
} }


void TileSet::BlitTile(uint32_t id, int x, int y, int z, int o, void TileSet::BlitTile(uint32_t id, int x, int y, int z, int o,


Loading…
Cancel
Save