Vuo
1.0.1
|
VuoShader implementation.
Macros | |
#define | DEFINE_PROGRAM() |
Defines a program variable and initializes it with the relevant program based on inputPrimitiveMode . | |
Functions | |
void | VuoShader_free (void *shader) |
Frees the CPU memory and GPU objects associated with the shader. | |
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. | |
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_isTransformFeedback (VuoShader shader) |
Returns true if each of shader 's defined inputPrimitiveMode s has a vertex shader (and optionally a geometry shader) but lacks a fragment shader. | |
bool | VuoShader_ensureUploaded (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext) |
Ensures that the source code for the specified inputPrimitiveMode is compiled, linked, and uploaded. | |
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. | |
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 . | |
json_object * | VuoShader_getJson (const VuoShader value) |
Encodes value as a JSON object. | |
char * | VuoShader_getSummary (const VuoShader value) |
Returns a summary of the shader: the text description provided to VuoShader_make. | |
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. | |
#define DEFINE_PROGRAM | ( | ) |
Defines a program
variable and initializes it with the relevant program based on inputPrimitiveMode
.
bool VuoShader_ensureUploaded | ( | VuoShader | shader, |
const VuoMesh_ElementAssemblyMethod | inputPrimitiveMode, | ||
VuoGlContext | glContext | ||
) |
Ensures that the source code for the specified inputPrimitiveMode
is compiled, linked, and uploaded.
If there is no source code for the specified inputPrimitiveMode
, or it fails to compile or link, returns false
.
Must be called while shader->lock
is locked.
void VuoShader_free | ( | void * | shader | ) |
Frees the CPU memory and GPU objects associated with the shader.
This function may be called from any thread.