PDA

View Full Version : clipping cube



richman.feynard
10-04-2017, 05:51 PM
Hi everybody!

Hope someone could help with my question. As it's known, by default, OpenGL crops everything outside the cube bounded by planes x={-1,1}, y={-1,1}, z={-1,1}. How could one deal with this, for example, if there is a need to draw something bigger than this cube? Is there any way to scale this cube?

Thanks!

Dark Photon
10-05-2017, 06:04 AM
Read the Viewing chapter in your favorite OpenGL book (for instance, this one (https://www.amazon.com/OpenGL-Programming-Guide-Official-Learning)), which discusses MODELING, VIEWING, and PROJECTION coordinate space transforms and the intermediate coordinate spaces (OBJECT, WORLD, EYE, and CLIP). This page (http://www.songho.ca/opengl/gl_transform.html) has a brief overview.

The cube you speak of is the conceptual bounds of clipping in NDC space, though clipping itself actually happens in the prior coordinate space (CLIP space). The scaling and orientation to fit this cube is done by the previously-mentioned 3 transforms.

richman.feynard
10-06-2017, 11:49 AM
Oh thanks, I'll check it.