Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Dunge

Illegal operation on glGenLists()

This topic is 5445 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

why do I get a illegal operation on glGenLists() if I do gluBuild2DMipmaps or glTexImage2D the line just before but it work if I don''t (sure I see a white texture)... here is the code:
CFont::CFont()								// Build Our Font Display List

{
	FontTex.LoadTexture("font.bmp");
	glGenTextures(1, &FontTex.texID);
	glBindTexture(GL_TEXTURE_2D, FontTex.texID);			// Select Our Font Texture

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
	gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, FontTex.width, FontTex.height, GL_RGBA, GL_UNSIGNED_BYTE, FontTex.data);

	float	cx;											// Holds Our X Character Coord

	float	cy;											// Holds Our Y Character Coord


	base=glGenLists(256);								// Creating 256 Display Lists

	glBindTexture(GL_TEXTURE_2D, FontTex.texID);			// Select Our Font Texture

	for (loop=0; loop<256; loop++)						// Loop Through All 256 Lists

	{
		cx=float(loop%16)/16.0f;						// X Position Of Current Character

		cy=float(loop/16)/16.0f;						// Y Position Of Current Character


		glNewList(base+loop,GL_COMPILE);				// Start Building A List

			glBegin(GL_QUADS);							// Use A Quad For Each Character

				glTexCoord2f(cx,1-cy-0.0625f);			// Texture Coord (Bottom Left)

				glVertex2i(0,0);						// Vertex Coord (Bottom Left)

				glTexCoord2f(cx+0.0625f,1-cy-0.0625f);	// Texture Coord (Bottom Right)

				glVertex2i(16,0);						// Vertex Coord (Bottom Right)

				glTexCoord2f(cx+0.0625f,1-cy);			// Texture Coord (Top Right)

				glVertex2i(16,16);						// Vertex Coord (Top Right)

				glTexCoord2f(cx,1-cy);					// Texture Coord (Top Left)

				glVertex2i(0,16);						// Vertex Coord (Top Left)

			glEnd();									// Done Building Our Quad (Character)

			glTranslated(10,0,0);						// Move To The Right Of The Character

		glEndList();									// Done Building The Display List

	}													// Loop Until All 256 Are Built

}

Share this post


Link to post
Share on other sites
Advertisement
I have no idea what you are saying
but.. do you have a valid opengl context before you call ANY other opengl command?

are you sure that the error = 0 before you call the GenBuffers?

Share this post


Link to post
Share on other sites
When I run the program I get

Unhandled exception at 0x68f86be5 in SkyDunge.exe: 0xC0000005: Access violation reading location 0x00375000.

and it put a green arrow on the line
base=glGenLists(256);
but I just tried with another comman after gluBuild2DMipmaps (glError) and it crash anyway... should be an texture loading problem.... ohh well the error do =0 before gluBuild2DMipmaps

aahhh nevermind I just saved the bmp to 24bpp and it work..

[edited by - Dunge on October 24, 2003 11:33:15 AM]

Share this post


Link to post
Share on other sites

  • 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!