Rendering is too fast

Started by
6 comments, last by etothex 18 years, 5 months ago
I'm currently on lesson 13 and I see that on Fullscreen mode all rotation, moving around screen, zooming is too fast (its little slower on windowed maximized mode). This may be depends of the Video Card (My works very good). I need to add something to pause code in DrawGLScene() before return. How to pause the code before repeat GL scene in the next sequence of the GL animation? P.S. Sorry for my bad English.
______________________________Excited of C++Keen on C++Love C++Bulgarian Pirate :)
Advertisement
It's not an elegant solution, but you can add a Sleep statement (on Windows) to have a forced delay.

Sleep(10);

That ought to be good enough. If you want slower, use 20 instead of 10.

You will need to use better methods in a production game, but for the demos and learning that should work just fine.

frob.
Yes now it's work pretty good. Is windows.h is the header for Sleep();
______________________________Excited of C++Keen on C++Love C++Bulgarian Pirate :)
Yes, when you include windows.h you get a header for Sleep();
I program in my sleep,but when I sleep I use the partition in my head that doesnt have g++ or the .net library, so im kinda screwed.
I don't know how your code works, but I suppose that you could simply reduce your rotation steps (i.e instead than 1/10 deg you could use 1/100).

In the future, you may want to use a FPS indipendent method (like using a timer or something similar)
And one more question - how I can change refresh rate. By default I use 1024x768x32 and 85 Hz but in OpenGL is autoset to 60 Hz. And is the refresh rate make rendering faster/slower (parasite) or not ?
______________________________Excited of C++Keen on C++Love C++Bulgarian Pirate :)
I'm not sure if you can change the refresh freq. from OGL, but I think that it wouldn't influence the rendering speed, as long as you have the vertical retrace sync off. You can change the freq throught SDL or Allegro (IIRC), so if you use one of them to setup your window, you should be ok.
There isn't any way to do it through opengl by itself, because opengl does not handle implementation-specific details like that and prefers to work abstracted from the implementation. Suppose you were rendering frames for a CG-graphics movie? What would a function like glRefreshRate(...) do in that case?

Instead you have to do it through your OS-specific calls, which you already do to change the resolution and bitdepth. You would use ChangeDisplaySettings in windows (unless you are using glut)

This topic is closed to new replies.

Advertisement