Archived

This topic is now archived and is closed to further replies.

Phobeus

gluLookAt swaps axis?

Recommended Posts

Hi guys, okay, maybe another stupid question. I really have some strange things when using gluLookAt. I think that the x-axis is somekind of swapped... means the positive axis moves along to the left... and the negative towards the right... okay please have a look at the following source (note its Delphi!) glClear(GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT); glLoadIdentity; //gluLookAt(0,0,-6,0,0,0,0,1,0); //glTranslate(-1.5,0,0); glTranslate(-1.5,0,-6); glRotate(timegettime/10,0,1,0); [rendering object] note that i comment two lines. When I run the program with this settings using translate only, the object is on the left side, just as i expect when saying "move along x axis -1.5". When I am using the commented lines instead, saying the cam should be at 0/0/-6 and then moves the object -1,5 it''s suddenly at the right side! I am not sure if this really is thought like that, but I have no idea where the error is. I have a feeling like OpenGL is not using two matricen for view and world... but... I could I fix this? thx, Phobeus

Share this post


Link to post
Share on other sites
If you move left, isn''t it supposed to look like everything else is moving right?

If not, change the -6 to 6 and look at it from the other side. Then it will look right, or is that cheating?

Share this post


Link to post
Share on other sites
That''s a strange behavior, when using D3D before. There you habe a view matrix and no world translation are effected on that. In OpenGL all translatation also use the view matrix, or better said there''s nothing like that...

so in fact I need to reset the cameraview after every translation again? Let me say i want to put something at -1/0/0 and 1/0/0... so I have to set the viewmatrix to 0/0/-5 (for example) translate the first object to -1. Then reset the viewmatrix to 0/0/-5 again and then translate the second to 1? Of course I also could use 2 from the first position, but that must end up in some really weird, source won''t it?

Ceya,
Phobeus

Share this post


Link to post
Share on other sites
Sorry, guys, me again. I think that this system is totally weird :-/

Okay... have used gluLookAt for positioning the cam at 0,10,-2 and looking at 0/0/0. So a light 3D view from the top. Now I am translating some objects in the positive x and z area. With success... when I am using glTranslate(-1,0,0); so i am moving this objects to the left.. so it shall looks like they moving right.... right?

But what shall I expect, when I am setting the view cam at 5,10,-2 looking at 5,0,0 ? I would expect that the objects would be more to the left side because I moving the camera to a position more left. But the objects are moving towards the right sight...

I really thought that the params at gluLookAt would be a Position, not translation values? I really think that this is really strange... Can someone try to explain ?

thx,
Phobeus

Share this post


Link to post
Share on other sites