PrOGL
processing open-gl interface
Loading...
Searching...
No Matches
PrOGL

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.

void setup() {
size(100, 100, P2D);
r = new Renderer("frag.glsl", width, height);
}
void draw() {
r.render();
}
Renderer r
global renderer object that renders to the entire size of the screen
Definition PrOGL.pde:7
void setup()
setup is in charge of creating the window and initializing a Renderer object, along with any uniforms...
Definition PrOGL.pde:13
void draw()
draw continuously calls render every frame, updating uniform values and progressing the shader.
Definition PrOGL.pde:30
PrOGL renderer.
Definition Renderer.pde:10
void render()
renders the shader and then draws it to the surface.
Definition Renderer.pde:72

uniforms

declare additional uniforms as follows

static uniforms

static uniforms are unchanging external data values that must be accessed by the shader script.

Uniform tex = new Uniform(
"tex", // uniform variable name
new Texture("texture.jpg"), // data value
uniform_type.TEXTURE // data type
);
// pass the additional uniform with an overloaded constructor
r = new Renderer("frag.glsl", width, height, tex);
the Texture class serves a wrapper for a PImage and image path.
Definition Texture.pde:9
organizes information for a single Uniform, including its underlying data type and update behavior.
Definition Uniform.pde:27
interface to store lambda expression.
Definition Uniform.pde:10
TEXTURE
2D texture
Definition Uniform.pde:17

dynamic uniforms

dynamic uniforms are data values that must be updated every frame to a new value.

Function<Int, Int> incriment_function = t -> t++;
Uniform u = new Uniform(
"inc", // uniform name (incriment variable)
0, // starting value
uniform_type.INT, // data type
incriment_function // self updating function
);
// constructor also takes array lists of uniforms
Uniform[] u_array = new Uniform[]{ tex, u };
ArrayList<Uniform> us = new ArrayList<Uniform>(Arrays.asList(u_array));
r = new Renderer("frag.glsl", width, height, us);
INT
integer
Definition Uniform.pde:11