diff options
Diffstat (limited to 'src/jogl/classes/com')
5 files changed, 55 insertions, 31 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java index d1a35b1b6..16eb934bd 100644 --- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java +++ b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java @@ -61,7 +61,6 @@ public abstract class GLContextImpl extends GLContext { // platforms anyway in particular with the disabling of the // GLWorkerThread which we found to be necessary in 1.0 beta 4. protected boolean optimizationEnabled = Debug.isPropertyDefined("jogl.GLContext.optimize", true); - protected boolean tryGLContext3_2 = Debug.isPropertyDefined("jogl.GLContext.3_2", true); // Cache of the functions that are available to be called at the current // moment in time diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java index 4ea3519bf..0754c4b57 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -86,7 +86,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { rect = false; } } - textureTarget = (rect ? GL2.GL_TEXTURE_RECTANGLE_EXT: GL.GL_TEXTURE_2D); + textureTarget = (rect ? GL2.GL_TEXTURE_RECTANGLE : GL.GL_TEXTURE_2D); int[] tmp = new int[1]; gl.glGenTextures(1, tmp, 0); texture = tmp[0]; diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java index 0d031ffff..2d7b3ea34 100644 --- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -98,7 +98,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { GLProfile glProfile = capabilities.getGLProfile(); int renderTarget; if (glProfile.isGL2() && capabilities.getPbufferRenderToTextureRectangle()) { - renderTarget = GL2.GL_TEXTURE_RECTANGLE_EXT; + renderTarget = GL2.GL_TEXTURE_RECTANGLE; } else { int w = getNextPowerOf2(getWidth()); int h = getNextPowerOf2(getHeight()); diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java index e459d0c5a..9a3860ae2 100644 --- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java @@ -178,7 +178,8 @@ public class WindowsWGLContext extends GLContextImpl { if(glCaps.getGLProfile().isGL3()) { // Try >= 3.2 core first ! - // In contrast to GLX no verify with a None drawable binding (default framebuffer) is necessary. + // In contrast to GLX no verify with a None drawable binding (default framebuffer) is necessary, + // if no 3.2 is available creation fails already! attribs[0+1] = 3; attribs[2+1] = 2; attribs[6+0] = WGLExt.WGL_CONTEXT_PROFILE_MASK_ARB; @@ -186,7 +187,7 @@ public class WindowsWGLContext extends GLContextImpl { hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0); if(0==hglrc) { if(DEBUG) { - System.err.println("WindowsWGLContext.createContext couldn't create >= 3.2 core context"); + System.err.println("WindowsWGLContext.createContext couldn't create >= 3.2 core context - fallback"); } // Try >= 3.1 forward compatible - last resort for GL3 ! attribs[0+1] = 3; @@ -201,6 +202,13 @@ public class WindowsWGLContext extends GLContextImpl { if(0==hglrc) { // 3.1 or 3.0 .. hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0); + if(DEBUG) { + if(0==hglrc) { + System.err.println("WindowsWGLContext.createContext couldn't create >= 3.0 context - fallback"); + } else { + System.err.println("WindowsWGLContext.createContext >= 3.0 available 0x"+Long.toHexString(hglrc)); + } + } } if(0==hglrc) { diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java index 126062d27..d5a5f3433 100644 --- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java @@ -202,27 +202,30 @@ public abstract class X11GLXContext extends GLContextImpl { }; if(glCaps.getGLProfile().isGL3()) { - if(tryGLContext3_2) { - // Try >= 3.2 core first - // and verify with a None drawable binding (default framebuffer) - attribs[0+1] = 3; - attribs[2+1] = 2; - // FIXME: attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB; - // FIXME: attribs[8+1] = GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB; - - context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); - if(0!=context) { - if (!GLX.glXMakeContextCurrent(display, 0, 0, context)) { - if(DEBUG) { - System.err.println("X11GLXContext.createContext couldn't make >= 3.2 core context current - fallback"); - } - GLX.glXMakeContextCurrent(display, 0, 0, 0); - GLX.glXDestroyContext(display, context); - context = 0; - } else if(DEBUG) { - System.err.println("X11GLXContext.createContext >= 3.2 available 0x"+Long.toHexString(context)); + // Try >= 3.2 core first + // and verify with a None drawable binding (default framebuffer) + attribs[0+1] = 3; + attribs[2+1] = 2; + // FIXME NV Bug: attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB; + // FIXME NV Bug: attribs[8+1] = GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + + context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); + if(0!=context) { + if (!GLX.glXMakeContextCurrent(display, + drawable.getNativeWindow().getSurfaceHandle(), + drawable.getNativeWindow().getSurfaceHandle(), + context)) { + if(DEBUG) { + System.err.println("X11GLXContext.createContext couldn't make >= 3.2 core context current - fallback"); } + GLX.glXMakeContextCurrent(display, 0, 0, 0); + GLX.glXDestroyContext(display, context); + context = 0; } else if(DEBUG) { + System.err.println("X11GLXContext.createContext >= 3.2 available 0x"+Long.toHexString(context)); + } + } else { + if(DEBUG) { System.err.println("X11GLXContext.createContext couldn't create >= 3.2 core context - fallback"); } } @@ -238,6 +241,25 @@ public abstract class X11GLXContext extends GLContextImpl { if(0==context) { // 3.1 or 3.0 .. context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); + if(0!=context) { + if (!GLX.glXMakeContextCurrent(display, + drawable.getNativeWindow().getSurfaceHandle(), + drawable.getNativeWindow().getSurfaceHandle(), + context)) { + if(DEBUG) { + System.err.println("X11GLXContext.createContext couldn't make >= 3.0 core context current - fallback"); + } + GLX.glXMakeContextCurrent(display, 0, 0, 0); + GLX.glXDestroyContext(display, context); + context = 0; + } else if(DEBUG) { + System.err.println("X11GLXContext.createContext >= 3.0 available 0x"+Long.toHexString(context)); + } + } else { + if(DEBUG) { + System.err.println("X11GLXContext.createContext couldn't create >= 3.0 core context - fallback"); + } + } } if(0==context) { @@ -253,22 +275,17 @@ public abstract class X11GLXContext extends GLContextImpl { drawable.getNativeWindow().getSurfaceHandle(), drawable.getNativeWindow().getSurfaceHandle(), context)) { + GLX.glXMakeContextCurrent(display, 0, 0, 0); + GLX.glXDestroyContext(display, temp_context); throw new GLException("Error making context (old) current: display 0x"+Long.toHexString(display)+", context 0x"+Long.toHexString(context)+", drawable "+drawable); } if(DEBUG) { System.err.println("X11GLXContext.createContext done (old ctx < 3.0 - no 3.0) 0x"+Long.toHexString(context)); } } else { - GLX.glXMakeContextCurrent(display, 0, 0, 0); GLX.glXDestroyContext(display, temp_context); // need to update the GL func table .. - if (!GLX.glXMakeContextCurrent(display, - drawable.getNativeWindow().getSurfaceHandle(), - drawable.getNativeWindow().getSurfaceHandle(), - context)) { - throw new GLException("Error making context (new) current: display 0x"+Long.toHexString(display)+", context 0x"+Long.toHexString(context)+", drawable "+drawable); - } updateGLProcAddressTable(); if(DEBUG) { System.err.println("X11GLXContext.createContext done (new ctx >= 3.0) 0x"+Long.toHexString(context)); |