PDA

View Full Version : graphics going too fast



tepuyes
02-10-2004, 06:47 AM
I am working with C++ and OpenGl on Windows 2000 using Visual C version 6.0. I generated a Bezier curve to get interpolated points through my control points (4 points). How can I see my target (scenes) going as a camera film in slow motion? I always catch the last point of view.
I used command: Sleep (miliseconds); but It doesn´t work.

DJSnow
02-10-2004, 07:23 AM
Hi.

are you looking forward to implement something which is known as the "time lapse" effect ? i'm not quite sure if this is the correct definition.

02-10-2004, 09:06 AM
Are you flushing the allready drawn portions to the frame buffer before you pause, if you dont you wont see anything when you pause. If you want to slow it down, best thing is to probably implement a timer of some sort and have it draw a portion of your bezier curve when the event is triggered.

tepuyes
02-10-2004, 11:25 AM
Originally posted by Vector:
Are you flushing the allready drawn portions to the frame buffer before you pause, if you dont you wont see anything when you pause. If you want to slow it down, best thing is to probably implement a timer of some sort and have it draw a portion of your bezier curve when the event is triggered.

Hi, thank you for your quick email. I want to see each frame in slow motion, because the only view I can get is the last one because everything is so fast that I see always the last one. All other stuffs are working fine, I checked point by point and all is OK!!

endash
02-10-2004, 12:54 PM
Some form of sleep() should work. If you are just debuging, you can try sleep(1); which will sleep for a second. Off the top of my head I forget what the OpenGL function is that returns the time in milliseconds, then you can use that as the time parameter for drawing each frame, assuming you can parameterize your sceen by time.

roffe
02-10-2004, 02:46 PM
Originally posted by endash:
I forget what the OpenGL function is that returns the time in milliseconds

Maybe because there isn't one.OpenGL is a Graphics Library, not a utility library.

Instead of relying on sleep(), why don't you just render the same frame over and over again. Just like implementing a Camera class/structure with simple scripting capabilities. Assuming your app can run at 100% CPU.

distance to move=speed*deltaT
deltaT= (t at frame x+1) - (t at frame x)

mikael_aronsson
02-10-2004, 10:09 PM
Hi !

Sleep does not work because the rendering will not be updated in the sleep, you will only see the last update, you have implement a timer a small part each time the timer is called (or use a call in your message loop/idle function).

Mikael

endash
02-13-2004, 07:22 AM
Roffe, I found what I was thinking of. It's not OpenGL, but it is glut. It's glutGet(GLUT_ELAPSED_TIME) and I believe it returns the number of milliseconds since the program started in an integer. (Which then has the potential to roll over occasionally, of course.)