Jump to content
  • Advertisement
Sign in to follow this  
vicz

OpenGL 3D scene

This topic is 4090 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I really need help I am working on a project in OpenGL Meanwhile I draw part of 3D scene:narrow cylinder,sphere on it and two octahedrons on the sides of the sphere (it will be a flower). I used: gluLookAt(0.0,0.0,6.0,0.0,0.0,0.0,0.0,1.0,0.0); gluPerspective(90.0,1.0,3.0,20.0); Now I am trying to move the "camera" along axises,which is a part of my project For example I move a little to the right along x-axis by changing: gluLookAt(2.0,0.0,6.0,2.0,0.0,0.0,0.0,1.0,0.0); the cylinder and the sphere move properly but octahedrons don't and when I move along the z-axis, when I write: gluLookAt(0.0,0.0,8.0,0.0,0.0,0.0,0.0,1.0,0.0); there is a big gap between the sphere and the cylinder which moves down, octahedrons move to the left when I write: gluLookAt(0.0,0.0,4.0,0.0,0.0,0.0,0.0,1.0,0.0); the sphere and the cylinder move up and the sphere is in the middle of the cylinder, octahedrons move right what I'm doing wrong? Is it because I've rotated those shapes in different directions? How can I fix it? Please help me!!! Victoria

Share this post


Link to post
Share on other sites
Advertisement
addition information that point out the problem
if I don't rotate any object at the scene - the movement along all three axises works perfect.

But I can't do without rotation....
What should I do?

Share this post


Link to post
Share on other sites
I don't know the answer to this problem, but here's a guess. In my experience, many problems like this are caused by the order in which transformations are applied.

How do you apply the transformations to your shapes?

Do you translate them first, then rotate?

Or do you rotate them first, then translate?

Anyway, maybe try reversing that order.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!