aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-06-10 09:35:06 +0200
committerSven Gothel <[email protected]>2010-06-10 09:35:06 +0200
commit1d333a771ce0bc7c8594e21d031703f698f06a46 (patch)
tree933d470582896320855fa1d98c1a917edc412c24 /src/jogl/classes/com/jogamp/opengl/impl/windows/wgl
parent4512900ddcb9ce9a498411d257b1b6d6010ec006 (diff)
Fix: Locking/Threading; Common IntIntHashMap and Buffers; Fix: glMap*Buffer*; GLX/WGL/CgGL: All runtime dynamic; Misc ..
TODO: Compile and test on MacOSX .. Fix: ===== Multithreading/Locking: See jogl/doc/Implementation/MultiThreading.txt - Locking layer is not platform agnostic, ie GLContextImpl, GLDrawableImpl, .. and NEWT: Window/Display - No more use of JAWT global lock necessary, removed. - No need for X11 Display lock, on the contrary, this made the NV driver hang. - Use common window/surface lock - All NativeWindow surfaceLock's are recursive now glMapBuffer: If size is 0, don't do cont with the native call. glMapBufferRange: Fix capacity. glNamedBufferDataEXT: Track the size. glMapNamedBufferEXT: Manual impl. - use the tracked size glXGetVisualFromFBConfig, glXChooseFBConfig, glXChooseVisual: Instead of ignoring and implement a renamed version (*Copied), we just use ManualImplementation for the proper copy-result code. DesktopGLDynamicLookupHelper: Initialize _hasGLBinding* attributes in the determing loadGLJNILibrary() method, which is called by super(). Otherwise static init will overwrite them after the super() call. X11GLXDrawableFactory: Don't release anything at shutdown (removed sharedContext.destroy()), since this caused a freeze/SEGV sometimes. Fixed NEWT's reparentWindow() functionality incl NewtCanvasAWT usage. - Native: if not visible, don't focus, etc - NewtCanvasAWT: Use the container size to start with - Run the command on the EDT Using GlueGen's new DynamicLibraryBundle utility: - X11, Windows and MacOSX OpenGL adapted to DynamicLibraryBundleInfo. - X11GLXDynamicLookupHelper -> X11GLXDynamicLibraryBundleInfo - Remove all path from lib names. - GL order: libGL.so.1, libGL.so, GL - shallLinkGlobal: true -> to server some 'old' DRI systems -> http://dri.sourceforge.net/doc/DRIuserguide.html - shallLookupGlobal: false - Try both : glXGetProcAddressARB and glXGetProcAddress - Using bootstrap: GLX.glXGetProcAddress(long glxGetProcAddressHandle, String glFuncName) Found the issue with LIBGL_DRIVERS_PATH, ie if not set no valid GL instance can be found (ie ATI fglrx/DRI). This may happen if using a differen user than the desktop user for whom the env var is set within some /etc/X11/Xsession.d/ script. Enhancements: ============= GLBufferSizeTracker: Use IntIntHashMap and add DirectState size tracking. GLBufferStateTracker: Use IntIntHashMap. GLStateTracker: Use IntIntHashMap. GLDynamicLookupHelper: More generic (global loading/lookup and GetProcAddress function name list), remove redundant code. FIXME: MacOSXCGLDynamicLookupHelper: - Not tested - Not using NSImage lookup anymore as recommended by OSX API Doc, so dlsym is used always (to be tested) WindowsWGLDynamicLookupHelper: - Not tested GLX/WGL/CgGL is all runtime-dynamic as now, ie loaded and looked-up at runtime, no compile time dependencies to GL anymore, nor a need to specify CgGL. Split up WGL in GDI and WGL, to allow proper dynamic runtime linkage of OpenGL32 while using static binding to GDI32 NEWT events generated by native code are enqueued and not send directly. This should ease locking mechanisms .. if any are necessary. NEWT: More platform specific code moved to *Impl method, simplifying the generic code of the superclass and impl protocol. Cleanup: ========= Replace all InternalBufferUtil's with com.jogamp.common.nio.Buffers Removed all InternalBufferUtil's from repository Removed GLContextImpl notion of 'optimized' surface locking, where the surface gets unlocked during makeCurrent/release. This just makes no sense and would impact multithreading in a horrible way.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/windows/wgl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java14
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java8
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java22
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java37
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java14
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java102
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java67
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java50
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java (renamed from src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLookupHelper.java)55
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java34
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java30
13 files changed, 167 insertions, 281 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
index 87a37da04..5e3d55b04 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
@@ -51,9 +51,9 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
// All entries to CreateDummyWindow must synchronize on one object
// to avoid accidentally registering the dummy window class twice
synchronized (WindowsDummyWGLDrawable.class) {
- hwnd = WGL.CreateDummyWindow(0, 0, 1, 1);
+ hwnd = GDI.CreateDummyWindow(0, 0, 1, 1);
}
- hdc = WGL.GetDC(hwnd);
+ hdc = GDI.GetDC(hwnd);
NullWindow nw = (NullWindow) getNativeWindow();
nw.setSurfaceHandle(hdc);
WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)nw.getGraphicsConfiguration().getNativeGraphicsConfiguration();
@@ -61,9 +61,9 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
GLCapabilities caps = (GLCapabilities) config.getChosenCapabilities();
caps.setDepthBits(16);
PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps);
- int pixelFormat = WGL.ChoosePixelFormat(hdc, pfd);
+ int pixelFormat = GDI.ChoosePixelFormat(hdc, pfd);
if ((pixelFormat == 0) ||
- (!WGL.SetPixelFormat(hdc, pixelFormat, pfd))) {
+ (!GDI.SetPixelFormat(hdc, pixelFormat, pfd))) {
destroy();
}
}
@@ -90,12 +90,12 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
public void destroy() {
if (hdc != 0) {
- WGL.ReleaseDC(hwnd, hdc);
+ GDI.ReleaseDC(hwnd, hdc);
hdc = 0;
}
if (hwnd != 0) {
- WGL.ShowWindow(hwnd, WGL.SW_HIDE);
- WGL.DestroyWindow(hwnd);
+ GDI.ShowWindow(hwnd, GDI.SW_HIDE);
+ GDI.DestroyWindow(hwnd);
hwnd = 0;
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
index 55c9dc378..1f1fb0d40 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
@@ -69,7 +69,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
if (ctx == 0) {
throw new GLException("Error: attempted to make an external GLContext without a context current");
}
- int pfdID = WGL.GetPixelFormat(hdc);
+ int pfdID = GDI.GetPixelFormat(hdc);
if (pfdID == 0) {
throw new GLException("Error: attempted to make an external GLContext without a valid pixelformat");
}
@@ -100,20 +100,16 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
lastContext = null;
}
- protected int makeCurrentImpl() throws GLException {
+ protected void makeCurrentImpl(boolean newCreated) throws GLException {
if (firstMakeCurrent) {
firstMakeCurrent = false;
- return CONTEXT_CURRENT_NEW;
}
- return CONTEXT_CURRENT;
}
protected void releaseImpl() throws GLException {
}
protected void destroyImpl() throws GLException {
- contextHandle = 0;
- GLContextShareSet.contextDestroyed(this);
}
// Need to provide the display connection to extension querying APIs
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
index 74db45932..41e469224 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
@@ -55,7 +55,7 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable {
if (0==hdc) {
throw new GLException("Error: attempted to make an external GLDrawable without a drawable current");
}
- int pfdID = WGL.GetPixelFormat(hdc);
+ int pfdID = GDI.GetPixelFormat(hdc);
if (pfdID == 0) {
throw new GLException("Error: attempted to make an external GLContext without a valid pixelformat");
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
index bf466d455..8079cd42a 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
@@ -89,27 +89,27 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
header.setBiYPelsPerMeter(0);
header.setBiClrUsed(0);
header.setBiClrImportant(0);
- header.setBiCompression(WGL.BI_RGB);
+ header.setBiCompression(GDI.BI_RGB);
header.setBiSizeImage(width * height * bitsPerPixel / 8);
- long hdc = WGL.CreateCompatibleDC(0);
+ long hdc = GDI.CreateCompatibleDC(0);
if (hdc == 0) {
- System.out.println("LastError: " + WGL.GetLastError());
+ System.out.println("LastError: " + GDI.GetLastError());
throw new GLException("Error creating device context for offscreen OpenGL context");
}
((SurfaceChangeable)nw).setSurfaceHandle(hdc);
- hbitmap = WGL.CreateDIBSection(hdc, info, WGL.DIB_RGB_COLORS, null, 0, 0);
+ hbitmap = GDI.CreateDIBSection(hdc, info, GDI.DIB_RGB_COLORS, null, 0, 0);
if (hbitmap == 0) {
- WGL.DeleteDC(hdc);
+ GDI.DeleteDC(hdc);
hdc = 0;
throw new GLException("Error creating offscreen bitmap of width " + width +
", height " + height);
}
- if ((origbitmap = WGL.SelectObject(hdc, hbitmap)) == 0) {
- WGL.DeleteObject(hbitmap);
+ if ((origbitmap = GDI.SelectObject(hdc, hbitmap)) == 0) {
+ GDI.DeleteObject(hbitmap);
hbitmap = 0;
- WGL.DeleteDC(hdc);
+ GDI.DeleteDC(hdc);
hdc = 0;
throw new GLException("Error selecting bitmap into new device context");
}
@@ -121,9 +121,9 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
NativeWindow nw = getNativeWindow();
if (nw.getSurfaceHandle() != 0) {
// Must destroy bitmap and device context
- WGL.SelectObject(nw.getSurfaceHandle(), origbitmap);
- WGL.DeleteObject(hbitmap);
- WGL.DeleteDC(nw.getSurfaceHandle());
+ GDI.SelectObject(nw.getSurfaceHandle(), origbitmap);
+ GDI.DeleteObject(hbitmap);
+ GDI.DeleteDC(nw.getSurfaceHandle());
origbitmap = 0;
hbitmap = 0;
((SurfaceChangeable)nw).setSurfaceHandle(0);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java
index aeb13110e..475faeecc 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java
@@ -46,43 +46,8 @@ import javax.media.opengl.*;
import com.jogamp.opengl.impl.*;
public class WindowsOnscreenWGLContext extends WindowsWGLContext {
- protected WindowsOnscreenWGLDrawable drawable;
-
public WindowsOnscreenWGLContext(WindowsOnscreenWGLDrawable drawable,
GLContext shareWith) {
super(drawable, shareWith);
- this.drawable = drawable;
- }
-
- // Note: Usually the surface shall be locked within [makeCurrent .. swap .. release]
- protected int makeCurrentImpl() throws GLException {
- int lockRes = drawable.lockSurface();
- boolean exceptionOccurred = false;
- try {
- if (lockRes == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return CONTEXT_NOT_CURRENT;
- }
- int ret = super.makeCurrentImpl();
- return ret;
- } catch (RuntimeException e) {
- exceptionOccurred = true;
- throw e;
- } finally {
- if (exceptionOccurred ||
- (isOptimizable() && lockRes != NativeWindow.LOCK_SURFACE_NOT_READY) && drawable.isSurfaceLocked()) {
- drawable.unlockSurface();
- }
- }
- }
-
- // Note: Usually the surface shall be locked within [makeCurrent .. swap .. release]
- protected void releaseImpl() throws GLException {
- try {
- super.releaseImpl();
- } finally {
- if (!isOptimizable() && drawable.isSurfaceLocked()) {
- drawable.unlockSurface();
- }
- }
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
index a9e02e11f..1da5b80c9 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
@@ -68,7 +68,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
WGLExt wglExt = getWGLExt();
gl.glBindTexture(textureTarget, texture);
if (rtt && hasRTT) {
- if (!wglExt.wglBindTexImageARB(drawable.getPbuffer(), WGLExt.WGL_FRONT_LEFT_ARB)) {
+ if (!wglExt.wglBindTexImageARB(drawable.getPbufferHandle(), WGLExt.WGL_FRONT_LEFT_ARB)) {
throw new GLException("Binding of pbuffer to texture failed: " + wglGetLastError());
}
}
@@ -84,18 +84,15 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
}
if (rtt && hasRTT) {
WGLExt wglExt = getWGLExt();
- if (!wglExt.wglReleaseTexImageARB(drawable.getPbuffer(), WGLExt.WGL_FRONT_LEFT_ARB)) {
+ if (!wglExt.wglReleaseTexImageARB(drawable.getPbufferHandle(), WGLExt.WGL_FRONT_LEFT_ARB)) {
throw new GLException("Releasing of pbuffer from texture failed: " + wglGetLastError());
}
}
}
- protected int makeCurrentImpl() throws GLException {
- int res = super.makeCurrentImpl();
- if (DEBUG && VERBOSE) {
- System.err.println("WindowsPbufferWGLContext: super.makeCurrentImpl() = " + res);
- }
- if (res == CONTEXT_CURRENT_NEW) {
+ protected void makeCurrentImpl(boolean newCreated) throws GLException {
+ super.makeCurrentImpl(newCreated);
+ if (newCreated) {
GLCapabilities capabilities = drawable.getChosenGLCapabilities();
// Initialize render-to-texture support if requested
@@ -142,7 +139,6 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
}
}
}
- return res;
}
public int getFloatingPointMode() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
index c7034e93b..c8c62914a 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -89,18 +89,21 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
// not be called here, so we skip the use of any composable
// pipelines (see WindowsOnscreenWGLContext.makeCurrentImpl)
if (wglExt.wglReleasePbufferDCARB(buffer, nw.getSurfaceHandle()) == 0) {
- throw new GLException("Error releasing pbuffer device context: error code " + WGL.GetLastError());
+ throw new GLException("Error releasing pbuffer device context: error code " + GDI.GetLastError());
}
((SurfaceChangeable)nw).setSurfaceHandle(0);
}
if (!wglExt.wglDestroyPbufferARB(buffer)) {
- throw new GLException("Error destroying pbuffer: error code " + WGL.GetLastError());
+ throw new GLException("Error destroying pbuffer: error code " + GDI.GetLastError());
}
buffer = 0;
}
}
- public long getPbuffer() {
+ public long getPbufferHandle() {
+ // The actual to-be-used handle for makeCurrent etc,
+ // is the derived DC, set in the NativeWindow surfaceHandle
+ // returned by getHandle().
return buffer;
}
@@ -293,7 +296,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
if (wglExt.wglGetPixelFormatAttribivARB(parentHdc, pformats[whichFormat], 0, niattribs, iattributes, 0, ivalues, 0)) {
GLCapabilities newCaps = WindowsWGLGraphicsConfiguration.AttribList2GLCapabilities(glProfile, iattributes, niattribs, ivalues, true, false, true);
PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor();
- if (WGL.DescribePixelFormat(parentHdc, pformats[whichFormat], pfd.size(), pfd) == 0) {
+ if (GDI.DescribePixelFormat(parentHdc, pformats[whichFormat], pfd.size(), pfd) == 0) {
if (DEBUG) {
System.err.println("Unable to describe pixel format (Continue: true) " + whichFormat + "/" + nformats + " pfdID " + pformats[whichFormat]+":\n\t"+newCaps);
}
@@ -304,7 +307,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
config.setCapsPFD(newCaps, pfd, pformats[whichFormat], true);
} else {
PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor();
- if (WGL.DescribePixelFormat(parentHdc, pformats[whichFormat], pfd.size(), pfd) == 0) {
+ if (GDI.DescribePixelFormat(parentHdc, pformats[whichFormat], pfd.size(), pfd) == 0) {
throw new GLException("Unable to describe pixel format " + pformats[whichFormat]);
}
GLCapabilities newCaps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(glProfile, pfd, false, true);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
index 3ecd3bdbc..33f1bc829 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
@@ -51,8 +51,7 @@ public class WindowsWGLContext extends GLContextImpl {
private boolean wglGetExtensionsStringEXTInitialized;
private boolean wglGetExtensionsStringEXTAvailable;
private boolean wglMakeContextCurrentInitialized;
- private boolean wglMakeContextCurrentARBAvailable;
- private boolean wglMakeContextCurrentEXTAvailable;
+ private boolean wglMakeContextCurrentAvailable;
private static final Map/*<String, String>*/ functionNameMap;
private static final Map/*<String, String>*/ extensionNameMap;
private WGLExt wglExt;
@@ -95,17 +94,14 @@ public class WindowsWGLContext extends GLContextImpl {
public boolean wglMakeContextCurrent(long hDrawDC, long hReadDC, long ctx) {
WGLExt wglExt = getWGLExt();
if (!wglMakeContextCurrentInitialized) {
- wglMakeContextCurrentARBAvailable = isFunctionAvailable("wglMakeContextCurrentARB");
- wglMakeContextCurrentEXTAvailable = isFunctionAvailable("wglMakeContextCurrentEXT");
+ wglMakeContextCurrentAvailable = isFunctionAvailable("wglMakeContextCurrent");
wglMakeContextCurrentInitialized = true;
if(DEBUG) {
- System.err.println("WindowsWGLContext.wglMakeContextCurrent: ARB "+wglMakeContextCurrentARBAvailable+", EXT "+wglMakeContextCurrentEXTAvailable);
+ System.err.println("WindowsWGLContext.wglMakeContextCurrent: "+wglMakeContextCurrentAvailable);
}
}
- if(wglMakeContextCurrentARBAvailable) {
- return wglExt.wglMakeContextCurrentARB(hDrawDC, hReadDC, ctx);
- } else if(wglMakeContextCurrentEXTAvailable) {
- return wglExt.wglMakeContextCurrentEXT(hDrawDC, hReadDC, ctx);
+ if(wglMakeContextCurrentAvailable) {
+ return wglExt.wglMakeContextCurrent(hDrawDC, hReadDC, ctx);
}
return WGL.wglMakeCurrent(hDrawDC, ctx);
}
@@ -174,7 +170,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
}
- ctx = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), share, attribs, 0);
+ ctx = wglExt.wglCreateContextAttribsARB(drawable.getHandle(), share, attribs, 0);
if(DEBUG) {
System.err.println("WindowsWGLContext.createContextARB success: "+(0!=ctx)+" - "+getGLVersion(major, minor, ctp, "@creation")+", bwdCompat "+ctBwdCompat+", fwdCompat "+ctFwdCompat);
}
@@ -182,7 +178,7 @@ public class WindowsWGLContext extends GLContextImpl {
// In contrast to GLX no verification with a drawable binding, ie default framebuffer, is necessary,
// if no 3.2 is available creation fails already!
// Nevertheless .. we do it ..
- if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), ctx)) {
+ if (!WGL.wglMakeCurrent(drawable.getHandle(), ctx)) {
if(DEBUG) {
System.err.println("WindowsWGLContext.createContextARB couldn't make current "+getGLVersion(major, minor, ctp, "@creation"));
}
@@ -198,10 +194,7 @@ public class WindowsWGLContext extends GLContextImpl {
* Creates and initializes an appropriate OpenGL context. Should only be
* called by {@link #makeCurrentImpl()}.
*/
- protected void create() {
- if(0!=contextHandle) {
- throw new GLException("context is not null: "+contextHandle);
- }
+ protected boolean createImpl() {
WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl();
GLCapabilities glCaps = drawable.getChosenGLCapabilities();
@@ -233,18 +226,18 @@ public class WindowsWGLContext extends GLContextImpl {
if(0==contextHandle) {
// To use WGL_ARB_create_context, we have to make a temp context current,
// so we are able to use GetProcAddress
- temp_ctx = WGL.wglCreateContext(drawable.getNativeWindow().getSurfaceHandle());
+ temp_ctx = WGL.wglCreateContext(drawable.getHandle());
if (temp_ctx == 0) {
- throw new GLException("Unable to create temp OpenGL context for device context " + toHexString(drawable.getNativeWindow().getSurfaceHandle()));
+ throw new GLException("Unable to create temp OpenGL context for device context " + toHexString(drawable.getHandle()));
}
- if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), temp_ctx)) {
- throw new GLException("Error making temp context current: 0x" + toHexString(temp_ctx) + ", werr: 0x"+Integer.toHexString(WGL.GetLastError()));
+ if (!WGL.wglMakeCurrent(drawable.getHandle(), temp_ctx)) {
+ throw new GLException("Error making temp context current: 0x" + toHexString(temp_ctx) + ", werr: 0x"+Integer.toHexString(GDI.GetLastError()));
}
setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
if( createContextARBTried ||
- !isFunctionAvailable("wglCreateContextAttribsARB") /* ||
- !isExtensionAvailable("WGL_ARB_create_context") */ ) { // unresolved case where client version is 1.4 without this extension
+ !isFunctionAvailable("wglCreateContextAttribsARB") ||
+ !isExtensionAvailable("WGL_ARB_create_context") ) {
if(glCaps.getGLProfile().isGL3()) {
WGL.wglMakeCurrent(0, 0);
WGL.wglDeleteContext(temp_ctx);
@@ -253,7 +246,8 @@ public class WindowsWGLContext extends GLContextImpl {
// continue with temp context for GL < 3.0
contextHandle = temp_ctx;
- return;
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
+ return true;
}
contextHandle = createContextARB(share, true, major, minor, ctp);
createContextARBTried=true;
@@ -265,8 +259,8 @@ public class WindowsWGLContext extends GLContextImpl {
WGL.wglMakeCurrent(0, 0);
WGL.wglDeleteContext(temp_ctx);
- if (!wglMakeContextCurrent(drawable.getNativeWindow().getSurfaceHandle(), drawableRead.getNativeWindow().getSurfaceHandle(), contextHandle)) {
- throw new GLException("Cannot make previous verified context current: 0x" + toHexString(contextHandle) + ", werr: 0x" + Integer.toHexString(WGL.GetLastError()));
+ if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
+ throw new GLException("Cannot make previous verified context current: 0x" + toHexString(contextHandle) + ", werr: 0x" + Integer.toHexString(GDI.GetLastError()));
}
} else {
if(glCaps.getGLProfile().isGL3()) {
@@ -280,10 +274,10 @@ public class WindowsWGLContext extends GLContextImpl {
// continue with temp context for GL < 3.0
contextHandle = temp_ctx;
- if (!wglMakeContextCurrent(drawable.getNativeWindow().getSurfaceHandle(), drawableRead.getNativeWindow().getSurfaceHandle(), contextHandle)) {
+ if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
WGL.wglMakeCurrent(0, 0);
WGL.wglDeleteContext(contextHandle);
- throw new GLException("Error making old context current: 0x" + toHexString(contextHandle) + ", werr: 0x" + Integer.toHexString(WGL.GetLastError()));
+ throw new GLException("Error making old context current: 0x" + toHexString(contextHandle) + ", werr: 0x" + Integer.toHexString(GDI.GetLastError()));
}
}
@@ -291,78 +285,47 @@ public class WindowsWGLContext extends GLContextImpl {
if (!WGL.wglShareLists(share, contextHandle)) {
throw new GLException("wglShareLists(" + toHexString(share) +
", " + toHexString(contextHandle) + ") failed: werr 0x" +
- Integer.toHexString(WGL.GetLastError()));
+ Integer.toHexString(GDI.GetLastError()));
}
}
- GLContextShareSet.contextCreated(this);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
+ return true;
}
- protected int makeCurrentImpl() throws GLException {
- if (0 == drawable.getNativeWindow().getSurfaceHandle()) {
- throw new GLException("drawable has invalid surface handle: "+drawable);
- }
- boolean newCreated = false;
- if (!isCreated()) {
- create(); // throws exception if fails!
- newCreated = true;
- if (DEBUG) {
- System.err.println(getThreadName() + ": !!! Created GL context " + toHexString(contextHandle) + " for " + getClass().getName());
- }
- }
-
+ protected void makeCurrentImpl(boolean newCreated) throws GLException {
if (WGL.wglGetCurrentContext() != contextHandle) {
- if (!wglMakeContextCurrent(drawable.getNativeWindow().getSurfaceHandle(), drawableRead.getNativeWindow().getSurfaceHandle(), contextHandle)) {
- throw new GLException("Error making context current: 0x" + toHexString(contextHandle) + ", werr: 0x" + Integer.toHexString(WGL.GetLastError()) + ", " + this);
+ if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
+ throw new GLException("Error making context current: 0x" + toHexString(contextHandle) + ", werr: 0x" + Integer.toHexString(GDI.GetLastError()) + ", " + this);
} else {
if (DEBUG && VERBOSE) {
- System.err.println(getThreadName() + ": wglMakeCurrent(hdc " + toHexString(drawable.getNativeWindow().getSurfaceHandle()) +
+ System.err.println(getThreadName() + ": wglMakeCurrent(hdc " + toHexString(drawable.getHandle()) +
", contextHandle " + toHexString(contextHandle) + ") succeeded");
}
}
}
if (newCreated) {
- setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
-
WindowsWGLGraphicsConfiguration config =
(WindowsWGLGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
config.updateCapabilitiesByWGL(this);
-
- return CONTEXT_CURRENT_NEW;
}
- return CONTEXT_CURRENT;
}
protected void releaseImpl() throws GLException {
if (!wglMakeContextCurrent(0, 0, 0)) {
- throw new GLException("Error freeing OpenGL context, werr: 0x" + Integer.toHexString(WGL.GetLastError()));
+ throw new GLException("Error freeing OpenGL context, werr: 0x" + Integer.toHexString(GDI.GetLastError()));
}
}
protected void destroyImpl() throws GLException {
- if (DEBUG) {
- Exception e = new Exception(getThreadName() + ": !!! Destroyed OpenGL context " + toHexString(contextHandle));
- e.printStackTrace();
- }
- if (contextHandle != 0) {
+ WGL.wglMakeCurrent(0, 0);
if (!WGL.wglDeleteContext(contextHandle)) {
throw new GLException("Unable to delete OpenGL context");
}
- contextHandle = 0;
- GLContextShareSet.contextDestroyed(this);
- }
}
- public void copy(GLContext source, int mask) throws GLException {
- long dst = getHandle();
- long src = source.getHandle();
- if (src == 0) {
- throw new GLException("Source OpenGL context has not been created");
- }
- if (dst == 0) {
- throw new GLException("Destination OpenGL context has not been created");
- }
- if (!WGL.wglCopyContext(src, dst, mask)) {
+ protected void copyImpl(GLContext source, int mask) throws GLException {
+ if (!WGL.wglCopyContext(source.getHandle(), getHandle(), mask)) {
throw new GLException("wglCopyContext failed");
}
}
@@ -374,8 +337,7 @@ public class WindowsWGLContext extends GLContextImpl {
wglGetExtensionsStringEXTInitialized=false;
wglGetExtensionsStringEXTAvailable=false;
wglMakeContextCurrentInitialized=false;
- wglMakeContextCurrentARBAvailable=false;
- wglMakeContextCurrentEXTAvailable=false;
+ wglMakeContextCurrentAvailable=false;
if (wglExtProcAddressTable == null) {
// FIXME: cache ProcAddressTables by OpenGL context type bits so we can
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
index 274390b2c..b1bc9b5ce 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
@@ -64,62 +64,39 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
return; // nothing todo ..
}
- if(NativeWindow.LOCK_SURFACE_NOT_READY == lockSurface()) {
- throw new GLException("WindowsWGLDrawable.setRealized(true): lockSurface - surface not ready");
- }
- try {
- NativeWindow nativeWindow = getNativeWindow();
- WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)nativeWindow.getGraphicsConfiguration().getNativeGraphicsConfiguration();
- config.updateGraphicsConfiguration(getFactory(), nativeWindow);
- if (DEBUG) {
- System.err.println("!!! WindowsWGLDrawable.setRealized(true): "+config);
- }
- } finally {
- unlockSurface();
+ NativeWindow nativeWindow = getNativeWindow();
+ WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)nativeWindow.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ config.updateGraphicsConfiguration(getFactory(), nativeWindow);
+ if (DEBUG) {
+ System.err.println("!!! WindowsWGLDrawable.setRealized(true): "+config);
}
}
protected void swapBuffersImpl() {
- boolean didLock = false;
-
- if ( !isSurfaceLocked() ) {
- // Usually the surface shall be locked within [makeCurrent .. swap .. release]
- if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return;
- }
- didLock = true;
+ long startTime = 0;
+ if (PROFILING) {
+ startTime = System.currentTimeMillis();
}
- try {
- long startTime = 0;
- if (PROFILING) {
- startTime = System.currentTimeMillis();
- }
-
- if (!WGL.SwapBuffers(getNativeWindow().getSurfaceHandle()) && (WGL.GetLastError() != 0)) {
- throw new GLException("Error swapping buffers");
- }
+ if (!GDI.SwapBuffers(getHandle()) && (GDI.GetLastError() != 0)) {
+ throw new GLException("Error swapping buffers");
+ }
- if (PROFILING) {
- long endTime = System.currentTimeMillis();
- profilingSwapBuffersTime += (endTime - startTime);
- int ticks = PROFILING_TICKS;
- if (++profilingSwapBuffersTicks == ticks) {
- System.err.println("SwapBuffers calls: " + profilingSwapBuffersTime + " ms / " + ticks + " calls (" +
- ((float) profilingSwapBuffersTime / (float) ticks) + " ms/call)");
- profilingSwapBuffersTime = 0;
- profilingSwapBuffersTicks = 0;
- }
- }
- } finally {
- if (didLock) {
- unlockSurface();
- }
+ if (PROFILING) {
+ long endTime = System.currentTimeMillis();
+ profilingSwapBuffersTime += (endTime - startTime);
+ int ticks = PROFILING_TICKS;
+ if (++profilingSwapBuffersTicks == ticks) {
+ System.err.println("SwapBuffers calls: " + profilingSwapBuffersTime + " ms / " + ticks + " calls (" +
+ ((float) profilingSwapBuffersTime / (float) ticks) + " ms/call)");
+ profilingSwapBuffersTime = 0;
+ profilingSwapBuffersTicks = 0;
+ }
}
}
public GLDynamicLookupHelper getGLDynamicLookupHelper() {
- return WindowsWGLDynamicLookupHelper.getWindowsWGLDynamicLookupHelper();
+ return getFactoryImpl().getGLDynamicLookupHelper(0);
}
protected static String getThreadName() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
index 8072ad2de..3fbe769e5 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -52,8 +52,25 @@ import com.jogamp.nativewindow.impl.NullWindow;
public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
private static final boolean VERBOSE = Debug.verbose();
+ private static final DesktopGLDynamicLookupHelper windowsWGLDynamicLookupHelper;
+
+ static {
+ DesktopGLDynamicLookupHelper tmp = null;
+ try {
+ tmp = new DesktopGLDynamicLookupHelper(new WindowsWGLDynamicLibraryBundleInfo());
+ } catch (GLException gle) {
+ if(DEBUG) {
+ gle.printStackTrace();
+ }
+ }
+ windowsWGLDynamicLookupHelper = tmp;
+ if(null!=windowsWGLDynamicLookupHelper) {
+ WGL.getWGLProcAddressTable().reset(windowsWGLDynamicLookupHelper);
+ }
+ }
+
public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) {
- return WindowsWGLDynamicLookupHelper.getWindowsWGLDynamicLookupHelper();
+ return windowsWGLDynamicLookupHelper;
}
public WindowsWGLDrawableFactory() {
@@ -62,7 +79,6 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
new WindowsWGLGraphicsConfigurationFactory();
- WindowsWGLDynamicLookupHelper.getWindowsWGLDynamicLookupHelper(); // setup and load ..
try {
ReflectionUtil.createInstance("com.jogamp.opengl.impl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory",
new Object[] {});
@@ -190,14 +206,14 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
static String wglGetLastError() {
- long err = WGL.GetLastError();
+ long err = GDI.GetLastError();
String detail = null;
switch ((int) err) {
- case WGL.ERROR_INVALID_PIXEL_FORMAT: detail = "ERROR_INVALID_PIXEL_FORMAT"; break;
- case WGL.ERROR_NO_SYSTEM_RESOURCES: detail = "ERROR_NO_SYSTEM_RESOURCES"; break;
- case WGL.ERROR_INVALID_DATA: detail = "ERROR_INVALID_DATA"; break;
- case WGL.ERROR_PROC_NOT_FOUND: detail = "ERROR_PROC_NOT_FOUND"; break;
- case WGL.ERROR_INVALID_WINDOW_HANDLE:detail = "ERROR_INVALID_WINDOW_HANDLE"; break;
+ case GDI.ERROR_INVALID_PIXEL_FORMAT: detail = "ERROR_INVALID_PIXEL_FORMAT"; break;
+ case GDI.ERROR_NO_SYSTEM_RESOURCES: detail = "ERROR_NO_SYSTEM_RESOURCES"; break;
+ case GDI.ERROR_INVALID_DATA: detail = "ERROR_INVALID_DATA"; break;
+ case GDI.ERROR_PROC_NOT_FOUND: detail = "ERROR_PROC_NOT_FOUND"; break;
+ case GDI.ERROR_INVALID_WINDOW_HANDLE:detail = "ERROR_INVALID_WINDOW_HANDLE"; break;
default: detail = "(Unknown error code " + err + ")"; break;
}
return detail;
@@ -231,17 +247,17 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
rampData[i + 2 * GAMMA_RAMP_LENGTH] = scaledValue;
}
- long screenDC = WGL.GetDC(0);
- boolean res = WGL.SetDeviceGammaRamp(screenDC, ShortBuffer.wrap(rampData));
- WGL.ReleaseDC(0, screenDC);
+ long screenDC = GDI.GetDC(0);
+ boolean res = GDI.SetDeviceGammaRamp(screenDC, ShortBuffer.wrap(rampData));
+ GDI.ReleaseDC(0, screenDC);
return res;
}
protected Buffer getGammaRamp() {
ShortBuffer rampData = ShortBuffer.wrap(new short[3 * GAMMA_RAMP_LENGTH]);
- long screenDC = WGL.GetDC(0);
- boolean res = WGL.GetDeviceGammaRamp(screenDC, rampData);
- WGL.ReleaseDC(0, screenDC);
+ long screenDC = GDI.GetDC(0);
+ boolean res = GDI.GetDeviceGammaRamp(screenDC, rampData);
+ GDI.ReleaseDC(0, screenDC);
if (!res) {
return null;
}
@@ -253,8 +269,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
// getGammaRamp failed earlier
return;
}
- long screenDC = WGL.GetDC(0);
- WGL.SetDeviceGammaRamp(screenDC, originalGammaRamp);
- WGL.ReleaseDC(0, screenDC);
+ long screenDC = GDI.GetDC(0);
+ GDI.SetDeviceGammaRamp(screenDC, originalGammaRamp);
+ GDI.ReleaseDC(0, screenDC);
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
index d0b0acaa3..7bff1e3c1 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLookupHelper.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
@@ -35,57 +35,28 @@ import java.util.*;
import java.security.*;
import javax.media.opengl.GLException;
-public class WindowsWGLDynamicLookupHelper extends DesktopGLDynamicLookupHelper {
- private static final WindowsWGLDynamicLookupHelper windowsWGLDynamicLookupHelper;
-
- static {
- WindowsWGLDynamicLookupHelper tmp = null;
- try {
- tmp = new WindowsWGLDynamicLookupHelper();
- } catch (GLException gle) {
- if(DEBUG) {
- gle.printStackTrace();
- }
- }
- windowsWGLDynamicLookupHelper = tmp;
- }
-
- public static WindowsWGLDynamicLookupHelper getWindowsWGLDynamicLookupHelper() {
- return windowsWGLDynamicLookupHelper;
- }
-
- protected WindowsWGLDynamicLookupHelper() {
+public class WindowsWGLDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryBundleInfo {
+ protected WindowsWGLDynamicLibraryBundleInfo() {
super();
}
- public synchronized void loadGLULibrary() {
- if(null==gluLib) {
- List/*<String>*/ gluLibNames = new ArrayList();
- gluLibNames.add("GLU32");
- gluLib = loadFirstAvailable(gluLibNames, null, false);
- if(null != gluLib) {
- glLibraries.add(gluLib);
- }
- }
- }
- NativeLibrary gluLib = null;
+ public List getToolLibNames() {
+ List/*<String>*/ libNamesList = new ArrayList();
- protected final List/*<String>*/ getGLLibNames() {
- List/*<String>*/ glesLibNames = new ArrayList();
- glesLibNames.add("OpenGL32");
- return glesLibNames;
- }
+ libNamesList.add("OpenGL32");
- protected final List/*<String>*/ getGLXLibNames() {
- return null;
+ return libNamesList;
}
- protected final String getGLXGetProcAddressFuncName() {
- return "wglGetProcAddress" ;
+
+ public final List getToolGetProcAddressFuncNameList() {
+ List res = new ArrayList();
+ res.add("wglGetProcAddress");
+ return res;
}
- protected long dynamicLookupFunctionOnGLX(long glxGetProcAddressHandle, String glFuncName) {
- return WGL.wglGetProcAddress(glFuncName);
+ public final long toolDynamicLookupFunction(long toolGetProcAddressHandle, String funcName) {
+ return WGL.wglGetProcAddress(toolGetProcAddressHandle, funcName);
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index aed4012a4..eb5719566 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -67,7 +67,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
glp = GLProfile.getDefault();
}
PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor();
- if (WGL.DescribePixelFormat(hdc, pfdID, pfd.size(), pfd) == 0) {
+ if (GDI.DescribePixelFormat(hdc, pfdID, pfd.size(), pfd) == 0) {
throw new GLException("Unable to describe pixel format " + pfdID);
}
@@ -215,10 +215,10 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
}
} else {
- long lastErr = WGL.GetLastError();
+ long lastErr = GDI.GetLastError();
// Intel Extreme graphics fails with a zero error code
if (lastErr != 0) {
- throw new GLException("Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code " + WGL.GetLastError());
+ throw new GLException("Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code " + GDI.GetLastError());
}
}
return availableCaps;
@@ -539,7 +539,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
// PIXELFORMAT
public static GLCapabilities PFD2GLCapabilities(GLProfile glp, PIXELFORMATDESCRIPTOR pfd, boolean onscreen, boolean usePBuffer) {
- if ((pfd.getDwFlags() & WGL.PFD_SUPPORT_OPENGL) == 0) {
+ if ((pfd.getDwFlags() & GDI.PFD_SUPPORT_OPENGL) == 0) {
return null;
}
GLCapabilities res = new GLCapabilities(glp);
@@ -553,11 +553,11 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
res.setAccumAlphaBits(pfd.getCAccumAlphaBits());
res.setDepthBits (pfd.getCDepthBits());
res.setStencilBits (pfd.getCStencilBits());
- res.setDoubleBuffered((pfd.getDwFlags() & WGL.PFD_DOUBLEBUFFER) != 0);
- res.setStereo ((pfd.getDwFlags() & WGL.PFD_STEREO) != 0);
- res.setHardwareAccelerated( ((pfd.getDwFlags() & WGL.PFD_GENERIC_FORMAT) == 0) ||
- ((pfd.getDwFlags() & WGL.PFD_GENERIC_ACCELERATED) != 0) );
- res.setOnscreen ( onscreen && ((pfd.getDwFlags() & WGL.PFD_DRAW_TO_WINDOW) != 0) );
+ res.setDoubleBuffered((pfd.getDwFlags() & GDI.PFD_DOUBLEBUFFER) != 0);
+ res.setStereo ((pfd.getDwFlags() & GDI.PFD_STEREO) != 0);
+ res.setHardwareAccelerated( ((pfd.getDwFlags() & GDI.PFD_GENERIC_FORMAT) == 0) ||
+ ((pfd.getDwFlags() & GDI.PFD_GENERIC_ACCELERATED) != 0) );
+ res.setOnscreen ( onscreen && ((pfd.getDwFlags() & GDI.PFD_DRAW_TO_WINDOW) != 0) );
res.setPBuffer ( usePBuffer );
/* FIXME: Missing ??
if (GLXUtil.isMultisampleAvailable()) {
@@ -580,21 +580,21 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
throw new GLException("Bit depths < 15 (i.e., non-true-color) not supported");
}
PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor();
- int pfdFlags = (WGL.PFD_SUPPORT_OPENGL |
- WGL.PFD_GENERIC_ACCELERATED);
+ int pfdFlags = (GDI.PFD_SUPPORT_OPENGL |
+ GDI.PFD_GENERIC_ACCELERATED);
if (caps.getDoubleBuffered()) {
- pfdFlags |= WGL.PFD_DOUBLEBUFFER;
+ pfdFlags |= GDI.PFD_DOUBLEBUFFER;
}
if (caps.isOnscreen()) {
- pfdFlags |= WGL.PFD_DRAW_TO_WINDOW;
+ pfdFlags |= GDI.PFD_DRAW_TO_WINDOW;
} else {
- pfdFlags |= WGL.PFD_DRAW_TO_BITMAP;
+ pfdFlags |= GDI.PFD_DRAW_TO_BITMAP;
}
if (caps.getStereo()) {
- pfdFlags |= WGL.PFD_STEREO;
+ pfdFlags |= GDI.PFD_STEREO;
}
pfd.setDwFlags(pfdFlags);
- pfd.setIPixelType((byte) WGL.PFD_TYPE_RGBA);
+ pfd.setIPixelType((byte) GDI.PFD_TYPE_RGBA);
pfd.setCColorBits((byte) colorDepth);
pfd.setCRedBits ((byte) caps.getRedBits());
pfd.setCGreenBits((byte) caps.getGreenBits());
@@ -610,7 +610,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
pfd.setCAccumAlphaBits((byte) caps.getAccumAlphaBits());
pfd.setCDepthBits((byte) caps.getDepthBits());
pfd.setCStencilBits((byte) caps.getStencilBits());
- pfd.setILayerType((byte) WGL.PFD_MAIN_PLANE);
+ pfd.setILayerType((byte) GDI.PFD_MAIN_PLANE);
/* FIXME: Missing:
caps.getSampleBuffers()
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index ab3227257..e76e63f23 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -118,7 +118,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
GLCapabilities chosenCaps = null;
if (onscreen) {
- if ((pixelFormat = WGL.GetPixelFormat(hdc)) != 0) {
+ if ((pixelFormat = GDI.GetPixelFormat(hdc)) != 0) {
// Pixelformat already set by either
// - a previous updateGraphicsConfiguration() call on the same HDC,
// - the graphics driver, copying the HDC's pixelformat to the new one,
@@ -171,13 +171,13 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
} else {
if (DEBUG) {
- System.err.println(getThreadName() + ": wglChoosePixelFormatARB failed: " + WGL.GetLastError() );
+ System.err.println(getThreadName() + ": wglChoosePixelFormatARB failed: " + GDI.GetLastError() );
Thread.dumpStack();
}
}
if (DEBUG) {
if (recommendedPixelFormat <= 0) {
- System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format: "+WGL.GetLastError());
+ System.err.print(getThreadName() + ": wglChoosePixelFormatARB didn't recommend a pixel format: "+GDI.GetLastError());
if (capabilities.getSampleBuffers()) {
System.err.print(" for multisampled GLCapabilities");
}
@@ -200,23 +200,23 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
if (!gotAvailableCaps) {
if (DEBUG) {
- System.err.println(getThreadName() + ": Using ChoosePixelFormat ... (LastError: "+WGL.GetLastError()+")");
+ System.err.println(getThreadName() + ": Using ChoosePixelFormat ... (LastError: "+GDI.GetLastError()+")");
}
pfd = WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(capabilities);
- recommendedPixelFormat = WGL.ChoosePixelFormat(hdc, pfd);
+ recommendedPixelFormat = GDI.ChoosePixelFormat(hdc, pfd);
if (DEBUG) {
- System.err.println(getThreadName() + ": ChoosePixelFormat(HDC "+toHexString(hdc)+") = " + recommendedPixelFormat + " (LastError: "+WGL.GetLastError()+")");
+ System.err.println(getThreadName() + ": ChoosePixelFormat(HDC "+toHexString(hdc)+") = " + recommendedPixelFormat + " (LastError: "+GDI.GetLastError()+")");
System.err.println(getThreadName() + ": Used " + capabilities);
}
- numFormats = WGL.DescribePixelFormat(hdc, 1, 0, null);
+ numFormats = GDI.DescribePixelFormat(hdc, 1, 0, null);
if (numFormats == 0) {
throw new GLException("Unable to enumerate pixel formats of window " +
- toHexString(hdc) + " for GLCapabilitiesChooser (LastError: "+WGL.GetLastError()+")");
+ toHexString(hdc) + " for GLCapabilitiesChooser (LastError: "+GDI.GetLastError()+")");
}
availableCaps = new GLCapabilities[numFormats];
for (int i = 0; i < numFormats; i++) {
- if (WGL.DescribePixelFormat(hdc, 1 + i, pfd.size(), pfd) == 0) {
+ if (GDI.DescribePixelFormat(hdc, 1 + i, pfd.size(), pfd) == 0) {
throw new GLException("Error describing pixel format " + (1 + i) + " of device context");
}
availableCaps[i] = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(glProfile, pfd, onscreen, usePBuffer);
@@ -261,23 +261,23 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
System.err.println(getThreadName() + ": Chosen pixel format (" + pixelFormat + "):");
System.err.println(chosenCaps);
}
- if (WGL.DescribePixelFormat(hdc, pixelFormat, pfd.size(), pfd) == 0) {
- throw new GLException("Error re-describing the chosen pixel format: " + WGL.GetLastError());
+ if (GDI.DescribePixelFormat(hdc, pixelFormat, pfd.size(), pfd) == 0) {
+ throw new GLException("Error re-describing the chosen pixel format: " + GDI.GetLastError());
}
} else {
// For now, use ChoosePixelFormat for offscreen surfaces until
// we figure out how to properly choose an offscreen-
// compatible pixel format
pfd = WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(capabilities);
- pixelFormat = WGL.ChoosePixelFormat(hdc, pfd);
+ pixelFormat = GDI.ChoosePixelFormat(hdc, pfd);
}
if(!pixelFormatSet) {
- if (!WGL.SetPixelFormat(hdc, pixelFormat, pfd)) {
- long lastError = WGL.GetLastError();
+ if (!GDI.SetPixelFormat(hdc, pixelFormat, pfd)) {
+ long lastError = GDI.GetLastError();
if (DEBUG) {
System.err.println(getThreadName() + ": SetPixelFormat failed: current context = " + WGL.wglGetCurrentContext() +
", current DC = " + WGL.wglGetCurrentDC());
- System.err.println(getThreadName() + ": GetPixelFormat(hdc " + toHexString(hdc) + ") returns " + WGL.GetPixelFormat(hdc));
+ System.err.println(getThreadName() + ": GetPixelFormat(hdc " + toHexString(hdc) + ") returns " + GDI.GetPixelFormat(hdc));
}
throw new GLException("Unable to set pixel format " + pixelFormat + " for device context " + toHexString(hdc) + ": error code " + lastError);
}