PrOGL
processing open-gl interface
Loading...
Searching...
No Matches
Shader Class Reference

Shader object organizes a list of uniforms and a compiled PShader. More...

Collaboration diagram for Shader:

Package Functions

 Shader (String path, int w, int h)
 Shader Constructor without Uniforms.
 
 Shader (String path, int w, int h, Uniform u)
 Shader Constructor with Uniform.
 
 Shader (String path, int w, int h, ArrayList< Uniform > u)
 Shader Constructor with Uniforms.
 
void make_default_uniforms ()
 this creates three common uniforms as defaults.
 
void add_uniforms (ArrayList< Uniform > custom_uniforms)
 add a list of custom defined uniforms.
 
void add_uniform (Uniform custom_uniform)
 add a single uniform.
 
void set_uniforms ()
 set uniforms in shader.
 
void update_uniforms ()
 update uniforms with an update function.
 
void print ()
 print function for debugging.
 

Package Attributes

PShader program
 OpenGL program binding.
 
shader_type type
 Shader type (vertex or fragment)
 
ArrayList< Uniformuniforms = new ArrayList<Uniform>()
 Uniform data.
 
int w
 < width
 
int h
 < height
 

Detailed Description

Shader object organizes a list of uniforms and a compiled PShader.

Definition at line 21 of file Shader.pde.

Constructor & Destructor Documentation

◆ Shader() [1/3]

Shader.Shader ( String  path,
int  w,
int  h 
)
package

Shader Constructor without Uniforms.

loads the shader code and sets default uniforms.

Parameters
pathrelative path to shader text file
wwidth of shader
hheight of shader
Returns
a Shader object

Definition at line 36 of file Shader.pde.

References h, make_default_uniforms(), program, set_uniforms(), and w.

Here is the call graph for this function:

◆ Shader() [2/3]

Shader.Shader ( String  path,
int  w,
int  h,
Uniform  u 
)
package

Shader Constructor with Uniform.

loads the shader code and sets default and one user supplied uniforms.

Parameters
pathrelative path to shader text file
wwidth of shader
hheight of shader
uUniform object to add to list
Returns
a Shader object

Definition at line 52 of file Shader.pde.

References add_uniform(), h, make_default_uniforms(), program, set_uniforms(), and w.

Here is the call graph for this function:

◆ Shader() [3/3]

Shader.Shader ( String  path,
int  w,
int  h,
ArrayList< Uniform u 
)
package

Shader Constructor with Uniforms.

loads the shader code and sets default and additional uniforms.

Parameters
pathrelative path to shader text file
wwidth of shader
hheight of shader
uan ArrayList of Uniform objects to add to the shader
Returns
a Shader object

Definition at line 69 of file Shader.pde.

References add_uniforms(), h, make_default_uniforms(), program, set_uniforms(), and w.

Here is the call graph for this function:

Member Function Documentation

◆ add_uniform()

void Shader.add_uniform ( Uniform  custom_uniform)
package

add a single uniform.

Definition at line 126 of file Shader.pde.

References uniforms.

◆ add_uniforms()

void Shader.add_uniforms ( ArrayList< Uniform custom_uniforms)
package

add a list of custom defined uniforms.

Definition at line 121 of file Shader.pde.

References uniforms.

◆ make_default_uniforms()

void Shader.make_default_uniforms ( )
package

this creates three common uniforms as defaults.

they are time (updating float), resolution (vec2), and mouse (vec3).

Definition at line 82 of file Shader.pde.

References uniform_type.FLOAT, h, uniforms, uniform_type.VEC2, uniform_type.VEC3, and w.

◆ print()

void Shader.print ( )
package

print function for debugging.

Definition at line 148 of file Shader.pde.

References h, program, type, uniforms, and w.

◆ set_uniforms()

void Shader.set_uniforms ( )
package

set uniforms in shader.

Definition at line 131 of file Shader.pde.

References program, and uniforms.

◆ update_uniforms()

void Shader.update_uniforms ( )
package

update uniforms with an update function.

Definition at line 138 of file Shader.pde.

References program, and uniforms.

Member Data Documentation

◆ h

int Shader.h
package

< height

Definition at line 26 of file Shader.pde.

◆ program

PShader Shader.program
package

OpenGL program binding.

Definition at line 22 of file Shader.pde.

◆ type

shader_type Shader.type
package

Shader type (vertex or fragment)

Definition at line 23 of file Shader.pde.

◆ uniforms

ArrayList<Uniform> Shader.uniforms = new ArrayList<Uniform>()
package

Uniform data.

Definition at line 24 of file Shader.pde.

◆ w

int Shader.w
package

< width

Definition at line 25 of file Shader.pde.


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