View Full Version : Draw predication in opengl

02-16-2009, 03:35 AM
Is there a way to perform draw predication like it's done in DX10 but using OpenGL, pls? Perhaps an specific extension I missed?


Roderic (Ingenu)
02-16-2009, 03:48 AM
like http://www.opengl.org/registry/specs/NV/conditional_render.txt ?

Rob Barris
02-16-2009, 02:03 PM
Conditional rendering was added in OpenGL 3.0 as a core feature.

02-16-2009, 02:44 PM
Conditional rendering was added in OpenGL 3.0 as a core feature.
Oh, that's nice. Could you tell me the exact functions to look for, please? Heheh, the gl.h is very large :P

Rob Barris
02-16-2009, 03:35 PM
Section 2.14: Conditional Rendering

Conditional rendering can be used to discard rendering commands based on the
result of an occlusion query. Conditional rendering is started and stopped using the

void BeginConditionalRender( uint id, enum mode );
void EndConditionalRender( void );

id specifies the name of an occlusion query object whose results are used to deter-
mine if the rendering commands are discarded. If the result (SAMPLES PASSED)
of the query is zero, all rendering commands between BeginConditionalRender
and the corresponding EndConditionalRender are discarded. In this case, Begin,
End, all vertex array commands performing an implicit Begin and End, Draw-
Pixels (see section 3.7.4), Bitmap (see section 3.8), Clear (see section 4.2.3),
Accum (see section 4.2.4), CopyPixels (see section 4.3.3), and EvalMesh1 and
EvalMesh2 (see section 5.1) have no effect. The effect of commands setting cur-
rent vertex state, such as Color or VertexAttrib, are undefined. If the result of the
occlusion query is non-zero, such commands are not discarded.

Link to the doc page where you can download the spec PDF's:

02-16-2009, 04:24 PM
thx rob!