glBindTexture(GL_TEXTURE_2D, texidx);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 512, 512, 0, GL_RGBA, GL_FLOAT, texdata);
If texidx == 0
everything works perfectly, but if texidx != 0
, or is generated using glGenTexture(&texidx,1)
, the eventual rendering shows just solid color (last glColor) instead of the texture. I've been debugging for over a day (glGetError shows no trouble) and am running out of ideas. Any thoughts? I can post more code as needed.
Setup code:
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glDisable(GL_LIGHTING);
glClearColor(0.5,0.5,0.5,0);
glClearDepth(1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_COLOR_MATERIAL);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);