Portal View Frustums w/Hardware T&L
Question submitted by (09 January 2000)

Return to The Archives
  I'm working on a small portal engine in OpenGL.

Now I wonder, what is better for the view frustum clipping? I use 6 planes for the normal view, and when I find a portal, I will have to adjust these planes so clipping is done according to the portal.

OpenGL has it's "view frustum" (glFrustum), which I've read somewhere should NOT to be changed during run time. Additionally, OpenGL can use "extra clipping planes", so, I assume I COULD use these for my portalclipper.

But, will this be extremely slow? Will it be speeded up with hardware T&L, or should I stick to my own software clipping?

  OpenGL has a matrix to facilitate projection of geometry onto a 2D plane. A persective projection can be set up using glFrustum(), and the area of the display being updated is controlled with glViewport(). When you combine them you get a frustum that you can use for clipping. I don't know of any performance problems with modifying them at run time, and I don't immediately see how you could effectively modify them to help with portal culling since the camera is part of the modelview matrix.

You can use OpenGL's clip planes for your portals and you will get hardware acceleration on some drivers under certain conditions. The GeForce 256 supports user clip planes in hardware, but for some odd reason the number of clip planes is limited by the number of texture stages being used. This is from my memory of a conversation Richard Huddy from NVIDIA was having on the DirectX developers mailing list about this topic so I can't guarantee that it is totally correct.

It is my guess that user clip planes are not going to be on the fast path for most drivers, but the only way you're really going to be able to tell is to try it out for yourself.

Response provided by Tom Hubina

This article was originally an entry in flipCode's Fountain of Knowledge, an open Question and Answer column that no longer exists.


Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.