Second Window for Drawing/Controls - GLGraphics not working
in
Contributed Library Questions
•
2 years ago
I am looking for a good way to draw to a second window. I actually have a similar problem as described in this post :
http://forum.processing.org/topic/second-monitor-window-and-optimizing-performance#25080000000382015
i have a control window, and need a second screen to render the drawings.
They mentioned a way to use the GLGraphics library but i have two problems using this approach.
first is that it seems like the library or at least parts of it are not working since processing 1.1. the latest version i can make it work with was 1.0.3.
but when running it in an older version, it seems to update only every 2-3 seconds although i get 60 fps and more.
does anybody have another good idea for this task?
i attach the mentioned code :
http://forum.processing.org/topic/second-monitor-window-and-optimizing-performance#25080000000382015
i have a control window, and need a second screen to render the drawings.
They mentioned a way to use the GLGraphics library but i have two problems using this approach.
first is that it seems like the library or at least parts of it are not working since processing 1.1. the latest version i can make it work with was 1.0.3.
but when running it in an older version, it seems to update only every 2-3 seconds although i get 60 fps and more.
does anybody have another good idea for this task?
i attach the mentioned code :
- import processing.opengl.*;
import codeanticode.glgraphics.*;
GLGraphicsOffScreen winGraphics; // the graphics object for the second window...
GLTextureWindow win;
void setup(){
size(600, 600, GLConstants.GLGRAPHICS);
win = new GLTextureWindow( this, 100, 100, 400, 400 ); // 400x400 big at location 100,100
winGraphics = new GLGraphicsOffScreen( this, 400, 400 );
win.setTexture( winGraphics.getTexture() );
}
void draw(){
// do rendering of first screen just like you would normally
println(frameRate);
winGraphics.beginDraw();
// do all your drawing for the second window here
winGraphics.background ( 0 );
winGraphics.stroke( 255 );
winGraphics.line( random(width),random(height),random(width),random(height) );
winGraphics.endDraw();
}
1