Jump to content

  • Log In with Google      Sign In   
  • Create Account

gluLookAt


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 theodore italik   Members   -  Reputation: 100

Like
0Likes
Like

Posted 23 January 2011 - 06:40 AM

Hi,

I'm only starting to get to grips with 3D and I've rendering various simple 2D and 3D shapes in OpenGL. In almost all the tutorials I've seen coordinates specified in the -1.0f to 1.0f range, I assumed (after doing some reading) the coordinates are specified like that and not, for example (50.0f, 10.0f, -15.0f) because the camera (by default) is centred around the origin and anything at those coordinate would not be visible. Is that correct?

My question relating to gluLookAt() is that if I want to start specifying objects that are away from the origin (as in my example coordinates above) is gluLookAt() the correct way to move away from the origin and be able to draw / view a larger area?

Thanks,

T.

Sponsor:

#2 scgames   Members   -  Reputation: 1977

Like
0Likes
Like

Posted 23 January 2011 - 08:57 AM

I'm only starting to get to grips with 3D and I've rendering various simple 2D and 3D shapes in OpenGL. In almost all the tutorials I've seen coordinates specified in the -1.0f to 1.0f range, I assumed (after doing some reading) the coordinates are specified like that and not, for example (50.0f, 10.0f, -15.0f) because the camera (by default) is centred around the origin and anything at those coordinate would not be visible. Is that correct?

No, that's not really correct. I'm not sure what tutorials you've been looking at, but if the coordinates were limited to the range [-1, 1], I imagine it was just to keep things simple (for example, if you leave the projection matrix at identity, coordinates in that range will all be 'on screen', provided the points fall between the near and far planes). In general though, there are no constraints on or particular rules or guidelines regarding coordinate ranges, at least not beyond the usual concerns regarding numerical precision, depth range precision, and so on.

My question relating to gluLookAt() is that if I want to start specifying objects that are away from the origin (as in my example coordinates above) is gluLookAt() the correct way to move away from the origin and be able to draw / view a larger area?

There's nothing special about gluLookAt() or any other similar function. All that matters is what ends up at the top of the modelview matrix stack (assuming fixed function, which I assume you're using since you're using gluLookAt()). gluLookAt() is one of many ways you can manipulate the matrix stack, but there's nothing special about that function in particular.

#3 theodore italik   Members   -  Reputation: 100

Like
0Likes
Like

Posted 23 January 2011 - 02:35 PM


I'm only starting to get to grips with 3D and I've rendering various simple 2D and 3D shapes in OpenGL. In almost all the tutorials I've seen coordinates specified in the -1.0f to 1.0f range, I assumed (after doing some reading) the coordinates are specified like that and not, for example (50.0f, 10.0f, -15.0f) because the camera (by default) is centred around the origin and anything at those coordinate would not be visible. Is that correct?

No, that's not really correct. I'm not sure what tutorials you've been looking at, but if the coordinates were limited to the range [-1, 1], I imagine it was just to keep things simple (for example, if you leave the projection matrix at identity, coordinates in that range will all be 'on screen', provided the points fall between the near and far planes). In general though, there are no constraints on or particular rules or guidelines regarding coordinate ranges, at least not beyond the usual concerns regarding numerical precision, depth range precision, and so on.

My question relating to gluLookAt() is that if I want to start specifying objects that are away from the origin (as in my example coordinates above) is gluLookAt() the correct way to move away from the origin and be able to draw / view a larger area?

There's nothing special about gluLookAt() or any other similar function. All that matters is what ends up at the top of the modelview matrix stack (assuming fixed function, which I assume you're using since you're using gluLookAt()). gluLookAt() is one of many ways you can manipulate the matrix stack, but there's nothing special about that function in particular.



Thanks for replying jyk. I think spending some more time tinkering with the various matrix operations will help me understand what exactly is going on.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS