Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


glutBitmapCharacter issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Bakuto   Members   -  Reputation: 131

Like
0Likes
Like

Posted 06 April 2013 - 07:25 PM

Hi,

 

I'm drawing a white quad and then rendering some text over top of it using glutBitmapCharacter, but the text is being covered by the quad.  Does anyone know why?  Given the order I do the rendering, the text should be on top of the quad.

 

void renderBitmapString(
		float x,
		float y,
		float z,
		void *font,
		char *string) {

	char *c;
	glRasterPos3f(x, y,z);
	for (c=string; *c != '\0'; c++) {
		glutBitmapCharacter(font, *c);
	}
}

...
...
...
	glPushMatrix();
	glColor3f(0.9f, 0.9f, 0.9f);
	glBegin(GL_QUADS);
		glVertex3f(-100.0f, -100.0f, 0.0f);
		glVertex3f(-100.0f, 100.0f,  0.0f);
		glVertex3f( 100.0f, 100.0f,  0.0f);
		glVertex3f( 100.0f, -100.0f, 0.0f);
	glEnd();

	void *font= GLUT_BITMAP_8_BY_13;
	
	glColor3f(0.9f, 0.0f, 0.0f);
	renderBitmapString(30,15,0,font,(char *)"GLUT Tutorial @ Lighthouse3D");

 

 



Sponsor:

#2 Bakuto   Members   -  Reputation: 131

Like
0Likes
Like

Posted 06 April 2013 - 08:25 PM

I tried drawing the text first, and then the quad and it fixes to problem.  But, I still have no idea why doing it backwards renders it correctly.



#3 Bakuto   Members   -  Reputation: 131

Like
0Likes
Like

Posted 06 April 2013 - 09:18 PM

Found it, it's because I had glEnable(GL_DEPTH_TEST) set.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS