Index: src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java =================================================================== --- src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java (revision 63) +++ src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java (working copy) @@ -18,7 +18,6 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; -import javax.media.opengl.glu.GLU; import com.ardor3d.annotation.MainThread; import com.ardor3d.framework.CanvasRenderer; @@ -140,47 +139,50 @@ } _context.makeCurrent(); - - // Look up a shared context, if a shared JoglCanvasRenderer is given. - RenderContext sharedContext = null; - if (settings.getShareContext() != null) { - sharedContext = ContextManager.getContextForKey(settings.getShareContext().getRenderContext() - .getContextKey()); + try { + // Look up a shared context, if a shared JoglCanvasRenderer is given. + RenderContext sharedContext = null; + if (settings.getShareContext() != null) { + sharedContext = ContextManager.getContextForKey(settings.getShareContext().getRenderContext() + .getContextKey()); + } + + final ContextCapabilities caps = createContextCapabilities(); + _currentContext = new RenderContext(_context, caps, sharedContext); + + ContextManager.addContext(_context, _currentContext); + ContextManager.switchContext(_context); + + _renderer = new JoglRenderer(); + + if (settings.getSamples() != 0 && caps.isMultisampleSupported()) { + final GL gl = _context.getGL(); + gl.glEnable(GL.GL_MULTISAMPLE); + } + + _renderer.setBackgroundColor(ColorRGBA.BLACK); + + if (_camera == null) { + /** Set up how our camera sees. */ + _camera = new Camera(settings.getWidth(), settings.getHeight()); + _camera.setFrustumPerspective(45.0f, (float) settings.getWidth() / (float) settings.getHeight(), 1, 1000); + _camera.setProjectionMode(ProjectionMode.Perspective); + + final Vector3 loc = new Vector3(0.0f, 0.0f, 10.0f); + final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f); + final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); + final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); + /** Move our camera to a correct place and orientation. */ + _camera.setFrame(loc, left, up, dir); + } else { + // use new width and height to set ratio. + _camera.setFrustumPerspective(_camera.getFovY(), + (float) settings.getWidth() / (float) settings.getHeight(), _camera.getFrustumNear(), _camera + .getFrustumFar()); + } + } finally { + _context.release(); } - - final ContextCapabilities caps = createContextCapabilities(); - _currentContext = new RenderContext(_context, caps, sharedContext); - - ContextManager.addContext(_context, _currentContext); - ContextManager.switchContext(_context); - - _renderer = new JoglRenderer(); - - if (settings.getSamples() != 0 && caps.isMultisampleSupported()) { - final GL gl = GLU.getCurrentGL(); - gl.glEnable(GL.GL_MULTISAMPLE); - } - - _renderer.setBackgroundColor(ColorRGBA.BLACK); - - if (_camera == null) { - /** Set up how our camera sees. */ - _camera = new Camera(settings.getWidth(), settings.getHeight()); - _camera.setFrustumPerspective(45.0f, (float) settings.getWidth() / (float) settings.getHeight(), 1, 1000); - _camera.setProjectionMode(ProjectionMode.Perspective); - - final Vector3 loc = new Vector3(0.0f, 0.0f, 10.0f); - final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f); - final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f); - final Vector3 dir = new Vector3(0.0f, 0f, -1.0f); - /** Move our camera to a correct place and orientation. */ - _camera.setFrame(loc, left, up, dir); - } else { - // use new width and height to set ratio. - _camera.setFrustumPerspective(_camera.getFovY(), - (float) settings.getWidth() / (float) settings.getHeight(), _camera.getFrustumNear(), _camera - .getFrustumFar()); - } } public GLContext getContext() { Index: src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java =================================================================== --- src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java (revision 63) +++ src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java (working copy) @@ -10,6 +10,8 @@ package com.ardor3d.framework.jogl; +import java.awt.EventQueue; +import java.lang.reflect.InvocationTargetException; import java.util.concurrent.CountDownLatch; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLRunnable; @@ -54,7 +56,20 @@ } // Make the window visible to realize the OpenGL surface. - setVisible(true); + setVisible(true); + /** + try { + EventQueue.invokeAndWait(new Runnable() { + public void run() { + setVisible(true); + display(); // force creation via validateGLDrawable() + } + }); + } catch (InvocationTargetException e) { + throw new RuntimeException(e.getTargetException()); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } */ // Request the focus here as it cannot work when the window is not visible requestFocus(); Index: src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java =================================================================== --- src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java (revision 63) +++ src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java (working copy) @@ -15,7 +15,7 @@ import javax.media.opengl.GL2GL3; import com.ardor3d.image.ImageDataFormat; -import com.ardor3d.image.ImageDataType; +import com.ardor3d.image.PixelDataType; import com.ardor3d.image.TextureStoreFormat; import com.ardor3d.image.Texture.ApplyMode; import com.ardor3d.image.Texture.CombinerFunctionAlpha; @@ -159,7 +159,7 @@ throw new IllegalArgumentException("Incorrect format set: " + format); } - public static int getGLPixelDataType(final ImageDataType type) { + public static int getGLPixelDataType(final PixelDataType type) { switch (type) { case Byte: return GL.GL_BYTE; Index: .classpath =================================================================== --- .classpath (revision 63) +++ .classpath (working copy) @@ -3,7 +3,7 @@ - - + +