利用者:Jwilkins/VFX/Misc/StateLatching

提供: wiki
移動先: 案内検索

State Latching

Header File: GPU_state_latch.h

In different versions of OpenGL a particular feature may exist, but querying the underlying state may not be supported. In other cases it is still possible to query state, but it may be more efficient to go ahead and "latch" the value when it is set so that it can be retrieved without an OpenGL API call.

Note: The term latch comes from electronics, where a latch is basic unit of memory that can store whether a line was high or low.

It is important that the every use of an original OpenGL function is replaced by the state latching version. Otherwise the state held by the latch may become inaccurate.

Ultimately, if a way can be found to not have to use state latching, that is preferable, since the state latch is a global variable.

Viewport

void gpuViewport(int x, int y, unsigned int width, unsigned int height);
void gpuGetViewport(int out[4]);

Depth Range

void gpuDepthRange(GLdouble near, GLdouble far);
void gpuGetDepthRange(GLdouble range[2]);

Texture Binding

void gpuBindTexture(GLenum target, GLuint name);
GLuint gpuGetTextureBinding2D(void);

Depth Write Mask

void gpuDepthMask(GLboolean flag);
GLboolean gpuGetDepthWritemask(void);