PDA

View Full Version : Display lists and Texture



Freecraft
10-21-2012, 04:10 PM
Hello everyone,
I wanted to use Fonts in my project, so I added this code: http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/ (a tutorial about freetype)
But when I started to use textures, some problems appeared:
If I do not render any text (though I init fonts, etc.), but render some Geometry with textures, all seems to work fine.
If I render text and some geometry, the textures of that geometry are becoming the last character rendered by the tutorial code.
OpenGL seems to ignore my

glBindTexture();
calls.
I guess the problem is that the tutorial code from NeHe (above link) uses display lists, whereas I use the old fashioned way:


glGenTextures(1, &texID);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texID);
glTexParameterf...
...
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
// ...
glBegin(GL_QUADS)
glBindTexture(GL_TEXTURE_2D, texID);
glColor4f(VecComp4(leftTop.color));
glTexCoord2f(1.0,0);
glVertex3f(VecComp3(leftTop.vertex));
// ...
glEnd()
// ...
(I know that this is not the smartest technique; Normally I use VBO's)
Since I didn't used DisplayList yet, I don't know how they can collide with my code.
Furthermore I did not find any information on google.
It would be nice if you could help me.
Thanks in advice.

PS: I use shaders (GLSL <= 1.20), but the problem also exists with the standard rendering pipeline.
I use GLUT and GLEW for context and extensions.
If you need some more code or any further information, please let me know.