GLGraphics - can use PGraphics only once with GLTextureWindow
in
Contributed Library Questions
•
2 years ago
I am still working with the same code and encountered a little problem when using PGraphics.
I want to draw the PGraphics in the GLTextureWindow as well as in the main Window, but it looks like i can use it only once. it works in both, but as soon as i call image(pg,0,0) twice, one of them doesnt update.
Any ideas why?
oh and another question that might help me in another case. is it possible to get the mousecoordinates of the TextureWindow? Couldnt find anything in the reference.
I want to draw the PGraphics in the GLTextureWindow as well as in the main Window, but it looks like i can use it only once. it works in both, but as soon as i call image(pg,0,0) twice, one of them doesnt update.
Any ideas why?
oh and another question that might help me in another case. is it possible to get the mousecoordinates of the TextureWindow? Couldnt find anything in the reference.
- import processing.opengl.*;
- import codeanticode.glgraphics.*;
- PGraphics pg;
- GLGraphicsOffScreen winGraphics; // the graphics object for the second window...
- GLTextureWindow win;
- void setup() {
- size(600, 600, GLConstants.GLGRAPHICS);
- pg = createGraphics(200, 180, P3D);
- 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() {
- pg.beginDraw();
- pg.background(102);
- pg.stroke(255);
- pg.line(40, 40, mouseX, mouseY);
- pg.endDraw();
- //image(pg, 10, 10);
- winGraphics.beginDraw();
- winGraphics.image(pg, 10, 10);
- winGraphics.endDraw();
- }
1