Problems with bitmap font combiend with a texture
Well what I did:
I joined the bitmap font to my Demo and everything went o.k
but then I added a Texure and now the font has another Color, when I avoid the Texture init, everything is o.k again, if I change the Texture the font has another Color again. What am I doing wrong? Here is my "GL_DrawScene" Code:
int DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Clear Screen And Depth Buffer
glLoadIdentity();
if (cnt1<100)
{
glTranslatef(0.0f,0.0f,-5.0f);
glColor3f(1.0f,1.0f,1.0f);
glRasterPos2f(-2.4f, 0.0f);
glPrint("---Space Projekt--- by Lars Michel %7.2f", cnt1);
}
if (cnt1>100 && cnt1 <120)
{
glTranslatef(0.0f,0.0f,-5.0f); // Move One Unit Into The Screen
glColor3f(1.0f,1.0f,1.0f);
glRasterPos2f(-1.f, 0.0f);
glPrint("Dedicated to Kismet"); // Print GL Text To The Screen
}
if(cnt1>120 && cnt1<150)
{
cnt2=100;
}
if (cnt2==100)
{
glLoadIdentity();
z+=0.1f;
glTranslatef(0.0f,0.0f,z);
glColor3f(1.0f,1.0f,1.0f);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f,1.0f); glVertex3f(-1.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f,0.0f); glVertex3f(-1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f,0.0f); glVertex3f(1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f,1.0f); glVertex3f(1.0f, 1.0f, 0.0f);
glEnd();
}
cnt1+=0.2f;
return TRUE;
}
hey... im also a gl newbie and had the same problem!
after a bit of screwing around i found the answer to this so here it is.....
int DrawGlScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//draw whatever u want with textures on them
//now we are going to draw the text
glDisable(GL_TEXTURE_2D);//im not sure why the text breaks when you have textures on but it does so disable them here
glClear(GL_DEPTH_BUFFER_BIT);//i do this to make sure the text apears on top of everything else if u dont want this dont do it
//now draw the text the same way you had it before
glEnable(GL_TEXTURE_2D);//enable again so the polygons will be textured
}
//hope that helps
after a bit of screwing around i found the answer to this so here it is.....
int DrawGlScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//draw whatever u want with textures on them
//now we are going to draw the text
glDisable(GL_TEXTURE_2D);//im not sure why the text breaks when you have textures on but it does so disable them here
glClear(GL_DEPTH_BUFFER_BIT);//i do this to make sure the text apears on top of everything else if u dont want this dont do it
//now draw the text the same way you had it before
glEnable(GL_TEXTURE_2D);//enable again so the polygons will be textured
}
//hope that helps

Infested Furbyinfestedfurby@hotmail.cominfestedfurby.cjb.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement