In Processing 1.5 I can do something like this:
- void draw() {
- gl = ((PGraphicsOpenGL) g).gl;
- gl.glEnable(gl.GL_SCISSOR_TEST);
- gl.glEnable(gl.GL_BLEND);
- //Render left viewport
- gl.glViewport(0,0,width/2,height);
- gl.glScissor(0,0,width/2,height);
- gl.glClearColor(0.0,1.0,0.0,0.5);
- gl.glClear(gl.GL_COLOR_BUFFER_BIT);
- render1(gl); //set projection + modelview + draw
- //Render right viewport
- gl.glViewport(width/2,0,width/2,height);
- gl.glScissor(width/2,0,width/2,height);
- gl.glClearColor(0.0,0.0,1.0,0.5);
- gl.glClear(gl.GL_COLOR_BUFFER_BIT);
- render2(gl); //set projection + modelview + draw
- }
And it draws my two viewports and scissors correctly. But in the 2.0 betas (I tried b7 and the snapshot from github, the above code (using the GL2 via PGL class) to draw multiple viewports is super weird. It seems to overlay the orignal viewport onto the second one. Anyhow, using a single viewport works fine. But the use of a second viewport causes problems.
Any ideas on how to correctly set up multiple viewports for new versions of Processing?