Advertisement

Coloring fonts

Started by April 15, 2002 11:09 AM
0 comments, last by Feblex 22 years, 10 months ago
I realize that you guys have probably seen this question many times, but how is it that I color fonts made using the GlPrint function that Nehe utilizes? I use GlColor3f(0.5f,0.0f,0.0f) for color and GlColor3f(1.0f,1.0f,1.0f) for setting it back. The problem is color never shows on the texture! I disable blending, texturing, etc. to draw the text, so I know that is not the problem. I have also tried changing up the values for the color statement, but nothing works. Any ideas? I apologize if this a question you guys have seen, but I tried searching for it and I couldn''t find the answer in any threads. Mr Bugg
You would have to use materials to change texture''s color. Pick up a Material.cpp/h from the Bezier Patch Project from page (link below) and have a look on how I''ve done it. If you have any questions, post again.

Basic explanation:

  	glEnable(GL_TEXTURE_2D);			glBindTexture(GL_TEXTURE_2D, mat->GetID()); 			glEnable( GL_DEPTH_TEST ); // Z buffer			glEnable(GL_LIGHTING);			glShadeModel( GL_SMOOTH ); // Gouraud shading			glMaterialfv( GL_FRONT, GL_AMBIENT,	 mat->Ambient	);			glMaterialfv( GL_FRONT, GL_DIFFUSE,	 mat->Diffuse	);			glMaterialfv( GL_FRONT, GL_SPECULAR, mat->Specular	);  


In here, you follow first steps to enable some things like lighting and texturing. Then, the color you want to assign for texture will be in ambient color. So, put whatever color you want into GLfloat Ambient[4]. Pretty simple.
Cheers.


" Do we need us? "


Ionware Productions - Games and Game Tools Development

This topic is closed to new replies.

Advertisement