Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglOcclusionCull Class Reference

#include <sglStatelet.hpp>

Inheritance diagram for sglOcclusionCull::

sglStatelet sglObject List of all members.

Public Methods

 sglOcclusionCull (bool on=false)
virtual ~sglOcclusionCull ()
void enable (bool on)
bool isEnabled () const
void apply (sglCurrState *curr_state) const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Detailed Description

This statelet works with either the GL_EXT_occlusion_test or GL_HP_occlusion_test extensions and encapsulates the glEnable(GL_OCCLUSION_TEST_HP) and glGetBooleanv(GL_OCCLUSION_RESULT_HP) functions to perform occlusion testing on geometry's bounding boxes to determine visibility before passing geometry onto the OpenGL rendering engines. Geometry that passes the cull test and have the occlusion statelet enabled will be placed in a separate "occlusion bin" outside of the normal state sorting mechanism and will be rendered before the geometry in the transparency bin but after all other state sorted geometry. To increase the chances that occlusions will be detected this bin is sorted and rendered from front to back.

If occlusion culling is enabled on hardware that does not support it the flag will be ignored and occlusion sorting will not occur.

Note: occlusion culling is expensive and should only be enabled for even more expensive geometry that is likely to be occluded.

What happens when transparency and occlusion are both enabled?

Example:

   sglOcclusionCull *occlude = new sglOcclusionCull;   // disabled by default
   occlude->enable(true);                              // enable it

Definition at line 1488 of file sglStatelet.hpp.


Constructor & Destructor Documentation

sglOcclusionCull::sglOcclusionCull ( bool on = false ) [inline]
 

Constructor (also the default constructor)

Parameters:
on   True to enable and false (the default) to disable occlusion cull.

Definition at line 1495 of file sglStatelet.hpp.

sglOcclusionCull::~sglOcclusionCull ( ) [inline, virtual]
 

virtual constructor.

Definition at line 1499 of file sglStatelet.hpp.


Member Function Documentation

void sglOcclusionCull::enable ( bool on ) [inline]
 

Enable/disable occlusion cull (if supported by the rendering hardware).

Parameters:
on   True to enable and false to disable occlusion culling.

Definition at line 1504 of file sglStatelet.hpp.

bool sglOcclusionCull::isEnabled ( ) const [inline]
 

Query the flag for occlusion culling.

Returns:
True if enabled, or false if disabled.

Definition at line 1513 of file sglStatelet.hpp.

void sglOcclusionCull::apply ( sglCurrState * curr_state ) const [virtual]
 

Apply this state change to the current rendering state.

Parameters:
curr_state   Required for statelets that affect one another. For example the sglTransparency sets up depth mask and blending modes which interact with the sglBlending and sglDepthMask statelets, and the curr_state object is used to resolve these internal issues.

Reimplemented from sglStatelet.

virtual void sglOcclusionCull::printInfo ( ostream & ostrm,
const char * indent_string ) const [virtual]
 

Output the state of this node to the specified ostream.

Parameters:
ostrm   the ostream to which the output is sent
indent_string   the string (usually spaces) that is output at the beginning of every line of output

Reimplemented from sglStatelet.


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:09 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001