I’ve made wonderful progress in getting label text working in 3D space in my app.
I’m rendering to a bitmap attached to a DC in Windows XP.
After finding an article in the FAQ, I learned that texture transparencies and depth testing is supported as expected under Windows in OpenGL 1.1
So I followed the instructions that said to render the texture last and disable the depth test. It worked! With some tinkering, but not quite… I rendered the texture first.
Now something is broken, I don’t see the difference in the code. But my alpha bits are now ignored. The transparent portions of my texture are now visible and covers the image it rests on top of.
I need in this case, for the text in the texture to overlay my mesh objects when in front of them. The textures are positioned in 3D space. But I don’t want to see the text bordered in the white field, as it’s current displaying.
Anyone have any pointers on troubleshooting this or caveats to performing this function? Please?
My setup looks like this with some code removed for brevity.
glShadeModel(GL_SMOOTH);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
#ifdef GL_VERSION_1_1
glBindTexture(GL_TEXTURE_2D, TextureName);
#endif
glBegin(GL_QUADS);
glTexCoord3d(0.0, 0.0, 0.0); glVertex3d(x1, y1, z);
glTexCoord3d(0.0, 1.0, 0.0); glVertex3d(x1, y2, z);
glTexCoord3d(1.0, 1.0, 0.0); glVertex3d(x2, y2, z);
glTexCoord3d(1.0, 0.0, 0.0); glVertex3d(x2, y1, z);
glEnd();
glFlush();
glDisable(GL_TEXTURE_2D);