diff --git a/src/org/lwjgl/opengl/awt/GLData.java b/src/org/lwjgl/opengl/awt/GLData.java index 76d94b9..2717dba 100644 --- a/src/org/lwjgl/opengl/awt/GLData.java +++ b/src/org/lwjgl/opengl/awt/GLData.java @@ -119,7 +119,11 @@ public static enum ReleaseBehavior { /** * Whether to use sRGB color space. */ - public boolean sRGB; + public boolean sRGB; + /** + * Used to determine the sRGB extension to use + */ + boolean extBuffer_sRGB = true; /** * Whether to use a floating point pixel format. */ diff --git a/src/org/lwjgl/opengl/awt/PlatformWin32GLCanvas.java b/src/org/lwjgl/opengl/awt/PlatformWin32GLCanvas.java index 3210a74..6604a9a 100644 --- a/src/org/lwjgl/opengl/awt/PlatformWin32GLCanvas.java +++ b/src/org/lwjgl/opengl/awt/PlatformWin32GLCanvas.java @@ -36,6 +36,7 @@ import static org.lwjgl.opengl.WGLARBCreateContext.*; import static org.lwjgl.opengl.WGLARBCreateContextProfile.*; import static org.lwjgl.opengl.WGLARBCreateContextRobustness.*; +import static org.lwjgl.opengl.WGLARBFramebufferSRGB.*; import static org.lwjgl.opengl.WGLARBMultisample.WGL_SAMPLES_ARB; import static org.lwjgl.opengl.WGLARBMultisample.WGL_SAMPLE_BUFFERS_ARB; import static org.lwjgl.opengl.WGLARBPixelFormat.*; @@ -110,7 +111,7 @@ private static void encodePixelFormatAttribs(IntBuffer ib, GLData attribs) { if (attribs.accumRedSize > 0 || attribs.accumGreenSize > 0 || attribs.accumBlueSize > 0 || attribs.accumAlphaSize > 0) ib.put(WGL_ACCUM_BITS_ARB).put(attribs.accumRedSize + attribs.accumGreenSize + attribs.accumBlueSize + attribs.accumAlphaSize); if (attribs.sRGB) - ib.put(WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT).put(1); + ib.put(attribs.extBuffer_sRGB ? WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT : WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB).put(1); if (attribs.samples > 0) { ib.put(WGL_SAMPLE_BUFFERS_ARB).put(1); ib.put(WGL_SAMPLES_ARB).put(attribs.samples); @@ -426,14 +427,18 @@ private static long create(MemoryStack stack, long windowHandle, long dummyWindo } } if (attribs.sRGB) { - // Check for WGL_EXT_framebuffer_sRGB - boolean has_WGL_EXT_framebuffer_sRGB = wglExtensionsList.contains("WGL_EXT_framebuffer_sRGB"); - if (!has_WGL_EXT_framebuffer_sRGB) { + // Check for WGL_EXT_framebuffer_sRGB | WGL_ARB_framebuffer_sRGB + boolean has_WGL_EXT_framebuffer_sRGB = wglExtensionsList.contains("WGL_EXT_framebuffer_sRGB"), + has_WGL_ARB_framebuffer_sRGB = wglExtensionsList.contains("WGL_ARB_framebuffer_sRGB"); + + if (! (has_WGL_EXT_framebuffer_sRGB || has_WGL_ARB_framebuffer_sRGB) ) { ReleaseDC(windowHandle, hDC); wglDeleteContext(dummyContext); wglMakeCurrent(currentDc, currentContext); throw new AWTException("sRGB color space requested but WGL_EXT_framebuffer_sRGB is unavailable"); } + + attribs.extBuffer_sRGB = has_WGL_EXT_framebuffer_sRGB; } if (attribs.pixelFormatFloat) { // Check for WGL_ARB_pixel_format_float