Trouble setting uniforms for PShaders used by secondary renderers

edited February 2018 in GLSL / Shaders

I'm trying to do some low-level OpenGL rendering onto a separate PGraphics buffer for a library I'm rewriting, and I've run into an issue where I can get my geometry to render on the separate PGraphics buffer, and if I bind a PShader, it will work, but I can't set any uniforms on the PShader, since it appears that the PShader.set() is only capable of acting on the main window's PGL instance. Is that accurate? Is there a workaround other than to just run the uniform setting calls directly from the separate PGraphics' PGL?

  1. create a PGraphics offscreenBuffer, and run offscreenBuffer.beginDraw();
  2. Set up a PGL context, PGL pgl = offscreenBuffer.beginPGL();
  3. Create and bind a PShader
  4. Do all my OpenGL stuff on offscreenBuffer's PGL
  5. Try and set a uniform on my shader with myShader.set("greenChannel", 0.5f);
  6. Shader runs, but output on the offscreenBuffer PGL thinks that the uniform's value is 0


  • @Chatham sorry no complete Answer. Try to search in this forum, the answer is somewhere out their. : )

    1. "myShader.set("greenChannel", 0.5f);" should be offscreenBuffer.myShader.set ... when i recall right. and then write that shader to an image in the "main" window.


Sign In or Register to comment.