controlP5 viewport
in
Contributed Library Questions
•
2 years ago
Hello,
I want to display in the same window buttons and viewport.
How can I do? The code below contains the problem.
Why the button is displayed 2 times ?
How can I do? The code below contains the problem.
Why the button is displayed 2 times ?
Thanks
import controlP5.*;
import processing.opengl.*;
import javax.media.opengl.*;
ControlP5 controlP5;
import processing.opengl.*;
import javax.media.opengl.*;
ControlP5 controlP5;
GL _gl;
void setup() {
size(800,400,OPENGL);
smooth();
controlP5 = new ControlP5(this);
controlP5.addButton("buttonA",0,100,100,80,19);
}
void draw() {
background(0);
background(0);
_gl = ((PGraphicsOpenGL)g).beginGL();
_gl.glViewport (0, 0, 800, 400);
((PGraphicsOpenGL)g).endGL();
pushMatrix();
controlP5.draw();
popMatrix();
((PGraphicsOpenGL)g).endGL();
_gl = ((PGraphicsOpenGL)g).beginGL();
_gl.glViewport (400, 0, 800, 400);
((PGraphicsOpenGL)g).endGL();
((PGraphicsOpenGL)g).endGL();
}
public void controlEvent(ControlEvent theEvent) {
println(theEvent.controller().name());
}
println(theEvent.controller().name());
}
// function buttonA will receive changes from
// controller with name buttonA
public void buttonA(int theValue) {
}
// controller with name buttonA
public void buttonA(int theValue) {
}
1