From 372767d3faa62d6e95dd8e9ad5c3105bf9614f3d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 18 Oct 2009 07:59:08 -0700 Subject: Add OpenGL 3.x compatibility profile GL3bc, where 'bc' is not a religious remark, but simply means 'backward compatible' :) GL3bc := GL2 + GL3, hence the interface does not define any new values or methods. Moved GL3's 3.1 part from gl3.h to gl3ext.h, so it can be included in gl3bc.c, besides gl2.h. --- .../sun/opengl/impl/windows/wgl/WindowsWGLContext.java | 18 +++++++++++++++--- .../com/sun/opengl/impl/x11/glx/X11GLXContext.java | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) (limited to 'src/jogl/classes/com/sun/opengl/impl') 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 418336e3f..497e9f03b 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 @@ -202,8 +202,18 @@ public class WindowsWGLContext extends GLContextImpl { // 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; - attribs[6+1] = WGLExt.WGL_CONTEXT_CORE_PROFILE_BIT_ARB; + if(glCaps.getGLProfile().isGL3bc()) { + attribs[6+0] = WGLExt.WGL_CONTEXT_PROFILE_MASK_ARB; + attribs[6+1] = WGLExt.WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; + } + /** + * don't stricten requirements any further, even compatible would be fine + * + } else { + attribs[6+0] = WGLExt.WGL_CONTEXT_PROFILE_MASK_ARB; + attribs[6+1] = WGLExt.WGL_CONTEXT_CORE_PROFILE_BIT_ARB; + } + */ hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0); if(0==hglrc) { if(DEBUG) { @@ -212,7 +222,9 @@ public class WindowsWGLContext extends GLContextImpl { // Try >= 3.1 forward compatible - last resort for GL3 ! attribs[0+1] = 3; attribs[2+1] = 1; - attribs[4+1] |= WGLExt.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + if(!glCaps.getGLProfile().isGL3bc()) { + attribs[4+1] |= WGLExt.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + } attribs[6+0] = 0; attribs[6+1] = 0; } else if(DEBUG) { 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 84f32d43e..330d0a473 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 @@ -205,8 +205,18 @@ public abstract class X11GLXContext extends GLContextImpl { // 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; + if(glCaps.getGLProfile().isGL3bc()) { + attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB; + attribs[8+1] = GLX.GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; + } + /** + * don't stricten requirements any further, even compatible would be fine + * + } else { + attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB; + attribs[8+1] = GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + } + */ context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0); if(0!=context) { @@ -232,7 +242,9 @@ public abstract class X11GLXContext extends GLContextImpl { // Try >= 3.1 forward compatible - last resort for GL3 ! attribs[0+1] = 3; attribs[2+1] = 1; - attribs[6+1] |= GLX.GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + if(!glCaps.getGLProfile().isGL3bc()) { + attribs[6+1] |= GLX.GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + } attribs[8+0] = 0; attribs[8+1] = 0; } -- cgit v1.2.3