unsigned StartTime = GetTime( ); // in ms
unsigned EndTime = 10000; // 10 seconds
unsigned cTime = 0;
while( cTime < EndTime )
{
float t = float(cTime)/EndTime;
gl.Clear( );
glPushMatrix( );
glRotatef( t*360,0,0,1 );
Scene.Render( );
glPopMatrix( );
gl.SwapBuffers( );
cTime = GetTime( ) - StartTime;
}
what ways are there to make this easier?
i don''t like my new way, but it''s better than this.
i just wanted to post this cuz i feel its a lowest common denominator, and i didnt want to bias w/ my new code.
anyway, if ya find it in your heart to reply, thank you
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I have no name that you may call me. I am merely Succinct.
~Succinct Demos Online~
"Hey, where''d that display list rotate off to now?"
-(Drop me a line here)-
Time based events/rendering
alright, guys.
i got my ideas, but i''ve found out that asking u guys usually means getting some more succinct coding ideas, so:
i''m basing just about everything on time, from animation to events to key presses etc...
now, my code for it has too much overhead.
all i need is a start time, and end time, and a factor 0 <= t <= 1 that says where in that start time/endtime interval i am.
for instance, to draw a scene and spin it around the z axis (in ogl) my code might look like this:
-- Succinct(Don't listen to me)
As I see it, your code as written will have a huge processor-use overhead, since it doesn''t do anything other than render the scene as often as it can for 10 seconds! Does the Render function wait for the next screen-refresh? If not, it''s likely to be rendering far more often (depending on the scene''s complexity) than necessary.
Do you want to do anything else whilst this is going on?
Do you want to do anything else whilst this is going on?
that was just a quick idea...
i used it in a crappy demo i did that didn''t matter.
but ur right, that it should wait for the refresh.
kewl, i didn''t think ''bout that part.
this stuff would go in it''s own thread, i''d say, just updating Scene in the main thread.
-- Succinct(Don't listen to me)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement