Vuo  1.0.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Typedefs
VuoShader.h File Reference

Description

VuoShader C type definition.

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...
 
struct  _VuoShader
 A graphics shader program, specifying how to render a 3D object. More...
 
union  VuoShaderUniform.value
 

Typedefs

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

Functions

Creating standard shaders
VuoShader VuoShader_makeDefaultShader (void)
 Returns a shared instance of the default (unlit checkerboard) shader.
 
VuoShader VuoShader_makeUnlitImageShader (VuoImage image, VuoReal alpha)
 Returns a shader that renders objects with an image (ignoring lighting).
 
VuoShader VuoShader_makeUnlitAlphaPassthruImageShader (VuoImage image)
 Returns a shader that renders objects with an image (ignoring lighting).
 
VuoShader VuoShader_makeGlTextureRectangleShader (VuoImage image, VuoReal alpha)
 Returns a shader that renders objects with an image (ignoring lighting).
 
VuoShader VuoShader_makeGlTextureRectangleAlphaPassthruShader (VuoImage image)
 Returns a shader that renders objects with an image (ignoring lighting).
 
VuoShader VuoShader_makeUnlitColorShader (VuoColor color)
 Returns a shader that renders a solid color.
 
VuoShader VuoShader_makeUnlitCircleShader (VuoColor color, VuoReal sharpness)
 Returns a shader that renders a solid color circle.
 
VuoShader VuoShader_makeUnlitRoundedRectangleShader (VuoColor color, VuoReal sharpness, VuoReal roundness, VuoReal aspect)
 Returns a shader that renders a solid color rounded rectangle.
 
VuoShader VuoShader_makeLitColorShader (VuoColor diffuseColor, VuoColor highlightColor, VuoReal shininess)
 Returns a shader that renders a color with lighting.
 
VuoShader VuoShader_makeLitImageShader (VuoImage image, VuoReal alpha, VuoColor highlightColor, VuoReal shininess)
 Returns a shader that renders an image with lighting.
 
VuoShader VuoShader_makeLitImageDetailsShader (VuoImage image, VuoReal alpha, VuoImage specularImage, VuoImage normalImage)
 Returns a shader that renders an image with lighting and surface details.
 
VuoShader VuoShader_makeLinearGradientShader (VuoList_VuoColor colors, VuoPoint2d start, VuoPoint2d end)
 Returns a shader that renders a linear gradient using the provided colors and start and end coordinates.
 
VuoShader VuoShader_makeRadialGradientShader (VuoList_VuoColor colors, VuoPoint2d center, VuoReal radius, VuoReal width, VuoReal height)
 Returns a shader that renders a radial gradient using the provided colors, center point, and radius.
 
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.
 
unsigned int VuoShader_getExpectedOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode)
 Returns the number of primitives the geometry shader is expected to produce per invocation.
 
bool VuoShader_getAttributeLocations (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext, int *positionLocation, int *normalLocation, int *tangentLocation, int *bitangentLocation, int *textureCoordinateLocation)
 Outputs the shader program's vertex attribute locations (the same values as glGetAttribLocation()).
 
unsigned int VuoShader_activate (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext)
 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.
 
void VuoShader_deactivate (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext)
 Deactivates the shader program on the specified glContext, and unbinds the shader's images from their texture units.
 
void VuoShader_setUniform_VuoImage (VuoShader shader, const char *uniformIdentifier, const VuoImage image)
 Sets a VuoImage input value on the specified shader.
 
void VuoShader_setUniform_VuoBoolean (VuoShader shader, const char *uniformIdentifier, const VuoBoolean boolean)
 Sets a bool uniform value on the specified shader.
 
void VuoShader_setUniform_VuoInteger (VuoShader shader, const char *uniformIdentifier, const VuoInteger integer)
 Sets an int uniform value on the specified shader.
 
void VuoShader_setUniform_VuoReal (VuoShader shader, const char *uniformIdentifier, const VuoReal real)
 Sets a float uniform value on the specified shader.
 
void VuoShader_setUniform_VuoPoint2d (VuoShader shader, const char *uniformIdentifier, const VuoPoint2d point2d)
 Sets a vec2 uniform value on the specified shader.
 
void VuoShader_setUniform_VuoPoint3d (VuoShader shader, const char *uniformIdentifier, const VuoPoint3d point3d)
 Sets a vec3 uniform value on the specified shader.
 
void VuoShader_setUniform_VuoPoint4d (VuoShader shader, const char *uniformIdentifier, const VuoPoint4d point4d)
 Sets a vec4 uniform value on the specified shader.
 
void VuoShader_setUniform_VuoColor (VuoShader shader, const char *uniformIdentifier, const VuoColor color)
 Sets a color uniform value on the specified shader accepting a VuoColor.
 
VuoImage VuoShader_getUniform_VuoImage (VuoShader shader, const char *uniformIdentifier)
 Returns the VuoImage for the specified uniformIdentifier, or NULL if none matches.
 
VuoPoint2d VuoShader_samplerCoordinatesFromVuoCoordinates (VuoPoint2d vuoCoordinates, VuoImage image)
 Converts the provided vuoCoordinates into GLSL Sampler Coordinates relative to the provided image.
 
VuoReal VuoShader_samplerSizeFromVuoSize (VuoReal vuoSize)
 Converts an x-axis distance in Vuo Coordinates into GLSL Sampler Coordinates.
 
Summary, serialization, and reference counting
char * VuoShader_getSummary (const VuoShader value)
 Returns a summary of the shader: the text description provided to VuoShader_make.
 
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.
 
struct json_object * VuoShader_getJson (const VuoShader value)
 Encodes value as a JSON object.
 
VuoShader VuoShader_makeFromString (const char *str)
 Automatically generated function.
 
char * VuoShader_getString (const VuoShader value)
 Automatically generated function.
 
void VuoShader_retain (VuoShader value)
 Automatically generated function.
 
void VuoShader_release (VuoShader value)
 Automatically generated function.
 

Creating shaders from GLSL source code

#define VUOSHADER_GLSL_SOURCE(version, source)   "#version " #version "\n" #source
 A macro to facilitate defining a GLSL shader in a C source file.
 
VuoShader VuoShader_make (const char *name)
 Creates a shader object, which contains multiple GL Program Objects.
 
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.
 
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.