# OpenGL Extend Far Clipping Plane

This topic is 4079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Is there any way to extend the far clipping plane of the frustum without changing anything else about the projection matrix? I'm using OpenGL, however I ask in this forum since there may be an API-independent solution.

##### Share on other sites
I don't understand what you want, or why you want it.
A 0 0 00 B 0 00 0 C D0 0 E 0

That's the generic projection matrix commonly used for OpenGL (it is the form generated by gluPerspective). The fourth (zFar) parameter to gluPerspective is the distance to the fact clip plane. What's wrong with just changing that? That value only alters C and D in the matrix above (both of which use zFar in some form).

Are you saying you want to use a projection matrix that only includes zFar once? Why? Although many forms of project matrix exist (there are tons of ways to project geometry), it will likely not give you the results you expect, as the reason the GL projection matrix looks the way it does is to appropriate project the geometry based on the information the pipeline has.

##### Share on other sites
Thanks for your reply. I have an object inside of a rendering library. When the render function for my object is called, the projection matrix is already set up to render. However, for only my object I want to change the far clip plane. I tried using gluPerspective() to do so while at the same time guessing the other parameters. This would affect the scene negatively by making things look distorted.

How do I change C and D in the matrix to change the far clip plane?

##### Share on other sites
Quote:
 How do I change C and D in the matrix to change the far clip plane?

If you assume that the matrix was generated with gluPerspective (this is probably reasonable, and if its wrong there is still a good chance you'll be okay, but this is not assured), then C and D are
C = (far + near) / (near - far)D = (2 * far * near) / (near - far)

You can obtain the actual values of C and D by using glGetFloatv or glGetDoublev with the appropriate constant, then reading the appropriate elements of the resulting array. Some algebra can get you to the value of far, I guess. I suppose this should work, but it's hacky and makes some assumptions I'm not comfortable with. Can't you get the information you need elsewhere?

1. 1
2. 2
frob
20
3. 3
JoeJ
20
4. 4
5. 5

• 10
• 11
• 12
• 13
• 9
• ### Forum Statistics

• Total Topics
632210
• Total Posts
3004813

×