Animations in OpenGL
Ok I have a newbie question that has been bugging me for a long time now.
I want to create an animation with OpenGL, that has no user input whatsover. I know with programs like 3D Studio max you can set up actions to happen at different frames. So I guess my question is more like: How do I set the program to do certain events after say 3 seconds or so? Like I want a man to run left for three 3 seconds and then turn around and run in the opposite direction for 5 seconds. How could I code a program to recognize that 3 Seconds has gone past and to preform another action?
Sorry if that was vague, if it was, I can try to write a better post.
-Cecil
not correct syntax
starttime = gettickcount()
while (gettickcount(){ run left
}
turn around + run right
http://members.xoom.com/myBollux
starttime = gettickcount()
while (gettickcount(){ run left
}
turn around + run right
http://members.xoom.com/myBollux
if you use glut, then in your initialization
before your main loop, use the glutTimerFunc
(see the documentation) and setup a timer
you can specify the value that you want the timer
to go off at (3 seconds later) and when that
time has elapsed it will call a function
that you specify....in this function you can
reinitialize the timer by using glutTimerFunc again
and specify a different time if you want or the
same time, etc.
or look up how to use a windows timer, etc.
hope that helps
I''m trying to stay as far away from GLUT as possible on all of my OpenGL programming, but the windows timer sounds really helpful! Where can I find info about it?
-Cecil
-Cecil
Sounds to me like you need to create your own scripting engine and that''s not easy for a newbie.Or you could preanimate everything in 3DSMAX and then import the animation into your OpenGL scene but that''s even harder
I don''t think I helped much,did I?
I don''t think I helped much,did I?
oi!! Well I have 3DSMax, basically I''m an animator who wants to become a programmer, and I know C/C++ pretty well however.
What is a scripting engine?
And I guess they are difficult to make, but are there any tutorials on the web for them?
My newbieness amazes even me
-Cecil
What is a scripting engine?
And I guess they are difficult to make, but are there any tutorials on the web for them?
My newbieness amazes even me
-Cecil
Here''s some code that''ll do what you want.
At the start of the program, use SetTimer(1,3000,NULL );
this will cause a WM_TIMER event to be triggered every 3 seconds. If these parameters are wrong, go to msdn.microsoft.com search for SetTimer and read what it says. Next you want to implement the WM_TIMER event. Put that in WinProc ( or is it WinMain ? I always use MFC so I don''t have that problem) with the other events and do what ever you want to do in there ( turn the guy around ? )
Hope that was helpful
fs
At the start of the program, use SetTimer(1,3000,NULL );
this will cause a WM_TIMER event to be triggered every 3 seconds. If these parameters are wrong, go to msdn.microsoft.com search for SetTimer and read what it says. Next you want to implement the WM_TIMER event. Put that in WinProc ( or is it WinMain ? I always use MFC so I don''t have that problem) with the other events and do what ever you want to do in there ( turn the guy around ? )
Hope that was helpful
fs
You can find documentation on windows timers
in the msdn visual studio library (comes with
visual c++ and other microsoft packages)
if you go to platform sdk, then windows base services, then
general library, then timers...they explain the
settimer, killtimer, etc.
still recommend GLUT...why the big aversion to GLUT?...if
you are new to programming or even just new to windows
programming, why wouldn''t you want to initially hide the windows-specific details and use GLUT...I know NeHe''s tutorials don''t use it but it seems to make sense if you are just learning
to avoid getting overwhelmed. I learned C/C++
in college but primarily on Unix systems, so windows-specific programming is all new to me...I''ve been using GLUT when I just want to concentrate on just learning/using openGL.
about the scripting thing....i think if you just want
to get started, just export you 3ds stuff into format
you can read and display them using the timers and stuff
and then worry about writing/using a whole scripting engine later.
btw, glm by Nate Robbins is a .obj library for reading in and using .obj files in openGL...you can get it at romka''s site
romka.demonews.com...was useful to me so thought i''d pass it on
in the msdn visual studio library (comes with
visual c++ and other microsoft packages)
if you go to platform sdk, then windows base services, then
general library, then timers...they explain the
settimer, killtimer, etc.
still recommend GLUT...why the big aversion to GLUT?...if
you are new to programming or even just new to windows
programming, why wouldn''t you want to initially hide the windows-specific details and use GLUT...I know NeHe''s tutorials don''t use it but it seems to make sense if you are just learning
to avoid getting overwhelmed. I learned C/C++
in college but primarily on Unix systems, so windows-specific programming is all new to me...I''ve been using GLUT when I just want to concentrate on just learning/using openGL.
about the scripting thing....i think if you just want
to get started, just export you 3ds stuff into format
you can read and display them using the timers and stuff
and then worry about writing/using a whole scripting engine later.
btw, glm by Nate Robbins is a .obj library for reading in and using .obj files in openGL...you can get it at romka''s site
romka.demonews.com...was useful to me so thought i''d pass it on
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement