Jump to content
  • Advertisement
Sign in to follow this  

glusphere and display list

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

I have used display lists before for constantly rendering the static environment (by static i mean it just doesnt change at all which is perfect for display lists)

I tried to do the same again to create a 'space' environment with lots (10 * 10 * 10) gluSpheres randomly placed around in black space. Simple yet effective.

Unfortunately, the code actually works better when i run this code at render:

for(unsigned int s=0; s<asteroids.size();s++)

rather than this:

I set up the render list as follows in the universe constructor:

universeListId = glGenLists(1); //Make room for the display list

glNewList(universeListId, GL_COMPILE); //Begin the display list
for(unsigned int s=0; s<asteroids.size();s++)


where asteroids is just an array of Multiple 'Particle' which has the following render function:

void Render()
//draw the ball
glColor3f(1, 1, 1 );
glTranslatef(position.x, position.y, position.z);
gluSphere(gluNewQuadric(), radius, 20, 20);

I am thinking that the problem could be with this line:
gluSphere(gluNewQuadric(), radius, 20, 20);

being in the display list. It looks like it constantly creates new vertices etc.
Is there a way to just create and store a glusphere and then render that, or would that not fix the issue.

I have GTX260 graphics card and duel-core 2.66ghz processor just in case someone asks about hardware.

Thx in advance

i have since changed the code to use:
pQuadric = gluNewQuadric(); //in constructor(pQuadric is member variable)
gluSphere(pQuadric, radius, 20, 20); //in render method

I think that makes the program work well for a tiny bit longer but it still suddenly chugs down. It seems like theres a leak somewhere.

Ran some time tests, and it seems that it isnt the call to display list that is taking time, its the glutSwapBuffers();
that takes roughly 940 to 970 ms, basically a whole second.

[Edited by - stu2000 on October 1, 2010 6:54:50 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

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