Jump to content
  • Advertisement

Archived

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

variant

Display lists and contexts

This topic is 5660 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 am working on a base class method that will start up a gl window. Everything is working fine, except when I run two instances of it. I am creating a display list of an object based on random numbers, and rotating it. Both windows show the same object. I checked the rendering context before creating the list and they are two distinct contexts. The appropriate context is set before the display loop is called. The display list numbers are the same however. Is that what is supposed to happen? Any ideas? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Well, I figured out what was going on, but it is rather strange. Before starting the display loop I set the appropriate context, initialize OpenGL, seed the random number generator with the time, then create my display list. Apparently, the random numbers for both instances were the exact same. I didn''t think this should happen since I am seeding with the time:

srand(time(NULL));

Seeding the generator just once solved the problem. I suppose the seed must have been the same for each initialization, but since its done with time(), I would not expect that. Any one more familiar with the workings of these functions?

Share this post


Link to post
Share on other sites
That''s what the problem was. I was performing one initialization, then reseeding the generator within the same second. I should probable use timeGetTime().

Share this post


Link to post
Share on other sites
The elasped time is probably insignificant. Anyways, excepting a very few select circumstances, you should only ever call srand once per application.

______________________________________________________________
The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ
MySite
______________________________________________________________

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!