Bugzilla – Attachment 348 Details for
Bug 572
Calling invoke(true,GLRunnable) on several GLCanvases in the same container causes a deadlock
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Ardor3D JOGL2 Patch Fix GLContext makeCurrent/release imbalance / commented-out workaround for old JOGL bug
fixBug572_and_GLContextMakeCurrentRelease-Destroy.patch (text/plain), 7.64 KB, created by
Sven Gothel
on 2012-05-14 16:51:59 CEST
(
hide
)
Description:
Ardor3D JOGL2 Patch Fix GLContext makeCurrent/release imbalance / commented-out workaround for old JOGL bug
Filename:
MIME Type:
Creator:
Sven Gothel
Created:
2012-05-14 16:51:59 CEST
Size:
7.64 KB
patch
obsolete
>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 @@ > <classpathentry kind="src" path="src/main/java"/> > <classpathentry combineaccessrules="false" kind="src" path="/ardor3d-core"/> > <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> >- <classpathentry kind="lib" path="lib/jogl/gluegen-rt.jar"/> >- <classpathentry exported="true" kind="lib" path="lib/jogl/jogl.all.jar"/> >+ <classpathentry kind="lib" path="lib/jogl/gluegen-rt.jar" sourcepath="lib/jogl/gluegen-java-src.zip"/> >+ <classpathentry exported="true" kind="lib" path="lib/jogl/jogl.all.jar" sourcepath="lib/jogl/jogl-java-src.zip"/> > <classpathentry kind="output" path="bin"/> > </classpath>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 572
: 348 |
370