[quote]As far as it goes for other threads, it sounds like you have the right rules. Keep in mind that JOGL by default forces everything onto the AWT thread internally, so you’ll have to call Threading.disableSingleThreading() to correctly get different threads to work.
[/quote]
Is this still required if you aren’t using a GLCanvas and building the GLDrawable directly?
I’m using the following code to associate a GLDrawable to a Frame. I’m actually surprised this is working.
private static Frame frame;
private static GLCapabilities capabilities;
private static GLDrawable drawable;
private static GLContext context;
private static GL gl;
private static GLU glu;
Part of a makeFrame method called from the main method.
capabilities = new GLCapabilities();
AWTGraphicsDevice dev = new AWTGraphicsDevice(null);
AWTGraphicsConfiguration awtConfig = (AWTGraphicsConfiguration) GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, null, dev);
GraphicsConfiguration config = null;
if (awtConfig != null) config = awtConfig.getGraphicsConfiguration();
frame = new Frame(title, config);
frame.setSize(PWIDTH,PHEIGHT);
frame.setFocusable(true);
frame.requestFocus();
drawable = GLDrawableFactory.getFactory().getGLDrawable(frame, capabilities, null);
context = drawable.createContext(null);
// add listeners to frame
...
frame.setVisible(true);
The main method.
long period = (long)(1000.0 / DEFAULT_FPS) * 1000000L;
makeFrame("CubeGL (Active)", period);
while (!frame.isDisplayable()) Thread.yield();
drawable.setRealized(true); // can now be rendering into
stats = new FrameStatistics(period);
rot = new Rotator3D();
init(); // OpenGL initialization
loop(); // A while loop that calls simulUpdate and renderFrame
// Finalize
stats.printStats();
context.destroy();
System.exit(0);