Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

glViewport is acting strange on latest version of processing 2b7 and version in repo

$
0
0
In Processing 1.5 I can do something like this:

  1. void draw() {
  2.   
  3.       gl = ((PGraphicsOpenGL) g).gl; 

  4.       gl.glEnable(gl.GL_SCISSOR_TEST);
  5.       gl.glEnable(gl.GL_BLEND);

  6.       //Render left viewport
  7.       gl.glViewport(0,0,width/2,height);
  8.       gl.glScissor(0,0,width/2,height);
  9.       gl.glClearColor(0.0,1.0,0.0,0.5);
  10.       gl.glClear(gl.GL_COLOR_BUFFER_BIT);

  11.       render1(gl); //set projection + modelview + draw
  12.      
  13.       //Render right viewport    
  14.       gl.glViewport(width/2,0,width/2,height);
  15.       gl.glScissor(width/2,0,width/2,height);
  16.       gl.glClearColor(0.0,0.0,1.0,0.5);
  17.       gl.glClear(gl.GL_COLOR_BUFFER_BIT);

  18.       render2(gl); //set projection + modelview + draw 
  19. }

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?


Viewing all articles
Browse latest Browse all 1768

Trending Articles