change frame size while using opengl glgraphics off screen buffer
in
Contributed Library Questions
•
3 years ago
Hi List,
I would like to resize my sketch window dynamically using an osc message. I had it working fine until I added shaders and an opengl off screen buffer. Here is my code:
- void winSize(int w, int h) {
- frame.setResizable(true);
- frame.setSize(w, h);
- //OPENGL STUFF
- destTex.width = w;
- destTex.height = h;
- bloomMask.width = w;
- bloomMask.height = h;
- tex0.width = w;
- tex0.height = h;
- tex2.width = w/2;
- tex2.height = h/2;
- tmp2.width = w/2;
- tmp2.height = h/2;
- tex4.width = w/4;
- tex4.height = h/4;
- tmp4.width = w/4;
- tmp4.height = h/4;
- tex8.width = w/8;
- tex8.height = h/8;
- tmp8.width = w/8;
- tmp8.height = h/8;
- tex16.width = w/16;
- tex16.height = h/16;
- tmp16.width = w/16;
- tmp16.height = h/16;
- pgl.setSize(w, h);
- offscreen.setSize(w, h);
- pgl = (GLGraphics) g;
- gl = offscreen.gl;
- canvasWG = w;
- canvasHG = h;
- }
I get two different errors, sometimes one and sometimes the other, not sure why this is either:
1)
Frame buffer is incomplete (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT)
2)
Exception in thread "Animation Thread" javax.media.opengl.GLException: Attempt to make context current on thread Thread[Animation Thread,5,main] which is already current on thread Thread[Thread-2,5,main]
at com.sun.opengl.impl.GLContextLock.lock(GLContextLock.java:68)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:131)
at processing.opengl.PGraphicsOpenGL.detainContext(PGraphicsOpenGL.java:230)
at processing.opengl.PGraphicsOpenGL.beginDraw(PGraphicsOpenGL.java:275)
at codeanticode.glgraphics.GLGraphics.beginDraw(GLGraphics.java:208)
at processing.core.PApplet.handleDraw(PApplet.java:1573)
at processing.core.PApplet.run(PApplet.java:1503)
at java.lang.Thread.run(Thread.java:637)
Thanks for any help,
Justin
1