From 89428de3de8c83eb4ece9a05a1ef5b2ef9cf7cd7 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 26 Apr 2004 16:26:46 +0000 Subject: Fixed problem identified by William Denniss on JOGL forums where PIXELFORMATDESCRIPTOR didn't have its size or version fields initialized git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@126 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/net/java/games/jogl/impl/windows/WindowsGLContext.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/net/java/games/jogl/impl/windows') 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; -- cgit v1.2.3