hello oaragones,
you want to create something like tabbowser??
maybe i can help you. :-)
when you change the component of Frame with opengl, the rendering context and all the texture should be updated.
but so far, processing doesn't have this function, so you should make library to help it.
Code:
package processing.opengl;
import processing.core.PApplet;
public class GLContextReallocater {
public static void reallocate( PApplet p5){
if( p5.g.getClass().getName().equals( "processing.opengl.PGraphicsOpenGL" ) ){
((PGraphicsOpenGL)p5.g).context.release();
((PGraphicsOpenGL)p5.g).context.destroy();
((PGraphicsOpenGL)p5.g).context = null;
((PGraphicsOpenGL)p5.g).allocate();
}
}
}
Code:
package processing.core;
import processing.opengl.PGraphicsOpenGL;
public class GLTextureUpdater{
public static void update( PApplet p5 ){
if( p5.g.getClass().getName().equals( "processing.opengl.PGraphicsOpenGL" ) ){
PGraphicsOpenGL g = (PGraphicsOpenGL) p5.g;
PImage[] textures = g.textures;
for( int i = 0; i < textures.length; i++ ){
if( textures[i] != null ){
textures[i].updatePixels();
}
}
}
}
}
to use them, you simply call them.
GLContextReallocater.reallocate(p5);
GLTextureUpdater.update(p5);
you can download the library from below:
http://sadmb.com/archive/glupdater.zip
oaragones wrote on Feb 28th, 2009, 6:20pm:Hi
I'm working with processing and opengl... but i have a problem with the Panel & Frames...
I have this code:
public class Browser {
private WebBrowser webBrowser;
private Panel panel;
private String url;
public Browser(PApplet p) {
Component tmpComp = p.frame.getComponent(p.frame.getComponentCount() - 1);
p.frame.remove(p.frame.getComponentCount() - 1);
p.frame.setLayout(new FlowLayout());
BrowserEngineManager mng = BrowserEngineManager.instance();
mng.setActiveEngine(BrowserEngineManager.IE);
webBrowser = new WebBrowser();
webBrowser.setSize(400, 300);
webBrowser.setLocation(0, 0);
webBrowser.setVisible(false);
panel = new Panel();
panel.setSize(400, 300);
panel.setLocation(50, 50);
panel.add(webBrowser);
panel.setVisible(true);
p.frame.add(panel);
p.frame.add(tmpComp);
}
}
and if i run it with size(1024,768); it works well...
But the problem is when i try to run it with opengl... the same error from your sketch of fullscreen appear...
Some body knows what can i do Tnx!
The error is :
Exception in thread "Animation Thread" javax.media.opengl.GLException: Unable to create OpenGL context for device context 0x2a0123de
at com.sun.opengl.impl.windows.WindowsGLContext.create(WindowsGLContext.java:122)
at com.sun.opengl.impl.windows.WindowsGLContext.makeCurrentImpl(WindowsGLContext.ja
va:150)
at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnsc
reenGLContext.java:66)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)