Processing Open-GL
PrOGL is an object oriented OpenGL rendering interface that provides utilities for
- compiling shaders
- managing uniform binding and updating
- drawing multiple shaders to the screen at once
full documentation can be found here
usage
clone and run as a sketch with Processing.
example
running a fragment shader that requires no custom uniforms. time, resolution, and mouse are default uniforms.
size(100, 100, P2D);
r =
new Renderer(
"frag.glsl", width, height);
}
}
Renderer r
global renderer object that renders to the entire size of the screen
void setup()
setup is in charge of creating the window and initializing a Renderer object, along with any uniforms...
void draw()
draw continuously calls render every frame, updating uniform values and progressing the shader.
void render()
renders the shader and then draws it to the surface.
uniforms
declare additional uniforms as follows
static uniforms
static uniforms are unchanging external data values that must be accessed by the shader script.
"tex",
);
r =
new Renderer(
"frag.glsl", width, height, tex);
the Texture class serves a wrapper for a PImage and image path.
dynamic uniforms
dynamic uniforms are data values that must be updated every frame to a new value.
Function<Int, Int> incriment_function = t -> t++;
"inc",
0,
incriment_function
);
ArrayList<Uniform> us = new ArrayList<Uniform>(Arrays.asList(u_array));
r =
new Renderer(
"frag.glsl", width, height, us);