fonts & textures in OpenGL
Hi all
I want to put some text to my 3D program. I based my code on the code from the tutorial #13. But I have a problem. If I enable texture mapping the color of the string is allways black. No matter what color I set before calling the glPrint function.
Can anyone help me with this or point me to a source where I can find some explanmations?
Thanx in advance
Spooky
Can anyone help me with this or point me to a source where I can find some explanmations? ... YES
http://nehe.gamedev.net - Lesson #13
http://nehe.gamedev.net - Lesson #13

... have you disabled lighting?
I have not enabled it.
I even tried to disable texturing, print the string I need and then reenable the texturing. That doesn''t work either :-(
I have not enabled it.
I even tried to disable texturing, print the string I need and then reenable the texturing. That doesn''t work either :-(
When you turn on texture mapping, OpenGL will continue to texture map until you turn it off. This includes while drawing text. Try disabling texture mapping prior to drawing the text, and then enable it afterwards so whatever you want textured can still be textured.
Jason
Jason
No I don''t want my text to by textured. I just want it to be a plain color but I want to be able to change the color of it.
I mean I want to be able to print one string using one color and another one with a different color.
I mean I want to be able to print one string using one color and another one with a different color.
disable lighting and texturing. Also disable blending (if it is enabled it can do some unexpected results).
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glColor3f(...); /* Color of the text. */
drawMyString();
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glColor3f(...); /* Color of the text. */
drawMyString();
fragment of my code:
...
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST); //I want the string to be on top
glColor3f(0.0f,1.0f,0.0f);
glPrint("text");
glColor3f(1.0f,1.0f,1.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
I don''t use lighting nor blending in my code (yet).
The result of this is white text, allthough it sould be green.
If I don''t set the color to white after printing the text it remains green but also all the textures appear green.
I''m quite frustrated with it.
Anyway, thanx for your help. I really apprecite it.
...
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST); //I want the string to be on top
glColor3f(0.0f,1.0f,0.0f);
glPrint("text");
glColor3f(1.0f,1.0f,1.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
I don''t use lighting nor blending in my code (yet).
The result of this is white text, allthough it sould be green.
If I don''t set the color to white after printing the text it remains green but also all the textures appear green.
I''m quite frustrated with it.
Anyway, thanx for your help. I really apprecite it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement