Re: re: NEWT Threading Overview
Posted by
BrickFarmer on
Nov 30, 2010; 11:39am
URL: https://forum.jogamp.org/re-NEWT-Threading-Overview-tp1991718p1992182.html
I use something like this in my base class constructor. note: I haven't ported this yet over to the very latest jogl2, so it's currently 'untested' although it has been working fine for 20+ canvases so far :) As you can see from about 1:16 in this video:
http://www.youtube.com/watch?v=pXl3Q1r70O0I have the main game canvas in the background and then 4 smaller canvases for building my models.
private static volatile GLContext sharedContext;
public CanvasBase(final String name, final AnimatorBase animator){
super(caps, null, sharedContext, null); //null for first creation
this.name = name;
this.animator = animator;
glu = new GLU();
glut = new GLUT();
addGLEventListener(this);
//delegate to child instances for any listeners
setupListeners(this);
//reset view as defined by child
resetView();
that = this;
//System.out.println("CREATED: "+name+" CONTEXT: "+sharedContext);
if (sharedContext == null) {
sharedContext = getContext();
}
}