Vuo  2.3.2
Classes | Typedefs

Description

A graphics shader program, specifying how to render a 3D object.

A VuoShader can contain up to 3 separate GL Program Objects, each of which processes a different type of input primitive (points, lines, triangles).

Each GL Program Object must contain a vertex shader, and can optionally contain a geometry and/or fragment shader.

If no fragment shader is present, the program object is assumed to be used for Transform Feedback (see VuoSceneObjectRenderer).

The struct is typedef'd to a pointer so that VuoShaders are reference-counted, enabling Vuo to automatically delete the GL Program Objects when the last reference is released.

Usage

To create a shader that supports rendering points, lines, and triangles to a framebuffer:

VuoShader shader = VuoShader_make("Color Shader (Unlit)");
VuoShader_addSource(shader, VuoMesh_Points, vertexShader1, geometryShader1, fragmentShader1);
VuoShader_addSource(shader, VuoMesh_IndividualLines, vertexShader2, geometryShader2, fragmentShader2);
VuoShader_addSource(shader, VuoMesh_IndividualTriangles, vertexShader3, NULL, fragmentShader3);
VuoShader_setUniform_VuoColor(shader, "color", color);

To render using that shader:

GLint positionAttribute, normalAttribute, textureCoordinateAttribute, colorAttribute;
VuoShader_getAttributeLocations(shader, elementAssemblyMethod, glContext, &positionAttribute, &normalAttribute, &textureCoordinateAttribute, &colorAttribute);
// [...] enable vertex attribute arrays
VuoShader_activate(shader, elementAssemblyMethod, glContext);
// [...] glDrawArrays() or glDrawElements()
VuoShader_deactivate(shader, elementAssemblyMethod, glContext);
// [...] disable vertex attribute arrays

Classes

struct  VuoSubshader
 References to shader source code and shader code uploaded to the GPU. More...
 
struct  VuoShaderUniform
 Holds values to eventually be assigned to a GL Program Object's uniforms. More...
 
union  VuoShaderUniform.value
 

Typedefs

typedef struct _VuoShader * VuoShader
 A graphics shader program, specifying how to render a 3D object or a 2D image. More...
 

Creating shaders from GLSL source code

VuoShader VuoShader_make (const char *name)
 Creates a shader object, which contains multiple GL Program Objects. More...
 
VuoShader VuoShader_makeFromFile (VuoShaderFile *shaderFile)
 Creates a shader object from a VuoShaderFile. More...
 
void VuoShader_addSource (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, const char *vertexShaderSource, const char *geometryShaderSource, const char *fragmentShaderSource)
 Associates GLSL shader source code with the specified inputPrimitiveMode of the specified shader. More...
 
void VuoShader_setExpectedOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, const unsigned int expectedOutputPrimitiveCount)
 Specifies the number of primitives the geometry shader is expected to produce per invocation. More...
 
void VuoShader_setMayChangeOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, const bool mayChangeOutputPrimitiveCount)
 Specifies whether the geometry shader may dynamically choose to skip outputting some primitives or output additional primitives. More...
 
void VuoShader_setTransparent (VuoShader shader, const bool isTransparent)
 See VuoShader::isTransparent. More...
 
#define VUOSHADER_GLSL_SOURCE(version, source)   "#version " #version "\n" #source
 A macro to facilitate defining a GLSL shader in a C source file. More...
 

Creating standard shaders

VuoShader VuoShader_makeDefaultShader (void)
 Returns a shared instance of the default (unlit checkerboard) shader. More...
 
VuoShader VuoShader_makeUnlitImageShader (VuoImage image, VuoReal alpha)
 Returns a shader that renders objects with an image (ignoring lighting). More...
 
VuoShader VuoShader_makeUnlitAlphaPassthruImageShader (VuoImage image, bool flipped)
 Returns a shader that renders objects with an image (ignoring lighting). More...
 
VuoShader VuoShader_makeGlTextureRectangleShader (VuoImage image, VuoReal alpha)
 Returns a shader that renders objects with an image (ignoring lighting). More...
 
VuoShader VuoShader_makeGlTextureRectangleAlphaPassthruShader (VuoImage image, bool flipped)
 Returns a shader that renders objects with an image (ignoring lighting). More...
 
VuoShader VuoShader_makeUnlitColorShader (VuoColor color)
 Returns a shader that renders a solid color. More...
 
VuoShader VuoShader_makeUnlitCircleShader (VuoColor color, VuoReal sharpness)
 Returns a shader that renders a solid color circle. More...
 
VuoShader VuoShader_makeUnlitRoundedRectangleShader (VuoColor color, VuoReal sharpness, VuoReal roundness, VuoReal aspect)
 Returns a shader that renders a solid color rounded rectangle. More...
 
VuoShader VuoShader_makeUnlitRoundedRectangleTrackShader (VuoColor background, VuoColor active, VuoReal sharpness, VuoReal roundness, VuoReal aspect, VuoBoolean isHorizontal, VuoReal value)
 Returns a shader that renders a solid color rounded rectangle with a split color based on value. More...
 
VuoShader VuoShader_makeUnlitCheckmarkShader (VuoColor color, VuoColor outline, float thickness)
 Returns a shader that renders a solid color checkmark with outline and outline thickness. More...
 
VuoShader VuoShader_makeLitColorShader (VuoColor diffuseColor, VuoColor highlightColor, VuoReal shininess)
 Returns a shader that renders a color with lighting. More...
 
VuoShader VuoShader_makeLitImageShader (VuoImage image, VuoReal alpha, VuoColor highlightColor, VuoReal shininess)
 Returns a shader that renders an image with lighting. More...
 
VuoShader VuoShader_makeLitImageDetailsShader (VuoImage image, VuoReal alpha, VuoImage specularImage, VuoImage normalImage)
 Returns a shader that renders an image with lighting and surface details. More...
 
VuoShader VuoShader_makeLinearGradientShader (void)
 Returns a linear gradient shader. More...
 
void VuoShader_setLinearGradientShaderValues (VuoShader shader, VuoList_VuoColor colors, VuoPoint2d start, VuoPoint2d end, VuoReal aspect, VuoReal noiseAmount)
 Sets parameters for the linear gradient shader using the provided colors and start and end coordinates. More...
 
VuoShader VuoShader_makeRadialGradientShader (void)
 Returns a radial gradient shader. More...
 
void VuoShader_setRadialGradientShaderValues (VuoShader shader, VuoList_VuoColor colors, VuoPoint2d center, VuoReal radius, VuoReal width, VuoReal height, VuoReal noiseAmount)
 Sets parameters for the radial gradient shader using the provided colors, center point, and radius. More...
 
VuoShader VuoShader_makeFrostedGlassShader (void)
 Returns a frosted glass shader. More...
 
void VuoShader_setFrostedGlassShaderValues (VuoShader shader, VuoColor color, VuoReal brightness, VuoPoint2d noisePosition, VuoReal noiseTime, VuoReal noiseAmount, VuoReal noiseScale, VuoReal chromaticAberration, VuoInteger levels, VuoReal roughness, VuoReal spacing, VuoInteger iterations, float aspectRatio)
 Sets parameters for the frosted glass shader. More...
 

Using shaders

bool VuoShader_isTransformFeedback (VuoShader shader)
 Returns true if each of shader's defined inputPrimitiveModes has a vertex shader (and optionally a geometry shader) but lacks a fragment shader. More...
 
unsigned int VuoShader_getExpectedOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode)
 Returns the number of primitives the geometry shader is expected to produce per invocation. More...
 
bool VuoShader_getMayChangeOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode)
 Returns true if the geometry shader may not output the expected primitive count. More...
 
bool VuoShader_upload (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext, void *outIssues) VuoWarnUnusedResult
 Compiles and uploads the shader, outputting any issues in a VuoShaderIssues instance. More...
 
bool VuoShader_getAttributeLocations (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext, int *positionLocation, int *normalLocation, int *textureCoordinateLocation, int *colorLocation) VuoWarnUnusedResult
 Outputs the shader program's vertex attribute locations (the same values as glGetAttribLocation()). More...
 
bool VuoShader_activate (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext, VuoGlProgram *outputProgram) VuoWarnUnusedResult
 Activates the shader program (glUseProgram()) on the specified glContext, binds the shader's images to texture units, and uploads its unforms, so that the shader is ready for use in rendering. More...
 
void VuoShader_deactivate (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext)
 Unbinds the shader's images from their texture units. More...
 
void VuoShader_resetContext (VuoGlContext glContext)
 Disuses whatever shader (if any) is currently active on glContext. More...
 
void VuoShader_setUniform_VuoImage (VuoShader shader, const char *uniformIdentifier, const VuoImage image)
 Sets a VuoImage input value on the specified shader. More...
 
void VuoShader_setUniform_VuoBoolean (VuoShader shader, const char *uniformIdentifier, const VuoBoolean boolean)
 Sets a bool uniform value on the specified shader. More...
 
void VuoShader_setUniform_VuoInteger (VuoShader shader, const char *uniformIdentifier, const VuoInteger integer)
 Sets an int uniform value on the specified shader. More...
 
void VuoShader_setUniform_VuoReal (VuoShader shader, const char *uniformIdentifier, const VuoReal real)
 Sets a float uniform value on the specified shader. More...
 
void VuoShader_setUniform_VuoPoint2d (VuoShader shader, const char *uniformIdentifier, const VuoPoint2d point2d)
 Sets a vec2 uniform value on the specified shader. More...
 
void VuoShader_setUniform_VuoPoint3d (VuoShader shader, const char *uniformIdentifier, const VuoPoint3d point3d)
 Sets a vec3 uniform value on the specified shader. More...
 
void VuoShader_setUniform_VuoPoint4d (VuoShader shader, const char *uniformIdentifier, const VuoPoint4d point4d)
 Sets a vec4 uniform value on the specified shader. More...
 
void VuoShader_setUniform_VuoColor (VuoShader shader, const char *uniformIdentifier, const VuoColor color)
 Sets a color uniform value on the specified shader accepting a VuoColor. More...
 
void VuoShader_setUniform_VuoList_VuoBoolean (VuoShader shader, const char *uniformIdentifier, const VuoList_VuoBoolean booleans)
 Sets a list of bool uniform values on the specified shader. More...
 
void VuoShader_setUniform_VuoList_VuoInteger (VuoShader shader, const char *uniformIdentifier, const VuoList_VuoInteger integers)
 Sets a list of int uniform values on the specified shader. More...
 
void VuoShader_setUniform_VuoList_VuoReal (VuoShader shader, const char *uniformIdentifier, const VuoList_VuoReal reals)
 Sets a list of float uniform values on the specified shader. More...
 
void VuoShader_setUniform_VuoList_VuoPoint2d (VuoShader shader, const char *uniformIdentifier, const VuoList_VuoPoint2d point2ds)
 Sets a list of vec2 uniform values on the specified shader. More...
 
void VuoShader_setUniform_VuoList_VuoPoint3d (VuoShader shader, const char *uniformIdentifier, const VuoList_VuoPoint3d point3ds)
 Sets a list of vec3 uniform values on the specified shader. More...
 
void VuoShader_setUniform_VuoList_VuoPoint4d (VuoShader shader, const char *uniformIdentifier, const VuoList_VuoPoint4d point4ds)
 Sets a list of vec4 uniform values on the specified shader. More...
 
void VuoShader_setUniform_VuoList_VuoColor (VuoShader shader, const char *uniformIdentifier, const VuoList_VuoColor colors)
 Sets a list of color uniform values on the specified shader's uniform uniformIdentifier of type vec4. More...
 
void VuoShader_setUniform_mat2 (VuoShader shader, const char *uniformIdentifier, float *mat2)
 Sets a mat2 (column-major 2x2 matrix) uniform value on the specified shader. More...
 
void VuoShader_setUniform_mat3 (VuoShader shader, const char *uniformIdentifier, float *mat3)
 Sets a mat3 (column-major 3x3 matrix) uniform value on the specified shader. More...
 
void VuoShader_setUniform_mat4 (VuoShader shader, const char *uniformIdentifier, float *mat4)
 Sets a mat4 (column-major 4x4 matrix) uniform value on the specified shader. More...
 
VuoShader VuoShader_make_VuoColor (VuoColor color)
 Creates an unlit color shader object. More...
 
VuoShader VuoShader_make_VuoShader (VuoShader shader)
 Returns the passed shader (does not make a copy). More...
 
VuoShader VuoShader_make_VuoImage (VuoImage image)
 Creates an unlit image shader. More...
 
VuoImage VuoShader_getUniform_VuoImage (VuoShader shader, const char *uniformIdentifier)
 Returns the VuoImage for the specified uniformIdentifier, or NULL if none matches. More...
 
VuoImage VuoShader_getFirstImage (VuoShader shader)
 Returns the first-added, non-NULL VuoImage uniform value, or NULL if there are no image uniforms. More...
 
VuoPoint2d VuoShader_samplerCoordinatesFromVuoCoordinates (VuoPoint2d vuoCoordinates, VuoImage image)
 Converts the provided vuoCoordinates into GLSL Sampler Coordinates relative to the provided image. More...
 
VuoReal VuoShader_samplerSizeFromVuoSize (VuoReal vuoSize)
 Converts an x-axis distance in Vuo Coordinates into GLSL Sampler Coordinates. More...
 
VuoPoint2d VuoShader_samplerRectCoordinatesFromNormalizedCoordinates (VuoPoint2d normalizedCoordinates, VuoInteger imageWidth, VuoInteger imageHeight)
 Converts the provided normalizedCoordinates into GLSL sampler2DRect coordinates relative to the provided width/height. More...
 
bool VuoShader_isOpaque (VuoShader shader)
 Returns true if the shader, as configured, will produce fully opaque output. More...
 
bool VuoShader_isPopulated (VuoShader shader)
 Returns true if the shader is anything other than the default (blue/purple gradient checkerboard). More...
 

Summary, serialization, and reference counting

char * VuoShader_getSummary (const VuoShader value)
 Returns a summary of the shader: the text description provided to VuoShader_make. More...
 
VuoShader VuoShader_makeFromJson (struct json_object *js)
 Decodes the JSON object js, expected to contain a 64-bit integer (memory address or 0), to create a new VuoShader. More...
 
struct json_objectVuoShader_getJson (const VuoShader value)
 Encodes value as a JSON object. More...
 
struct json_objectVuoShader_getInterprocessJson (const VuoShader value)
 Calls VuoShader_getJson(). More...
 
VuoShader VuoShader_makeFromString (const char *str)
 Automatically generated function. More...
 
char * VuoShader_getString (const VuoShader value)
 Automatically generated function. More...
 
void VuoShader_retain (VuoShader value)
 Automatically generated function. More...
 
void VuoShader_release (VuoShader value)
 Automatically generated function. More...
 
#define VuoShader_REQUIRES_INTERPROCESS_JSON
 This type has a _getInterprocessJson() function. More...
 

Class Documentation

◆ VuoSubshader

struct VuoSubshader
Class Members
VuoBoolean compilationAttempted If true, we've already attempted to compile this subshader.
unsigned int expectedOutputPrimitiveCount
VuoText fragmentSource
VuoText geometrySource
unsigned int glFragmentShaderName
unsigned int glGeometryShaderName
unsigned int glVertexShaderName
bool mayChangeOutputPrimitiveCount
VuoGlProgram program
VuoText vertexSource

◆ VuoShaderUniform

struct VuoShaderUniform
Class Members
unsigned int compiledTextureTarget For uniforms of type Image, this holds the OpenGL texture target used when expanding the source code.

This is set during VuoShader_ensureUploaded (not during VuoShader_setUniform_VuoImage).

VuoText name
VuoText type
union VuoShaderUniform value

◆ VuoShaderUniform.value

union VuoShaderUniform.value
Class Members
VuoBoolean boolean
VuoList_VuoBoolean booleans
VuoColor color
VuoList_VuoColor colors
VuoImage image
VuoInteger integer
VuoList_VuoInteger integers
float * mat2
float * mat3
float * mat4
VuoPoint2d point2d
VuoList_VuoPoint2d point2ds
VuoPoint3d point3d
VuoList_VuoPoint3d point3ds
VuoPoint4d point4d
VuoList_VuoPoint4d point4ds
VuoReal real
VuoList_VuoReal reals

Macro Definition Documentation

◆ VUOSHADER_GLSL_SOURCE

#define VUOSHADER_GLSL_SOURCE (   version,
  source 
)    "#version " #version "\n" #source

A macro to facilitate defining a GLSL shader in a C source file.

Definition at line 208 of file VuoShader.h.

◆ VuoShader_REQUIRES_INTERPROCESS_JSON

#define VuoShader_REQUIRES_INTERPROCESS_JSON

This type has a _getInterprocessJson() function.

Definition at line 295 of file VuoShader.h.

Typedef Documentation

◆ VuoShader

typedef struct _VuoShader * VuoShader

A graphics shader program, specifying how to render a 3D object or a 2D image.

Changed in Vuo 2.0.0:
Added activationCount, lastActivationTime.

Function Documentation

◆ VuoShader_activate()

bool VuoShader_activate ( VuoShader  shader,
const VuoMesh_ElementAssemblyMethod  inputPrimitiveMode,
VuoGlContext  glContext,
VuoGlProgram outputProgram 
)

Activates the shader program (glUseProgram()) on the specified glContext, binds the shader's images to texture units, and uploads its unforms, so that the shader is ready for use in rendering.

Parameters
shaderThe shader to activate.
inputPrimitiveModeThe shader program mode to activate.
glContextThe OpenGL context on which to activate the shader program.
outputProgramThe OpenGL program name and metadata.
Returns
True if the shader is ready to use, or false if:
  • the shader is NULL
  • or inputPrimitiveMode is invalid
  • or if there is no shader for this inputPrimitiveMode

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

Definition at line 939 of file VuoShader.cc.

◆ VuoShader_addSource()

void VuoShader_addSource ( VuoShader  shader,
const VuoMesh_ElementAssemblyMethod  inputPrimitiveMode,
const char *  vertexShaderSource,
const char *  geometryShaderSource,
const char *  fragmentShaderSource 
)

Associates GLSL shader source code with the specified inputPrimitiveMode of the specified shader.

(The compile and link steps are deferred until the shader is actually used.)

May be called multiple times, to enable this shader to support multiple inputPrimitiveModes.

Call before using VuoShader_getAttributeLocations, VuoShader_activate, and VuoShader_deactivate.

Parameters
shaderThe shader to modify.
inputPrimitiveModeThe type of input primitives this shader program will process. Should be VuoMesh_IndividualTriangles, VuoMesh_IndividualLines, or VuoMesh_Points.
vertexShaderSourceGLSL vertex shader source code. If NULL, a default vertex shader is used (it passes texture coordinates through, and projects the vertex).
geometryShaderSourceGLSL geometry shader source code. Optional (may be NULL), in which case the output of the vertex shader is passed through to the fragment shader.
fragmentShaderSourceGLSL fragment shader source code. Optional (may be NULL), in which case the shader is assumed to transform primitives into other primitives (rather than pixels), i.e., transform feedback.
See also
VUOSHADER_GLSL_SOURCE

VuoSceneRenderer renders a VuoSceneObject into an image or window, and automatically provides several uniform values and vertex attributes to shaders. A few are required; the rest are optional.

uniform mat4 projectionMatrix;  // required
uniform bool useFisheyeProjection;  // When true, projectionMatrix is calculated assuming that the vertex shader will perform fisheye warping.  See `VuoGlslProjection.glsl`.

uniform mat4 modelviewMatrix;   // required

uniform mat4 cameraMatrixInverse;   // Inverse of the matrix's modelviewMatrix.  Apply this to worldspace coordinates to transform the scene such that the camera is at the origin.
uniform vec3 cameraPosition;

uniform float aspectRatio;  // Viewport aspect ratio.
uniform vec2 viewportSize;  // Viewport size in pixels.
uniform sampler2D colorBuffer;  // A color image of what's been rendered so far (just before executing this shader).
uniform sampler2D depthBuffer;  // A depth image of what's been rendered so far (just before executing this shader).

float primitiveSize;

uniform vec4 ambientColor;
uniform float ambientBrightness;

struct PointLight
{
    vec4 color;
    float brightness;
    vec3 position;
    float range;
    float sharpness;
};
uniform PointLight pointLights[16];
uniform int pointLightCount;

struct DirectionalLight
{
    vec4 color;
    float brightness;
    vec3 position;
    vec3 direction;
    float cone;
    float range;
    float sharpness;
};
uniform DirectionalLight directionalLights[16];
uniform int directionalLightCount;

attribute vec3 position;  // required
attribute vec3 normal;
attribute vec2 textureCoordinate;
attribute vec4 vertexColor;
uniform bool hasTextureCoordinates;
uniform bool hasVertexColors;

VuoSceneObjectRenderer renders a VuoSceneObject into a VuoSceneObject, and automatically provides several uniform values and vertex attributes to shaders:

uniform mat4 modelviewMatrix;
uniform mat4 modelviewMatrixInverse;
attribute vec3 position;
attribute vec3 normal;
attribute vec2 textureCoordinate;
attribute vec4 vertexColor;

And it expects as output:

varying vec3 outPosition;
varying vec3 outNormal;
varying vec2 outTextureCoordinate;
varying vec4 outVertexColor;

This function may be called from any thread.

Definition at line 311 of file VuoShader.cc.

◆ VuoShader_deactivate()

void VuoShader_deactivate ( VuoShader  shader,
const VuoMesh_ElementAssemblyMethod  inputPrimitiveMode,
VuoGlContext  glContext 
)

Unbinds the shader's images from their texture units.

The shader program remains in use on glContext (in case it's needed again soon). To disuse the shader, see

See also
VuoShader_resetContext.
Parameters
shaderThe shader to deactivate.
inputPrimitiveModeThe shader program mode to deactivate.
glContextThe OpenGL context on which to deactivate the shader program.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

Definition at line 1336 of file VuoShader.cc.

◆ VuoShader_getAttributeLocations()

bool VuoShader_getAttributeLocations ( VuoShader  shader,
const VuoMesh_ElementAssemblyMethod  inputPrimitiveMode,
VuoGlContext  glContext,
int *  positionLocation,
int *  normalLocation,
int *  textureCoordinateLocation,
int *  colorLocation 
)

Outputs the shader program's vertex attribute locations (the same values as glGetAttribLocation()).

If necessary, this function also compiles, links, and uploads the program.

Parameters
shaderThe shader to query.
inputPrimitiveModeThe shader program mode to query.
glContextAn OpenGL context to use.
[out]positionLocationOutputs the shader program's vertex position attribute location. Pass NULL if you don't care.
[out]normalLocationOutputs the shader program's vertex normal attribute location (or -1 if this shader program doesn't have one). Pass NULL if you don't care.
[out]textureCoordinateLocationOutputs the shader program's vertex texture coordinate attribute location (or -1 if this shader program doesn't have one). Pass NULL if you don't care.
[out]colorLocationOutputs the shader program's vertex color attribute location (or -1 if this shader program doesn't have one). Pass NULL if you don't care.
Returns
false if the shader is NULL, or if it doesn't support the specified primitiveMode.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

Definition at line 767 of file VuoShader.cc.

◆ VuoShader_getExpectedOutputPrimitiveCount()

unsigned int VuoShader_getExpectedOutputPrimitiveCount ( VuoShader  shader,
const VuoMesh_ElementAssemblyMethod  inputPrimitiveMode 
)

Returns the number of primitives the geometry shader is expected to produce per invocation.

Parameters
shaderThe shader to query.
inputPrimitiveModeThe shader program mode to query.

This function may be called from any thread.

Definition at line 460 of file VuoShader.cc.

◆ VuoShader_getFirstImage()

VuoImage VuoShader_getFirstImage ( VuoShader  shader)

Returns the first-added, non-NULL VuoImage uniform value, or NULL if there are no image uniforms.

Definition at line 325 of file VuoShaderUniforms.h.

◆ VuoShader_getInterprocessJson()

struct json_object* VuoShader_getInterprocessJson ( const VuoShader  value)

Calls VuoShader_getJson().

Interprocess support is not yet implemented.

This function may be called from any thread.

Definition at line 1470 of file VuoShader.cc.

◆ VuoShader_getJson()

struct json_object* VuoShader_getJson ( const VuoShader  value)

Encodes value as a JSON object.

Serializes the pointer to the VuoShader object, since we need to preserve its reference count.

This function may be called from any thread.

Definition at line 1455 of file VuoShader.cc.

◆ VuoShader_getMayChangeOutputPrimitiveCount()

bool VuoShader_getMayChangeOutputPrimitiveCount ( VuoShader  shader,
const VuoMesh_ElementAssemblyMethod  inputPrimitiveMode 
)

Returns true if the geometry shader may not output the expected primitive count.

Parameters
shaderThe shader to query.
inputPrimitiveModeThe shader program mode to query.

This function may be called from any thread.

Definition at line 483 of file VuoShader.cc.

◆ VuoShader_getString()

char* VuoShader_getString ( const VuoShader  value)

Automatically generated function.

◆ VuoShader_getSummary()

char* VuoShader_getSummary ( const VuoShader  value)

Returns a summary of the shader: the text description provided to VuoShader_make.

This function may be called from any thread.

Definition at line 1480 of file VuoShader.cc.

◆ VuoShader_getUniform_VuoImage()

VuoImage VuoShader_getUniform_VuoImage ( VuoShader  shader,
const char *  uniformIdentifier 
)

Returns the VuoImage for the specified uniformIdentifier, or NULL if none matches.

Definition at line 304 of file VuoShaderUniforms.h.

◆ VuoShader_isOpaque()

bool VuoShader_isOpaque ( VuoShader  shader)

Returns true if the shader, as configured, will produce fully opaque output.

Returns false if:

  • the shader is explicitly transparent (if isTransparent or useAlphaAsCoverage is set)
  • or the shader has one or more VuoColor uniforms whose alpha is less than 1
  • or the shader has one or more VuoList_VuoColor uniforms having a color whose alpha is less than 1
  • or the shader has a VuoReal uniform named alpha whose value is less than 1
  • or the shader has one or more VuoImage uniforms with an alpha channel (it doesn't actually check whether the image's alpha channel has less-than-1 values in it, since that would be really slow)
Changed in Vuo 2.0.0:
New.

Definition at line 1550 of file VuoShader.cc.

◆ VuoShader_isPopulated()

bool VuoShader_isPopulated ( VuoShader  shader)

Returns true if the shader is anything other than the default (blue/purple gradient checkerboard).

Changed in Vuo 2.0.0:
New.

Definition at line 1613 of file VuoShader.cc.

◆ VuoShader_isTransformFeedback()

bool VuoShader_isTransformFeedback ( VuoShader  shader)

Returns true if each of shader's defined inputPrimitiveModes has a vertex shader (and optionally a geometry shader) but lacks a fragment shader.

This function may be called from any thread.

Definition at line 503 of file VuoShader.cc.

◆ VuoShader_make()

VuoShader VuoShader_make ( const char *  name)

Creates a shader object, which contains multiple GL Program Objects.

Before using this shader, call VuoShader_addSource at least once.

Parameters
nameText describing the shader, displayed in port popovers. Use title case (e.g., Color Shader (Lit), Crop Image Shader, Threshold Shader (Luminance)). The value is copied, so you can free it after this function returns.

This function may be called from any thread.

Definition at line 123 of file VuoShader.cc.

◆ VuoShader_make_VuoColor()

VuoShader VuoShader_make_VuoColor ( VuoColor  color)

Creates an unlit color shader object.

Definition at line 177 of file VuoShader.cc.

◆ VuoShader_make_VuoImage()

VuoShader VuoShader_make_VuoImage ( VuoImage  image)

Creates an unlit image shader.

Definition at line 200 of file VuoShader.cc.

◆ VuoShader_make_VuoShader()

VuoShader VuoShader_make_VuoShader ( VuoShader  shader)

Returns the passed shader (does not make a copy).

Definition at line 189 of file VuoShader.cc.

◆ VuoShader_makeDefaultShader()

VuoShader VuoShader_makeDefaultShader ( void  )

Returns a shared instance of the default (unlit checkerboard) shader.

It's a gradient checkerboard (white in the top-left corner), so you can see the object and get a feel for its texture coordinates.

This function may be called from any thread.

Definition at line 134 of file VuoShaderShaders.h.

◆ VuoShader_makeFromFile()

VuoShader VuoShader_makeFromFile ( VuoShaderFile shaderFile)

Creates a shader object from a VuoShaderFile.

Don't call VuoShader_addSource; the sources are automatically retrieved from the VuoShaderFile.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 160 of file VuoShader.cc.

◆ VuoShader_makeFromJson()

VuoShader VuoShader_makeFromJson ( json_object js)

Decodes the JSON object js, expected to contain a 64-bit integer (memory address or 0), to create a new VuoShader.

This function may be called from any thread.

Definition at line 1435 of file VuoShader.cc.

◆ VuoShader_makeFromString()

VuoShader VuoShader_makeFromString ( const char *  str)

Automatically generated function.

◆ VuoShader_makeFrostedGlassShader()

VuoShader VuoShader_makeFrostedGlassShader ( void  )

Returns a frosted glass shader.

Definition at line 1385 of file VuoShaderShaders.h.

◆ VuoShader_makeGlTextureRectangleAlphaPassthruShader()

VuoShader VuoShader_makeGlTextureRectangleAlphaPassthruShader ( VuoImage  image,
bool  flipped 
)

Returns a shader that renders objects with an image (ignoring lighting).

This shader now handles alpha the same way VuoShader_makeUnlitImageShader does, so the only difference is that this shader also provides flipping.

image must be GL_TEXTURE_RECTANGLE_ARB.

This function may be called from any thread.

Definition at line 343 of file VuoShaderShaders.h.

◆ VuoShader_makeGlTextureRectangleShader()

VuoShader VuoShader_makeGlTextureRectangleShader ( VuoImage  image,
VuoReal  alpha 
)

Returns a shader that renders objects with an image (ignoring lighting).

image must be GL_TEXTURE_RECTANGLE_ARB.

This function may be called from any thread.

Definition at line 302 of file VuoShaderShaders.h.

◆ VuoShader_makeLinearGradientShader()

VuoShader VuoShader_makeLinearGradientShader ( void  )

Returns a linear gradient shader.

This function may be called from any thread.

Definition at line 1180 of file VuoShaderShaders.h.

◆ VuoShader_makeLitColorShader()

VuoShader VuoShader_makeLitColorShader ( VuoColor  diffuseColor,
VuoColor  highlightColor,
VuoReal  shininess 
)

Returns a shader that renders a color with lighting.

Parameters
diffuseColorThe primary material color.
highlightColorThe color of shiny specular highlights. Alpha controls the intensity of the highlights.
shininessA number representing how shiny the material is. 0 = dull; 1 = shiny; numbers in between represent varying amounts of shininess.

This function may be called from any thread.

Definition at line 822 of file VuoShaderShaders.h.

◆ VuoShader_makeLitImageDetailsShader()

VuoShader VuoShader_makeLitImageDetailsShader ( VuoImage  image,
VuoReal  alpha,
VuoImage  specularImage,
VuoImage  normalImage 
)

Returns a shader that renders an image with lighting and surface details.

Parameters
imageThe image which provides the diffuse / primary material color.
alphaThe opacity of the image (0 to 1).
specularImageAn image that specifies the specular color (RGB) and shininess (A).
normalImageAn image that specifies the surface details. The red and green channels respectively define the normal direction along the tangent and bitangent axes (0 = negative; 0.5 = straight; 1 = positive). The blue channel defines the height along the normal axis (0 = low; 1 = high).

This function may be called from any thread.

Definition at line 1050 of file VuoShaderShaders.h.

◆ VuoShader_makeLitImageShader()

VuoShader VuoShader_makeLitImageShader ( VuoImage  image,
VuoReal  alpha,
VuoColor  highlightColor,
VuoReal  shininess 
)

Returns a shader that renders an image with lighting.

Parameters
imageThe image which provides the diffuse / primary material color.
alphaThe opacity of the image (0 to 1).
highlightColorThe color of shiny specular highlights. Alpha controls the intensity of the highlights.
shininessA number representing how shiny the material is. 0 = dull; 1 = shiny; numbers in between represent varying amounts of shininess.

This function may be called from any thread.

Definition at line 975 of file VuoShaderShaders.h.

◆ VuoShader_makeRadialGradientShader()

VuoShader VuoShader_makeRadialGradientShader ( void  )

Returns a radial gradient shader.

This function may be called from any thread.

Definition at line 1322 of file VuoShaderShaders.h.

◆ VuoShader_makeUnlitAlphaPassthruImageShader()

VuoShader VuoShader_makeUnlitAlphaPassthruImageShader ( VuoImage  image,
bool  flipped 
)

Returns a shader that renders objects with an image (ignoring lighting).

This shader now handles alpha the same way VuoShader_makeUnlitImageShader does, so the only difference is that this shader also provides flipping.

image must be GL_TEXTURE_2D.

This function may be called from any thread.

Definition at line 250 of file VuoShaderShaders.h.

◆ VuoShader_makeUnlitCheckmarkShader()

VuoShader VuoShader_makeUnlitCheckmarkShader ( VuoColor  color,
VuoColor  outline,
float  thickness 
)

Returns a shader that renders a solid color checkmark with outline and outline thickness.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 520 of file VuoShaderShaders.h.

◆ VuoShader_makeUnlitCircleShader()

VuoShader VuoShader_makeUnlitCircleShader ( VuoColor  color,
VuoReal  sharpness 
)

Returns a shader that renders a solid color circle.

When sharpness = 1, the circle takes up half the size of the texture coordinates (circumscribing a rectangle from (0.25,0.25) to (0.75,0.75)).

When sharpness = 0, the circle's edge is blurred to take up the entire texture coordinate area.

This function may be called from any thread.

Definition at line 480 of file VuoShaderShaders.h.

◆ VuoShader_makeUnlitColorShader()

VuoShader VuoShader_makeUnlitColorShader ( VuoColor  color)

Returns a shader that renders a solid color.

This function may be called from any thread.

Definition at line 395 of file VuoShaderShaders.h.

◆ VuoShader_makeUnlitImageShader()

VuoShader VuoShader_makeUnlitImageShader ( VuoImage  image,
VuoReal  alpha 
)

Returns a shader that renders objects with an image (ignoring lighting).

image must be GL_TEXTURE_2D.

This function may be called from any thread.

Definition at line 163 of file VuoShaderShaders.h.

◆ VuoShader_makeUnlitRoundedRectangleShader()

VuoShader VuoShader_makeUnlitRoundedRectangleShader ( VuoColor  color,
VuoReal  sharpness,
VuoReal  roundness,
VuoReal  aspect 
)

Returns a shader that renders a solid color rounded rectangle.

When sharpness = 1, the rounded rectangle takes up half the size of the texture coordinates (from (0.25,0.25) to (0.75,0.75)).

When sharpness = 0, the rounded rectangle's edge is blurred to take up the entire texture coordinate area.

aspect specifies the aspect ratio of the rectangle.

This function may be called from any thread.

Definition at line 605 of file VuoShaderShaders.h.

◆ VuoShader_makeUnlitRoundedRectangleTrackShader()

VuoShader VuoShader_makeUnlitRoundedRectangleTrackShader ( VuoColor  backgroundColor,
VuoColor  activeColor,
VuoReal  sharpness,
VuoReal  roundness,
VuoReal  aspect,
VuoBoolean  isHorizontal,
VuoReal  value 
)

Returns a shader that renders a solid color rounded rectangle with a split color based on value.

When sharpness = 1, the rounded rectangle takes up half the size of the texture coordinates (from (0.25,0.25) to (0.75,0.75)).

When sharpness = 0, the rounded rectangle's edge is blurred to take up the entire texture coordinate area.

aspect specifies the aspect ratio of the rectangle.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 707 of file VuoShaderShaders.h.

◆ VuoShader_release()

void VuoShader_release ( VuoShader  value)

Automatically generated function.

◆ VuoShader_resetContext()

void VuoShader_resetContext ( VuoGlContext  glContext)

Disuses whatever shader (if any) is currently active on glContext.

This function may be called from any thread.

Definition at line 1417 of file VuoShader.cc.

◆ VuoShader_retain()

void VuoShader_retain ( VuoShader  value)

Automatically generated function.

◆ VuoShader_samplerCoordinatesFromVuoCoordinates()

VuoPoint2d VuoShader_samplerCoordinatesFromVuoCoordinates ( VuoPoint2d  vuoCoordinates,
VuoImage  image 
)

Converts the provided vuoCoordinates into GLSL Sampler Coordinates relative to the provided image.

Vuo Coordinates range from (-1,-1/aspectRatio) in the bottom left to (1,1/aspectRatio) in the top right.

GLSL Sampler Coordinates range from (0,0) to (1,1).

If image is rendered in a scene, centered at (0,0,0), width 2, at its correct aspect ratio, this function will transform 2D coordinates along the XY plane (at Z=0) into correct sampler coordinates for that image.

This function may be called from any thread.

Definition at line 1500 of file VuoShader.cc.

◆ VuoShader_samplerRectCoordinatesFromNormalizedCoordinates()

VuoPoint2d VuoShader_samplerRectCoordinatesFromNormalizedCoordinates ( VuoPoint2d  c,
VuoInteger  imageWidth,
VuoInteger  imageHeight 
)

Converts the provided normalizedCoordinates into GLSL sampler2DRect coordinates relative to the provided width/height.

GLSL Normalized Sampler Coordinates range from (0,0) in the bottom left to (1,1) in the top right.

GLSL sampler2DRect Coordinates range from (0,0) to (imageWidth,imageHeight).

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 1528 of file VuoShader.cc.

◆ VuoShader_samplerSizeFromVuoSize()

VuoReal VuoShader_samplerSizeFromVuoSize ( VuoReal  vuoSize)

Converts an x-axis distance in Vuo Coordinates into GLSL Sampler Coordinates.

(Divides by 2.)

This function may be called from any thread.

Definition at line 1513 of file VuoShader.cc.

◆ VuoShader_setExpectedOutputPrimitiveCount()

void VuoShader_setExpectedOutputPrimitiveCount ( VuoShader  shader,
const VuoMesh_ElementAssemblyMethod  inputPrimitiveMode,
const unsigned int  expectedOutputPrimitiveCount 
)

Specifies the number of primitives the geometry shader is expected to produce per invocation.

If this function is not called, the shader defaults to expecting 1 primitive.

Call before using VuoShader_getAttributeLocations, VuoShader_activate, and VuoShader_deactivate.

Parameters
shaderThe shader to modify.
inputPrimitiveModeThe shader program mode to modify.
expectedOutputPrimitiveCountThe number of primitives the geometry shader is expected to produce per invocation.

This function may be called from any thread.

Definition at line 399 of file VuoShader.cc.

◆ VuoShader_setFrostedGlassShaderValues()

void VuoShader_setFrostedGlassShaderValues ( VuoShader  shader,
VuoColor  color,
VuoReal  brightness,
VuoPoint2d  noisePosition,
VuoReal  noiseTime,
VuoReal  noiseAmount,
VuoReal  noiseScale,
VuoReal  chromaticAberration,
VuoInteger  levels,
VuoReal  roughness,
VuoReal  spacing,
VuoInteger  iterations,
float  aspectRatio 
)

Sets parameters for the frosted glass shader.

Changed in Vuo 2.0.0:
Added noisePosition and aspectRatio arguments.

Definition at line 1557 of file VuoShaderShaders.h.

◆ VuoShader_setLinearGradientShaderValues()

void VuoShader_setLinearGradientShaderValues ( VuoShader  shader,
VuoList_VuoColor  colors,
VuoPoint2d  start,
VuoPoint2d  end,
VuoReal  aspect,
VuoReal  noiseAmount 
)

Sets parameters for the linear gradient shader using the provided colors and start and end coordinates.

Coordinates should be passed in Vuo scene coordinates (-1,-1) to (1,1).

Definition at line 1308 of file VuoShaderShaders.h.

◆ VuoShader_setMayChangeOutputPrimitiveCount()

void VuoShader_setMayChangeOutputPrimitiveCount ( VuoShader  shader,
const VuoMesh_ElementAssemblyMethod  inputPrimitiveMode,
const bool  mayChangeOutputPrimitiveCount 
)

Specifies whether the geometry shader may dynamically choose to skip outputting some primitives or output additional primitives.

If true, performance is potentially reduced since VuoSceneObjectRenderer will need to wait for the result of a query to determine the actual number of output primitives.

Call before using VuoShader_getAttributeLocations, VuoShader_activate, and VuoShader_deactivate.

Parameters
shaderThe shader to modify.
inputPrimitiveModeThe shader program mode to modify.
mayChangeOutputPrimitiveCountWhether the geometry shader may dynamically choose to skip outputting some primitives or output additional primitives.

This function may be called from any thread.

Definition at line 425 of file VuoShader.cc.

◆ VuoShader_setRadialGradientShaderValues()

void VuoShader_setRadialGradientShaderValues ( VuoShader  shader,
VuoList_VuoColor  colors,
VuoPoint2d  center,
VuoReal  radius,
VuoReal  width,
VuoReal  height,
VuoReal  noiseAmount 
)

Sets parameters for the radial gradient shader using the provided colors, center point, and radius.

Center and radius are expected in Vuo scene coordinates. Width and Height may be either pixels or scene coordinates, as they are only used to calculate the aspect ratio.

Definition at line 1370 of file VuoShaderShaders.h.

◆ VuoShader_setTransparent()

void VuoShader_setTransparent ( VuoShader  shader,
const bool  isTransparent 
)

See VuoShader::isTransparent.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 444 of file VuoShader.cc.

◆ VuoShader_setUniform_mat2()

void VuoShader_setUniform_mat2 ( VuoShader  shader,
const char *  uniformIdentifier,
float *  mat2 
)

Sets a mat2 (column-major 2x2 matrix) uniform value on the specified shader.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 273 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_mat3()

void VuoShader_setUniform_mat3 ( VuoShader  shader,
const char *  uniformIdentifier,
float *  mat3 
)

Sets a mat3 (column-major 3x3 matrix) uniform value on the specified shader.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 284 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_mat4()

void VuoShader_setUniform_mat4 ( VuoShader  shader,
const char *  uniformIdentifier,
float *  mat4 
)

Sets a mat4 (column-major 4x4 matrix) uniform value on the specified shader.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 295 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoBoolean()

void VuoShader_setUniform_VuoBoolean ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoBoolean  boolean 
)

Sets a bool uniform value on the specified shader.

This function may be called from any thread.

Definition at line 113 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoColor()

void VuoShader_setUniform_VuoColor ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoColor  colorUnpremultiplied 
)

Sets a color uniform value on the specified shader accepting a VuoColor.

color should be a normal un-premultiplied VuoColor; this function premultiplies its colors before passing it to the shader.

This function may be called from any thread.

Definition at line 176 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoImage()

void VuoShader_setUniform_VuoImage ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoImage  image 
)

Sets a VuoImage input value on the specified shader.

This function may be called from any thread.

Definition at line 103 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoInteger()

void VuoShader_setUniform_VuoInteger ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoInteger  integer 
)

Sets an int uniform value on the specified shader.

This function may be called from any thread.

Definition at line 123 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoList_VuoBoolean()

void VuoShader_setUniform_VuoList_VuoBoolean ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoList_VuoBoolean  booleans 
)

Sets a list of bool uniform values on the specified shader.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 188 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoList_VuoColor()

void VuoShader_setUniform_VuoList_VuoColor ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoList_VuoColor  colorsP 
)

Sets a list of color uniform values on the specified shader's uniform uniformIdentifier of type vec4.

colors should be a list of normal un-premultiplied VuoColors; this function premultiplies each color before passing it to the shader.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 257 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoList_VuoInteger()

void VuoShader_setUniform_VuoList_VuoInteger ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoList_VuoInteger  integers 
)

Sets a list of int uniform values on the specified shader.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 199 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoList_VuoPoint2d()

void VuoShader_setUniform_VuoList_VuoPoint2d ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoList_VuoPoint2d  point2ds 
)

Sets a list of vec2 uniform values on the specified shader.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 221 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoList_VuoPoint3d()

void VuoShader_setUniform_VuoList_VuoPoint3d ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoList_VuoPoint3d  point3ds 
)

Sets a list of vec3 uniform values on the specified shader.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 232 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoList_VuoPoint4d()

void VuoShader_setUniform_VuoList_VuoPoint4d ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoList_VuoPoint4d  point4ds 
)

Sets a list of vec4 uniform values on the specified shader.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 243 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoList_VuoReal()

void VuoShader_setUniform_VuoList_VuoReal ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoList_VuoReal  reals 
)

Sets a list of float uniform values on the specified shader.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 210 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoPoint2d()

void VuoShader_setUniform_VuoPoint2d ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoPoint2d  point2d 
)

Sets a vec2 uniform value on the specified shader.

This function may be called from any thread.

Definition at line 143 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoPoint3d()

void VuoShader_setUniform_VuoPoint3d ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoPoint3d  point3d 
)

Sets a vec3 uniform value on the specified shader.

This function may be called from any thread.

Definition at line 153 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoPoint4d()

void VuoShader_setUniform_VuoPoint4d ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoPoint4d  point4d 
)

Sets a vec4 uniform value on the specified shader.

This function may be called from any thread.

Definition at line 163 of file VuoShaderUniforms.h.

◆ VuoShader_setUniform_VuoReal()

void VuoShader_setUniform_VuoReal ( VuoShader  shader,
const char *  uniformIdentifier,
const VuoReal  real 
)

Sets a float uniform value on the specified shader.

This function may be called from any thread.

Definition at line 133 of file VuoShaderUniforms.h.

◆ VuoShader_upload()

bool VuoShader_upload ( VuoShader  shader,
const VuoMesh_ElementAssemblyMethod  inputPrimitiveMode,
VuoGlContext  glContext,
void *  outIssues 
)

Compiles and uploads the shader, outputting any issues in a VuoShaderIssues instance.

This is optional; the shader will automatically be compiled and uploaded when needed. It's only necessary if you want to get the compilation warnings/errors.

Returns
false if the shader is NULL, or if it doesn't support the specified primitiveMode, or if the shader fails to compile or link.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

Changed in Vuo 2.0.0:
New.

Definition at line 735 of file VuoShader.cc.