PShader

Swap DanaProcessing's built-in Blinn-Phong shader for a custom GLSL program, applied to every subsequent Box()/Sphere()/custom-mesh draw. One program replaces the whole 3D pipeline at once — there's no per-PShaderFlag slot (POINTS/LINES/etc.) like real Processing.

3D renderer

On this page · 2 entries

LoadShader

  • LoadShader(string fragFilename)
  • LoadShader(fragFilename, vertFilename) → PShader

The single-argument overload reads a fragment shader from disk and reuses DanaProcessing's own built-in vertex shader. The two-argument overload reads both — note the parameter order matches Processing's own (fragment path first, then vertex) even though it reads backwards. Neither touches the GPU until the result is passed to Shader(); compilation happens lazily, the first time it's actually used with a given 3D context.

Fixed attribute layout. A custom vertex shader must declare layout(location = 0) in vec3 aPos;, layout(location = 1) in vec3 aNormal;, and (for texture support) layout(location = 2) in vec2 aUV; — the same layout Box()/Sphere()/custom meshes upload. A fragment shader that wants to sample a texture set via Texture() should declare uniform sampler2D uTexture; and uniform int uHasTexture; and check the flag — DanaProcessing sets both automatically per draw call.

Shader · ResetShader

  • Shader(PShader shader)
  • ResetShader()

Shader() activates a custom shader for subsequent draws, staying active across frames until ResetShader() or another Shader() call. ResetShader() reverts to the built-in pipeline.