VVISF & VVGL
VVGL::GLCachedProperty Struct Reference

Abstract base class that caches the location of an arbitrary GL "object" that we do not own. More...

#include <GLCachedProperty.hpp>

Inherited by VVGL::GLCachedAttrib, and VVGL::GLCachedUni.

Public Member Functions

virtual void cacheTheLoc (const int32_t &inPgmToCheck)
 Pure virtual function, subclasses must implement this. This is where the GL stuff specific to the subclass is performed. A valid GL context must be current before you call this function- subclasses may have additional requirements.
 
int32_t location (const int32_t &inGLProgram)
 Returns the location of the property cached by the receiver. A valid GL context must be current before you call this function. Caches the location if it hasn't been looked up/cached yet. Will only return -1 if there's a problem (if the attrib doesn't exist in the current program in use by the current context).
 

Detailed Description

Abstract base class that caches the location of an arbitrary GL "object" that we do not own.

A lot of GL "objects"- like attributes, uniforms, etc- are numbers that we have to keep track of (but not assume ownership of). Querying the context for the location of these "objects" every render pass is a performance sink. The goal of this class is to eliminate the need to repeatedly query the GL context by caching the location along with the relevant program and a string that can be used to look up the property.

This is an abstract base class, so you should never create an instance of it directly- instead, use one of its subclasses (or write another subclass) which cache specific kinds of data: GLCachedAttrib caches the location of an attribute in a GLSL program, and GLCachedUni caches the location of a uniform in a GLSL program.

Notes on use:


The documentation for this struct was generated from the following file: