gluLookAt

Started by
1 comment, last by theodore italik 13 years, 3 months ago
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.
Advertisement

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.

'theodore said:

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.

This topic is closed to new replies.

Advertisement