Jump to content
  • Advertisement
Sign in to follow this  
goyg

About glGet()

This topic is 3617 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 want to render some lamps , so I use glGetLightfv() to get the position of a lamp.But I find that the first time when I use the function glGetLightfv()spend much more time then the others. The glut is used in the project. The display() function is like this: for(int i=0;i<light_num;i++) { glGetLightfv(GL_LIGHT0,GL_POSITION,ltPosition); ......move coord to ltPosition ......renfer the lamp } The image is correct. The time spending for rendering each lamp: 0.079584 0.000152 0.000132 0.000122 0.000113 0.000122 0.000123 0.000117 What result this?Are there some details I forget to set?

Share this post


Link to post
Share on other sites
Advertisement
You might find it easier to keep the positions of your lamps stored elsewhere (a customised 'light' structure or a simple array would work), that way you've always got access to them and there's no need to keep asking where they are when you want to do things with them.

As for it taking longer the first time, it's not something you're going to avoid, regardless of what you try. If it kept happening every few frames or something, then you'd have something to complain about, but otherwise, don't worry about it. If you feel it's really that horrible, try implementing a simple loading screen before you start rendering everything, and you might find it disappears (the first frame always takes a bit of time to render, but after that, it's usually fine).

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.

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

Sign me up!