Are parameters in ortho defined in camera coordinate or object coordinate: Does it mean that any transformation by look up has already been performed from MVP = ProjectionViewModel;

In the above ortho function, near = 50.0 and far = -50.0; .How can I interpret when near is behind the camera and vice versa? I found that it does not affect my output when I swap near and far. Why?

Please help me with clarification about the above questions.

Are parameters in ortho defined in camera coordinate or object coordinate: Does it mean that any transformation by look up has already been performed from MVP = ProjectionViewModel;
[/QUOTE]
It’s just a matrix which maps the given cuboid to the signed unit cube. The nature of the coordinates which it transforms depends entirely upon what you do with the matrix.

Typically, glm::ortho() is used for generating a projection matrix, meaning that the coordinates will have been transformed by the model-view matrix, i.e. they are in eye space.

For an orthographic projection, there is no “behind” or “in front”. The projection lines are parallel, so they don’t converge to a point.

Thank you so much for the reply GClements. I’d be very good if you can clarify a bit better. Suppose I draw an object at the center (0, 0, 0). Now I define ortho function as follows:

By itself, constructing the matrix does nothing. In order for it to affect rendering, you’d typically pass it to a shader which then uses it to transform vertex coordinates (or, with the fixed-function pipeline, use glMatrixMode(GL_PROJECTION) and glLoadMatrix()).

OpenGL will clip geometry based upon the final vertex coordinates stored in gl_Position (or, with the fixed-function pipeline, the result of transforming vertex coordinates by both the model-view and projection matrices). So the portion of the geometry which is clipped depends upon all of the transformations involved, not just the projection.

[QUOTE=GClements;1279868]What are you doing with projection_matrix?

By itself, constructing the matrix does nothing. In order for it to affect rendering, you’d typically pass it to a shader which then uses it to transform vertex coordinates (or, with the fixed-function pipeline, use glMatrixMode(GL_PROJECTION) and glLoadMatrix()).

OpenGL will clip geometry based upon the final vertex coordinates stored in gl_Position (or, with the fixed-function pipeline, the result of transforming vertex coordinates by both the model-view and projection matrices). So the portion of the geometry which is clipped depends upon all of the transformations involved, not just the projection.[/QUOTE]

But then how should I choose near and far for glOrtho when my object is drawn at the center so that I know the object should be displayed. What is the ideal way? It is said near and far are bounding plane within which the object will reside. From your explanation, it seems that the final vertex position lies inside the near and far plane (though these are away from object) and that makes the object visible? Is it?

[QUOTE=Lee_Jennifer_82;1279869]But then how should I choose near and far for glOrtho when my object is drawn at the center so that I know the object should be displayed. What is the ideal way? It is said near and far are bounding plane within which the object will reside. From your explanation, it seems that the final vertex position lies inside the near and far plane (though these are away from object) and that makes the object visible? Is it?
[/QUOTE]
You need to know the range of possible vertex positions after transformation by the model-view matrix from object space to eye space. If the matrix generated by glm::ortho() is used as the projection matrix (the transformation from eye space to clip space), then its parameters define the bounds of the clip region in eye space.

Hello GClements, I’m still unclear. It would be very kind of you to explain with respect to the example mentioned below:
Camera at origin, object at origin and ortho function looks like follows: