Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Member Since 14 Feb 2007
Offline Last Active Apr 14 2013 03:42 PM

Topics I've Started

glutBitmapCharacter issue

06 April 2013 - 07:25 PM



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);

	glColor3f(0.9f, 0.9f, 0.9f);
		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);

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



Free texture image memory after binding it

01 April 2013 - 08:02 PM



After binding a texture, is it possible to free the image memory and still be able to use the texture?  For example:


int LoadGLTextures()	// Load Bitmaps And Convert To Textures
	int Status=FALSE;	// Status Indicator

	// Load The Bitmap, Check For Errors.
	if (LoadTGA(&texture[0], "Data/Uncompressed.tga") &&
	    LoadTGA(&texture[1], "Data/Compressed.tga"))
		Status=TRUE;	// Set The Status To TRUE

		for (int loop=0; loop<2; loop++)// Loop Through Both Textures
			// Typical Texture Generation Using Data From The TGA 
			glGenTextures(1, &texture[loop].texID);	// Create The Texture
			glBindTexture(GL_TEXTURE_2D, texture[loop].texID);
			glTexImage2D(GL_TEXTURE_2D, 0, texture[loop].bpp / 8, texture[loop].width, texture[loop].height, 0, texture[loop].type, GL_UNSIGNED_BYTE, texture[loop].imageData);

			if (texture[loop].imageData)	// If Texture Image Exists 
				free(texture[loop].imageData);	// Free The Texture Image Memory 
	return Status;	// Return The Status



Lesson 33 with Glut

04 November 2011 - 02:05 PM

I am unable to convert lesson 33 to use glut instead of that clunky windows API. Does anyone have a working copy of Lesson 33 with Glut? Thanks!

glutInitDisplayMode SINGLE vs. DOUBLE

04 March 2011 - 08:49 PM

On setting glutInitDisplayMode(GLUT_SINGLE), I am able to see stuff that I have rendered, but when switching to glutInitDisplayMode(GLUT_DOUBLE), my window is blank.

Is there a step I'm missing when switching to double?

NeHe 33 coupled with gluOrtho2D

03 March 2011 - 10:46 PM


While working with NeHe #33 tutorial, I tried setting glMatrixMode(GL_PROJECTION) with some standard resolutions, (0, 800, 0, 600), etc.
However, when I invoke this call in the init portion of the code, the rotating sprites disappear. I have no idea how what the coordinates correspond to, when rendering the GL_QUADS.

Would anyone be able to show me how to set this up whilst having the glMatrixMode set to GL_PROJECTION?