diff options
author | Sven Gothel <[email protected]> | 2008-06-28 23:50:30 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-06-28 23:50:30 +0000 |
commit | 7be2d71e458dd37789ceac43dede4b308eff45c2 (patch) | |
tree | 3bdf63df9b5dce95ad8ac28047513191e2a04251 /src/classes/com/sun/opengl/impl/egl/EGLDrawable.java | |
parent | d96486967efcfb6f43226da9fa60cbc3d68ab323 (diff) |
Synced locking of EGLDrawable/EGLContext with X11GLX* counterpart.
However, the 'unofficial combination' X11/AWT/EGL-Emulation
will freeze when AWT locking will be used.
Hence AWT locking is disabled within EGL,
which has no impact for the NEWT/EGL product.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1701 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/impl/egl/EGLDrawable.java')
-rwxr-xr-x | src/classes/com/sun/opengl/impl/egl/EGLDrawable.java | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java index 034471b00..061a3eb38 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java @@ -40,8 +40,8 @@ import com.sun.opengl.impl.GLDrawableImpl; import javax.media.opengl.*; public class EGLDrawable extends GLDrawableImpl { - private long display; private GLCapabilitiesChooser chooser; + private long display; private _EGLConfig config; private long surface; private int[] tmp = new int[1]; @@ -50,9 +50,10 @@ public class EGLDrawable extends GLDrawableImpl { NativeWindow component, GLCapabilities capabilities, GLCapabilitiesChooser chooser) throws GLException { - super(factory, component, true); + super(factory, component, false); setChosenGLCapabilities(capabilities); this.chooser = chooser; + surface=EGL.EGL_NO_SURFACE; display = EGL.eglGetDisplay((component.getDisplayHandle()>0)?component.getDisplayHandle():EGL.EGL_DEFAULT_DISPLAY); if (display == EGL.EGL_NO_DISPLAY) { @@ -97,25 +98,28 @@ public class EGLDrawable extends GLDrawableImpl { return surface; } + protected void setSurface() { + if (EGL.EGL_NO_SURFACE==surface) { + try { + lockSurface(); + // Create the window surface + surface = EGL.eglCreateWindowSurface(display, config, component.getWindowHandle(), null); + if (EGL.EGL_NO_SURFACE==surface) { + throw new GLException("Creation of window surface (eglCreateWindowSurface) failed, component: "+component); + } + } finally { + unlockSurface(); + } + } + } + public GLContext createContext(GLContext shareWith) { return new EGLContext(this, shareWith); } public void setRealized(boolean realized) { if (realized) { - getFactory().lockToolkit(); - try { - lockSurface(); - - // Create the window surface - surface = EGL.eglCreateWindowSurface(display, config, component.getWindowHandle(), null); - } finally { - unlockSurface(); - getFactory().unlockToolkit(); - } - if (surface == EGL.EGL_NO_SURFACE) { - throw new GLException("Creation of window surface (eglCreateWindowSurface) failed, component: "+component); - } + // setSurface(); } else if( surface != EGL.EGL_NO_SURFACE ) { // Destroy the window surface // FIXME: we should expose a destroy() method on |