Problem with the View Volume?

I am having a problem and I was hoping someone could help me. I am on Windows Vista, running OpenGL 3.3, and GLSL 3.3.

I am able to draw lots of different objects, and do things with them in the vertex and fragment shaders.

However, there is still one problem I have that I can not figure out.

Here is the situation:

- I create a window.
- I create vertex and fragment shaders that are basically just pass throughs.
- I then draw a simple square.
- If I translate the square in the Z direction by 0.5, -0.5, 1.0, or -1.0, the square will still appear in the window.
- I can translate the square up and down, left and right, and it works as intended.
- However, if I translate the square by anything more than 1.0 or -1.0 in the Z direction, I no longer see the square.

It seems as if by default, the viewing volume is a 2x2 cube centered on the origin, and only vertex's falling within this volume will be mapped to the window.

So if there is a vertex that is more then 1.0 units from the origin in the Z-direction, then it gets clipped.

Assuming your vertex shader is not doing any perspective projection, your gl_Position W coordinates will be 1.0. So you're effectively using an orthographic projects. So the object isn't supposed to appear to move based on the Z.

However, once you exceed the boundaries of clip-space (which is +/- W in all three axes. And since W is 1.0...), the triangle won't be rendered. None of the triangle is within the clip-space volume, and thus none of it will be visible.

How you "solve the problem" depends entirely on what you want to have happen. Which you have not explained.

Assuming your vertex shader is not doing any perspective projection, your gl_Position W coordinates will be 1.0. So you're effectively using an orthographic projects. So the object isn't supposed to appear to move based on the Z.

However, once you exceed the boundaries of clip-space (which is +/- W in all three axes. And since W is 1.0...), the triangle won't be rendered. None of the triangle is within the clip-space volume, and thus none of it will be visible.

How you "solve the problem" depends entirely on what you want to have happen. Which you have not explained.

How do I change the clip-space volume?

For example, if I translate a square to z = -10, I dont want it to disappear.