From d96486967efcfb6f43226da9fa60cbc3d68ab323 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 28 Jun 2008 14:30:26 +0000 Subject: 3rd round cdcfp - compile clean. Re-adding cdcfp: com/sun/opengl/impl/glu/mipmap/* com/sun/opengl/impl/GLPbufferImpl.java Using 'BufferUtil.nativeOrder(ByteBuffer)' to set up the native byte order. 'BufferUtil.nativeOrder' is now public. GLDrawableFactory: - removed 'hardcoded' awt attribute. Cleanup NEWT's AWT wrapping implementation. - NativeWindowFactory incooperates with the wrapping property. Bugs on X11/NEWT/AWT: - no events - deadlock at shutdown - deadlock if EGLDrawable with AWT get's locked git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1700 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../com/sun/opengl/impl/egl/EGLDrawable.java | 49 ++++++++++++++++------ 1 file changed, 37 insertions(+), 12 deletions(-) (limited to 'src/classes/com/sun/opengl/impl/egl/EGLDrawable.java') diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java index b562d7423..034471b00 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java @@ -82,7 +82,11 @@ public class EGLDrawable extends GLDrawableImpl { public void destroy() { setRealized(false); - EGL.eglTerminate(display); + if(EGL.EGL_NO_DISPLAY!=display) { + EGL.eglTerminate(display); + display=EGL.EGL_NO_DISPLAY; + } + super.destroy(); } public _EGLConfig getConfig() { @@ -99,10 +103,18 @@ public class EGLDrawable extends GLDrawableImpl { public void setRealized(boolean realized) { if (realized) { - // Create the window surface - surface = EGL.eglCreateWindowSurface(display, config, component.getWindowHandle(), null); + 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"); + throw new GLException("Creation of window surface (eglCreateWindowSurface) failed, component: "+component); } } else if( surface != EGL.EGL_NO_SURFACE ) { // Destroy the window surface @@ -115,6 +127,7 @@ public class EGLDrawable extends GLDrawableImpl { } surface = EGL.EGL_NO_SURFACE; } + super.setRealized(realized); } public void setSize(int width, int height) { @@ -136,16 +149,28 @@ public class EGLDrawable extends GLDrawableImpl { } public void swapBuffers() throws GLException { - EGL.eglSwapBuffers(display, surface); + getFactory().lockToolkit(); + try { + if (component.getSurfaceHandle() == 0) { + if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) { + return; + } + } + + EGL.eglSwapBuffers(display, surface); + + } finally { + unlockSurface(); + getFactory().unlockToolkit(); + } } public String toString() { - return "EGLDrawable[ displayHandle " + component.getDisplayHandle() + - ", screenHandle "+ component.getScreenHandle() + - ", windowHandle "+ component.getWindowHandle() + - ", display " + display + - ", config " + config + - ", surface " + surface + - "]"; + return "EGLDrawable[ realized "+getRealized()+ + ", window "+getNativeWindow()+ + ", egl display " + display + + ", egl config " + config + + ", egl surface " + surface + + ", factory "+getFactory()+"]"; } } -- cgit v1.2.3