I use OpenGL and SDL2 to render spine animations. In a specific z-order this animations are disposed like white blocks. All texture get white. I guess this error is in OpenGL draw code.
glPushMatrix();
float texw=0, texh=0;
if (texture) {
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
if (SDL_GL_BindTexture(texture, &texw, &texh) != 0)
printf("WTF\n");
}
glEnableClientState(GL_VERTEX_ARRAY);
glColor4f(color[0], color[1], color[2], color[3]);
glVertexPointer(2, GL_FLOAT, 0, vertices);
glTexCoordPointer(2, GL_FLOAT, 0, uvs);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// if (num_vertices > 0) {
glDrawElements(GL_TRIANGLES, num_indices, GL_UNSIGNED_SHORT, indices);
glDisableClientState(GL_VERTEX_ARRAY);
// glDisableClientState(GL_COLOR_ARRAY);
if (texture) {
SDL_GL_UnbindTexture(texture);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
glColor4f(1.0, 1.0, 1.0, 1.0);
glPopMatrix();
This is my code, some one see something wrong in this code ?
Why i'm getting white textures ?