glScissor

I want to use glScissor, which works fine. But how can I end glScissor? If i use gl.glDisable(GL.GL_SCISSOR_TEST); then the scissor gets disabled for the whole draw frame.

import processing.opengl.*;
import com.jogamp.opengl.*; 

GL gl;

void setup() {
  size(500, 500, P2D);
}


void draw() {
  background(255);

  if (gl == null) {
    gl = ((PJOGL)beginPGL()).gl.getGL();
  }  

  gl.glEnable(GL.GL_SCISSOR_TEST);
  gl.glScissor(mouseX-50, height-mouseY-50, 100, 100);

  stroke(255, 0, 0);
  for (int i = -width; i < width; i += 5) {
    line(i*5, 0, width + i*5, height);  
  }

  // how to draw what we currently have?
  //gl.glDisable(GL.GL_SCISSOR_TEST);
  fill(255,0,0);
  rect(0, height/2, width, 10); 


}

Answers

Sign In or Register to comment.