Jump to content
  • Advertisement
Sign in to follow this  
Lonefox1

OpenGL problem with drawing text then a line

This topic is 4581 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys im currently working on a block puzzle game, i have a selection square which is drawn as a quad in Line mode, this worked fine till i wrote some outline font functions, any time i draw some 3d text the quad seems to fill itself in and ive no idea why as the functions are seperate im drawing the text with:
void RenderOLT(char *str, int xPos, int yPos, int zPos)
{
   glPushMatrix();
     glTranslatef(xPos, yPos, zPos);
     glPushAttrib(GL_LIST_BIT);
       glListBase(baseOL);
       glCallLists(strlen(str), GL_UNSIGNED_BYTE, str);
     glPopAttrib();
   glPopMatrix();
}

and the selection rectange with:
void CGfxOpenGL::DrawSelecRect(float x, float y, float r, float g, float b) //draws a rectangle for selecting things
{
   glPushMatrix();
       glTranslatef(x,y,0);
       glPolygonMode(GL_FRONT, GL_LINE);
       glLineWidth(3.0);
       glBegin(GL_QUADS);
            glColor3f(r, g, b);
            glVertex3f(-1, +1, 1);
            glVertex3f(-1, -1, 1);
            glVertex3f(+1, -1, 1);
            glVertex3f(+1, +1, 1);
       glEnd();
       glLineWidth(0.5);
       glPolygonMode(GL_FRONT, GL_FILL);
   glPopMatrix();
   glColor3f(255, 255, 255); 
}

heres a picture of the 2 outcomes, left with 3d text being draw, and right with no 3d text being drawn: blocks any ideas? cheers si

Share this post


Link to post
Share on other sites
Advertisement
Is your outline font textured in anyway? If so, then call glDisable(GL_TEXTURE_2D) before your line drawing section, and glEnable(GL_TEXTURE_2D) before the outline font section. If not, then double check your states. It sounds like some state is not properly getting toggled in the main draw routine.

Also, check your print routine against the one at NeHe

Outline font - lesson 14
Textured Outline font - lesson 15

F451

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!