Jump to content
  • Advertisement

Archived

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

Jonny K

Why can't I create a display list?

This topic is 5138 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 can''t I create a display list? Here''s my code:
//Make a display list for the alien

void Alien::make_display_list()
{
	//Generate one display list

	alien_list = glGenLists(1);

	glNewList(alien_list,GL_COMPILE);

		//Draw quad (square) with texture on it

		glBegin(GL_QUADS);
			glTexCoord2f(0.0f, 0.0f); glVertex2f(-0.02, -0.02);// Bottom Left Of The Texture and Quad

			glTexCoord2f(1.0f, 0.0f); glVertex2f(0.02, -0.02);// Bottom Right Of The Texture and Quad

			glTexCoord2f(1.0f, 1.0f); glVertex2f(0.02, 0.02);// Top Right Of The Texture and Quad

			glTexCoord2f(0.0f, 1.0f); glVertex2f(-0.02, 0.02);// Top Left Of The Texture and Quad

		glEnd();

	glEndList();
}
alien_list is an unsigned integer, declared as a private variable in the class. (GLuint = unsigned int). When I investigate this code, I find that after "alien_list = glGenLists(1);", alien_list is still equal to 0 (the initial value). What''s up? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Well... Maybe you call that function before creating an OpenGL context?
If that''s not it, try using glGetError() to check what went wrong.

Share this post


Link to post
Share on other sites
Aw crap! I'm calling it from a constructor...so yeah, it's possible I'm calling it BEFORE openGL is fully set up! DOH!

*bangs head on table*

I'll take a look. Thanks.

Update: Yeah, that's the problem. Thanks. :-)

[edited by - Jonny K on May 27, 2004 1:07:28 PM]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!