I am currently having some trouble with the text in my game. I am using orthomode for a 2d pacman like game and I can get the text to draw but I cant seem to get it to change colors… I have tried adding glColor3f() just about everywhere and it doesnt seem to want to change…
heres my code-
void DrawScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(0, 0, 0, 0, 0, 0 + 1, 0, 1, 0);
glRotatef(0 , 0, 1, 0);
OrthoMode(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
glColor4f(1, 1, 1, 1);
glDisable(GL_DEPTH_TEST);
if(screen2render=="MENU")
{
DrawMenu();
DrawText(0, 0, "Sample Text...");
}
SwapBuffers(g_hDC);
}
void DrawMenu()
{
glBindTexture(GL_TEXTURE_2D, g_Texture[9]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f + wrap, 1.0f - wrap ); glVertex2f(0, 0);
glTexCoord2f(0.0f + wrap , 0.0f - wrap); glVertex2f(0, SCREEN_HEIGHT);
glTexCoord2f(1.0f + wrap, 0.0f - wrap); glVertex2f(SCREEN_WIDTH, SCREEN_HEIGHT);
glTexCoord2f(1.0f + wrap, 1.0f - wrap); glVertex2f(SCREEN_WIDTH, 0);
glEnd();
wrap += 0.0035f;
}
void OrthoMode(int left, int top, int right, int bottom)
{
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho( left, right, bottom, top, 0, 1 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void DrawText(int x, int y, const char *strString, ...)
{
char strText[256];
va_list argumentPtr;
glColor3f(1,1,1);
if (strString == NULL)
return;
va_start(argumentPtr, strString);
vsprintf(strText, strString, argumentPtr);
va_end(argumentPtr);
glRasterPos2f(x, y);
glPushAttrib(GL_LIST_BIT);
glListBase(g_FontListID);
glCallLists(strlen(strText), GL_UNSIGNED_BYTE, strText);
glPopAttrib();
}