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.

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 on other sites
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 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.

1. 1
2. 2
3. 3
Rutin
13
4. 4
5. 5

• 26
• 10
• 9
• 9
• 11
• Forum Statistics

• Total Topics
633696
• Total Posts
3013390
×

Important Information

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!