Light | Dark

glPrimitiveBoundingBox

Name

glPrimitiveBoundingBox — set the bounding box for a primitive

C Specification

void glPrimitiveBoundingBox( GLfloat minX,
  GLfloat minY,
  GLfloat minZ,
  GLfloat minW,
  GLfloat maxX,
  GLfloat maxY,
  GLfloat maxZ,
  GLfloat maxW);
 

Parameters

minX, minY, minZ, minW

Specify the minimum clip space coordinate of the bounding box. The initial value is (-1, -1, -1, 1).

maxX, maxY, maxZ, maxW

Specify the maximum clip space coordinate of the bounding box. The initial value is (1, 1, 1, 1).

Description

glPrimitiveBoundingBox specifies a clip space bounding box which may allow implementations to optimize performance if the application provides bounds of primitives that will be generated by the tessellation primitive generator or the geometry shader prior to executing those stages. If the provided bounds are incorrect and primitives extend beyond them, the rasterizer may or may not generate fragments for the portions of primitives outside the bounds.

The bounding box in clip space is composed of 16 vertices formed by all combinations of the minimum and maximum values for each dimension. This bounding box is clipped against w c > 0 and projected to three dimensions by dividing x c , y c , and z c by w c for each vertex. The viewport transform is then applied to each vertex to produce a three-dimensional bounding volume in window coordinates. The window space bounding volume is expanded in the X and Y dimensions to accommodate the rasterization rules for the primitive type, and to fall on fragment boundaries.

If tessellation is active, each invocation of the tessellation control shader may re-specify the bounding box by writing to the built-in gl_BoundingBox[] variable. If the shader statically assigns a value to any part of this variable, then gl_BoundingBox[0] is used instead of minX, minY, minZ, minW, and gl_BoundingBox[1] is used instead of maxX, maxY, maxZ, maxW. If the shader contains a static assignment to gl_BoundingBox[] and there is an execution path through the shader that does not write all components of gl_BoundingBox[], the value of unwritten components and corresponding bounding box coordinates is undefined for executions of the shader that take that path.

Associated Gets

glGet with argument GL_PRIMITIVE_BOUNDING_BOX

API Version Support

OpenGL ES API Version
Function Name 2.0 3.0 3.1 3.2
glPrimitiveBoundingBox - - -
Think you can improve this page? Edit this page on GitHub.