Hi Jonsku,
I'm trying to get your code to work and understand some reasoning behind it. I'm using the current git processing code.
Why do you call
- PGL pgl = ((PGraphicsOpenGL) g).beginPGL();
- gl = pgl.gl.getGL().getGL2();
every draw? And why are you setting the viewport every draw?
Also I really don't understand this idea of pushing and popping framebuffers. This may be more of a processing specific implementation thing, but do you have any insight?
I am trying to use your code to follow a workflow as follows. I renamed your class to FBOGraphics for my test:
public void setup() {
[setup gl context, create fbo]
((FBOGraphics) g).pushFramebuffer();
gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, myFBO); // Bind our frame buffer
fill(255, 255, 255);
rect(100, 100, 200, 500);
((FBOGraphics) g).popFramebuffer();
}
public void draw() {
background(0);
// why the repeat? If I don't use we crash
PGL pgl = ((PGraphicsOpenGL) g).beginPGL();
gl = pgl.gl.getGL().getGL2();
gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0);
((PGraphicsOpenGL) g).drawTexture(GL.GL_TEXTURE_2D, fboTexture, width, height, 0, 0, width, height);
}
And it does nothing (which is the same I was seeing with your full code). Any ideas?
Thanks