diff options
Diffstat (limited to 'src/net/java/games/jogl/impl/windows')
-rw-r--r-- | src/net/java/games/jogl/impl/windows/WindowsGLContext.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/net/java/games/jogl/impl/windows/WindowsGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsGLContext.java index 45bd7f21d..56a7188eb 100644 --- a/src/net/java/games/jogl/impl/windows/WindowsGLContext.java +++ b/src/net/java/games/jogl/impl/windows/WindowsGLContext.java @@ -257,13 +257,12 @@ public abstract class WindowsGLContext extends GLContext { if (onscreen) { GLCapabilities[] availableCaps = null; int numFormats = 0; - pfd = new PIXELFORMATDESCRIPTOR(); + pfd = newPixelFormatDescriptor(); GraphicsDevice device = component.getGraphicsConfiguration().getDevice(); // Produce a recommended pixel format selection for the GLCapabilitiesChooser. // Try to use wglChoosePixelFormatARB if we have it available GL dummyGL = WindowsGLContextFactory.getDummyGLContext(device); int recommendedPixelFormat = -1; - pfd = new PIXELFORMATDESCRIPTOR(); boolean haveWGLChoosePixelFormatARB = false; boolean haveWGLARBMultisample = false; if (dummyGL != null) { @@ -472,9 +471,7 @@ public abstract class WindowsGLContext extends GLContext { if (colorDepth < 15) { throw new GLException("Bit depths < 15 (i.e., non-true-color) not supported"); } - PIXELFORMATDESCRIPTOR pfd = new PIXELFORMATDESCRIPTOR(); - pfd.nSize((short) pfd.size()); - pfd.nVersion((short) 1); + PIXELFORMATDESCRIPTOR pfd = newPixelFormatDescriptor(); int pfdFlags = (WGL.PFD_SUPPORT_OPENGL | WGL.PFD_GENERIC_ACCELERATED); if (caps.getDoubleBuffered()) { @@ -499,6 +496,13 @@ public abstract class WindowsGLContext extends GLContext { return pfd; } + static PIXELFORMATDESCRIPTOR newPixelFormatDescriptor() { + PIXELFORMATDESCRIPTOR pfd = new PIXELFORMATDESCRIPTOR(); + pfd.nSize((short) pfd.size()); + pfd.nVersion((short) 1); + return pfd; + } + static GLCapabilities pfd2GLCapabilities(PIXELFORMATDESCRIPTOR pfd) { if ((pfd.dwFlags() & WGL.PFD_SUPPORT_OPENGL) == 0) { return null; |