Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
Shader variables

VSG extension Open Inventor Shader API variables accessors.

VSG extension Open Inventor Shader API variables accessors.

Since OpenGL 3.2, a number of shader inputs and outputs like gl_FrontColor or gl_TexCoord are deprecated and not available anymore in Core Profile.

The aim of the functions in this API is to provide the same level of functionnality as those deprecated variables, while ensuring compatibility with Core Profile at the same time.

These methods are accessible by including the <Inventor/oivShaderVariables.h> header in your shader:

void main()
{
// legacy code: gl_FragColor = gl_Color;
}
vec4 OivFragmentColor()
IN.
void OivFragmentOutput(in int bufferIndex, in vec4 outputValue)
Set the output value of the current fragment in the buffer specified by bufferIndex.

For each function in this API, the documentation in oivShaderVariables.h explains in which shader stage it is available and which legacy variable corresponds to it. Usually, the name of the function is rather transparent compared to the name of the corresponding deprecated variable. For example, OivSetFrontColor(vec4 color) sets the value corresponding to the legacy gl_FrontColor.