example demos with camera movement and nehe code
hi,
iam new to opengl and currently iam working through the nehe tutorials wich are very good in my mind. the only thing iam missing is something like camera movement. i plan to make some demos soon. and i dont want to use a fixed camera all the time like in the nehe tutorials. so my question is now if there are any tutorials wich show you how to move the camera around. also any links to simple demos using nehes opengl basecode would be appreciated. thx in advance!
try this
void CCamera::MoveCamera()
{
int x;
int y;
float deltax;
float deltay;
x=1280/2;
y=1028/2;
POINT cursorpos;
GetCursorPos(&cursorpos);
SetCursorPos(640,512);
if(x==cursorpos.x && y==cursorpos.y)
return;
deltax=(float)(x - cursorpos.x)/1000;
deltay=(float)(y - cursorpos.y)/1000;
gPlayer.viewangle[0] +=deltay * gPlayer.scrollratio;
gPlayer.viewangle[1] +=deltax * gPlayer.scrollratio;
gPlayer.viewangle[2]=0.0;
}
void CCamera::MoveCamera()
{
int x;
int y;
float deltax;
float deltay;
x=1280/2;
y=1028/2;
POINT cursorpos;
GetCursorPos(&cursorpos);
SetCursorPos(640,512);
if(x==cursorpos.x && y==cursorpos.y)
return;
deltax=(float)(x - cursorpos.x)/1000;
deltay=(float)(y - cursorpos.y)/1000;
gPlayer.viewangle[0] +=deltay * gPlayer.scrollratio;
gPlayer.viewangle[1] +=deltax * gPlayer.scrollratio;
gPlayer.viewangle[2]=0.0;
}
http://www.8ung.at/basiror/theironcross.html
hmmm, i meant a movement like in graphic demos where you cant interact. so lets say the camera moves to a specific position when a time is reached, stays there for some time and then rotates for example and waits again. thats what i tried to ask for. you know something like a camera path. nevertheless thx for your quick reply. greetings!
Dry downloading any of past contest demos. Just about all of them had moving camera.
You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
thx i know that they use some sort of camera movement and ill have to read through some of them in the near future if i dont find a suitable tutorial. but i think it would be better to find explained good code or even a tutorial for that purpose of learning camera control. so if anyone knows a place where to find this stuff let me pls know... thx in advance again
Hello ???!!!! ...... Hehe''s Lesson 10
Don''t you all remember how to move the camera ?????
Has Nehe taught you nothing ....
To move the view (the camera), you just move the polygons.
Like if you want your camera to move 10 units forward, all you do is you translate every polygon 10 units backward. If you want to rotate your camera, you just rotate every polygon. To move camera when it has been rotated for a certain angle you use sin and cos .....
Hope this makes sense ....
Don''t you all remember how to move the camera ?????
Has Nehe taught you nothing ....
To move the view (the camera), you just move the polygons.
Like if you want your camera to move 10 units forward, all you do is you translate every polygon 10 units backward. If you want to rotate your camera, you just rotate every polygon. To move camera when it has been rotated for a certain angle you use sin and cos .....
Hope this makes sense ....
For my halloween entry, I had the same problem
I don''t know how most people do it but what I did was store information about a number of ''waypoints''
Each waypoint would have a position, a look at position, a time (the time it should be when camera reaches it), and a pausetime.
Then I just interpolated between each waypoint based on the amount of time that has passed... and then Position and rotate the camera using gluLookAt(). You know?
Worked well enough for my purposes.... you can look at the source when nehe releases the demos, although the design of the code is pretty embarassing (give me a break, my first demo!)
I don''t know how most people do it but what I did was store information about a number of ''waypoints''
Each waypoint would have a position, a look at position, a time (the time it should be when camera reaches it), and a pausetime.
Then I just interpolated between each waypoint based on the amount of time that has passed... and then Position and rotate the camera using gluLookAt(). You know?
Worked well enough for my purposes.... you can look at the source when nehe releases the demos, although the design of the code is pretty embarassing (give me a break, my first demo!)
MSN: stupidbackup@hotmail.com (not actual e-mail)ICQ: 26469254(my site)
hi again, i looked at your demo nice work!
but as iam a beginner its pretty difficult for me to look through and understand all the code.
i am really missing a tutorial on how to use the knowledge gained at nehe and co. to make a simple demo. ok i can rotate cubes now and make small objects and texture them but i mean a small step for step guide on how to put together that knowledge and make a demo. that would be wonderful for the general understanding and learning from.
does anyone know where i could find such a thing ?
thx
but as iam a beginner its pretty difficult for me to look through and understand all the code.
i am really missing a tutorial on how to use the knowledge gained at nehe and co. to make a simple demo. ok i can rotate cubes now and make small objects and texture them but i mean a small step for step guide on how to put together that knowledge and make a demo. that would be wonderful for the general understanding and learning from.
does anyone know where i could find such a thing ?
thx
I don''t know, like I said I had trouble finding any information myself, but I just launched a website... and I think I''ll write an article on that if there''s people that might want it.
check here (http://www.alientrap.com/neproxource/) in a weeks time... It should probably be up by then
check here (http://www.alientrap.com/neproxource/) in a weeks time... It should probably be up by then
MSN: stupidbackup@hotmail.com (not actual e-mail)ICQ: 26469254(my site)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement