Jump to content

  • Log In with Google      Sign In   
  • Create Account

Bakuto

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

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

 

 


Free texture image memory after binding it

01 April 2013 - 08:02 PM

Greetings,

 

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);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

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

 

 


PARTNERS