summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build-jogl.xml9
-rw-r--r--make/build-nativewindow.xml19
-rw-r--r--make/config/jogl/wgl-win32.cfg5
-rwxr-xr-xmake/scripts/java-win64-dbg.bat7
-rw-r--r--make/stub_includes/win32/windows.h10
-rw-r--r--make/stub_includes/win32/wingdi.h165
-rw-r--r--make/stub_includes/win32/wingdi_types.h166
-rw-r--r--make/stub_includes/win32/winwgl.h11
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java95
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java1
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java10
15 files changed, 325 insertions, 203 deletions
diff --git a/make/build-jogl.xml b/make/build-jogl.xml
index 511f147be..7dff177b9 100644
--- a/make/build-jogl.xml
+++ b/make/build-jogl.xml
@@ -382,12 +382,6 @@
<!--property name="java.generate.skip" value="true"/-->
</target>
- <target name="java.generate.cleantemp">
- <delete includeEmptyDirs="true" quiet="true">
- <fileset dir="${tempdir}/gensrc" />
- </delete>
- </target>
-
<target name="java.generate.copy2temp">
<copy todir="${tempdir}">
<fileset dir="${build.jogl}"
@@ -990,8 +984,6 @@
- will be generated.
-->
<target name="java.compile.firstpass" depends="java.generate,java.generate.cg">
- <antcall target="java.generate.cleantemp" inheritRefs="true" />
-
<!-- Perform the first pass Java compile. -->
<javac destdir="${classes}"
includes="javax/media/opengl/fixedfunc/** javax/media/opengl/GLDrawableFactory.java javax/media/opengl/GLDrawable.java javax/media/opengl/GLContext.java javax/media/opengl/GL.java javax/media/opengl/GL2ES1.java javax/media/opengl/GL2ES2.java javax/media/opengl/GL2GL3.java javax/media/opengl/GL2.java javax/media/opengl/GLES1.java javax/media/opengl/GLES2.java javax/media/opengl/GL3.java javax/media/opengl/GL3bc.java javax/media/opengl/GL4.java javax/media/opengl/GL4bc.java"
@@ -1641,7 +1633,6 @@
-->
<target name="clean" description="Remove all build products" depends="declare.common">
<delete includeEmptyDirs="true" quiet="true">
- <fileset dir="${tempdir}" />
<fileset dir="${build.jogl}" />
<fileset dir="${javadoc}" />
<fileset dir="${javadoc.spec}" />
diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml
index 7a06cef31..98cd0befc 100644
--- a/make/build-nativewindow.xml
+++ b/make/build-nativewindow.xml
@@ -222,6 +222,7 @@
<target name="java.generate.windowlib" if="windowlib.os.cfg">
<echo message="Generating Windowing Lib implementation class" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes}/${window.os.system}/window-lib.c"
outputRootDir="${build.nativewindow}"
config="${windowlib.os.cfg}"
@@ -240,6 +241,7 @@
- handle different drives in an effective manner. -->
<echo message="Generating JAWT interface class" />
<echo message="java.home.dir=${java.home.dir}" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${jawt.platform.header}"
outputRootDir="${build.nativewindow}"
config="${jawt.cfg}"
@@ -272,6 +274,8 @@
<!-- Use the GlueGen task to generate the Java files -->
+ <antcall target="java.generate.cleantemp" inheritRefs="true" />
+
<echo message="Generating platform-specifics: X11" />
<antcall target="java.generate.platforms" inheritRefs="true">
<param name="window.os.system" value="x11"/>
@@ -887,11 +891,26 @@
-->
<target name="clean" description="Remove all build products" depends="declare.common">
<delete includeEmptyDirs="true" quiet="true">
+ <fileset dir="${tempdir}" />
<fileset dir="${build.nativewindow}" />
<fileset dir="${javadoc}" />
<fileset dir="${javadoc.spec}" />
<fileset dir="${javadoc.dev}" />
</delete>
+ <antcall target="java.generate.cleantemp" inheritRefs="true" />
+ </target>
+
+ <target name="java.generate.cleantemp">
+ <delete includeEmptyDirs="true" quiet="true">
+ <fileset dir="${tempdir}/gensrc" />
+ </delete>
+ </target>
+
+ <target name="java.generate.copy2temp">
+ <copy todir="${tempdir}">
+ <fileset dir="${build.nativewindow}"
+ includes="gensrc/classes/**" />
+ </copy>
</target>
<!-- ================================================================== -->
diff --git a/make/config/jogl/wgl-win32.cfg b/make/config/jogl/wgl-win32.cfg
index c7adffa7b..4d2fea5d0 100644
--- a/make/config/jogl/wgl-win32.cfg
+++ b/make/config/jogl/wgl-win32.cfg
@@ -3,6 +3,8 @@
JavaOutputDir gensrc/classes
NativeOutputDir gensrc/native/jogl/Windows
+ExtendedInterfaceSymbolsIgnore ../build-temp/gensrc/classes/jogamp/nativewindow/windows/GDI.java
+
Package jogamp.opengl.windows.wgl
JavaClass WGL
Style AllStatic
@@ -21,6 +23,9 @@ EmitProcAddressTable true
ProcAddressTableClassName WGLProcAddressTable
GetProcAddressTableExpr wglProcAddressTable
+Ignore PIXELFORMATDESCRIPTOR
+
+Import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR
Import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver
CustomJavaCode WGL private static WGLProcAddressTable wglProcAddressTable = new WGLProcAddressTable(new GLProcAddressResolver());
diff --git a/make/scripts/java-win64-dbg.bat b/make/scripts/java-win64-dbg.bat
index 802c011cf..5686224d5 100755
--- a/make/scripts/java-win64-dbg.bat
+++ b/make/scripts/java-win64-dbg.bat
@@ -20,8 +20,9 @@ REM set D_ARGS="-Djogamp.debug.JNILibLoader=true" "-Djogamp.debug.NativeLibrary=
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.Lock" "-Djogamp.debug.Lock.TraceLock"
REM set D_ARGS="-Djogl.debug=all" "-Dnativewindow.debug=all"
REM set D_ARGS="-Djogl.debug=all"
-REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceLock" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
-set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceLock"
+REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
+REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.windows.useWGLVersionOf5WGLGDIFuncSet"
+set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch"
REM set D_ARGS="-Dnewt.debug.Window"
REM set D_ARGS="-Djogl.debug.GLDebugMessageHandler" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
REM set D_ARGS="-Djogl.debug.DebugGL" "-Djogl.debug.GLDebugMessageHandler" "-Djogl.debug.GLSLCode"
@@ -33,6 +34,6 @@ REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display" "-Dnewt.debug.EDT" "
REM set D_ARGS="-Dnewt.debug.Screen" "-Dnewt.debug.EDT" "-Dnativewindow.debug=all"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display" "-Dnewt.test.Window.reparent.incompatible=true"
-set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true"
+REM set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.java2d.opengl=true" "-Dsun.awt.noerasebackground=true"
%J2RE_HOME%\bin\java -classpath %CP_ALL% "-Djava.library.path=%LIB_DIR%" %D_ARGS% %X_ARGS% %* > java-win64-dbg.log 2>&1
diff --git a/make/stub_includes/win32/windows.h b/make/stub_includes/win32/windows.h
index f2f3900ba..51ebbdcce 100644
--- a/make/stub_includes/win32/windows.h
+++ b/make/stub_includes/win32/windows.h
@@ -47,13 +47,3 @@ typedef HANDLE HPBUFFERARB;
typedef HANDLE HPBUFFEREXT;
typedef HANDLE HGPUNV;
-typedef struct tagRECT {
- LONG left;
- LONG top;
- LONG right;
- LONG bottom;
-} RECT;
-
-typedef RECT* PRECT;
-typedef RECT* LPRECT;
-
diff --git a/make/stub_includes/win32/wingdi.h b/make/stub_includes/win32/wingdi.h
index b02512cfd..2d3e33275 100644
--- a/make/stub_includes/win32/wingdi.h
+++ b/make/stub_includes/win32/wingdi.h
@@ -6,177 +6,24 @@
* This file has no copyright assigned and is placed in the Public Domain.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*
- * Editions / Removals and a split (wingdi.h -> wingdi.h + winwgl.h) were made by the JogAmp Community, 2010
+ * Editions / Removals and a split (wingdi.h -> wingdi.h + wingdi_types.h + winwgl.h) were made by the JogAmp Community, 2010, 2012
*/
-#ifndef WGL_GDI_VERSION_1_X
+#include "wingdi_types.h"
-typedef struct tagRGBQUAD {
- BYTE rgbBlue;
- BYTE rgbGreen;
- BYTE rgbRed;
- BYTE rgbReserved;
-} RGBQUAD;
-
-typedef RGBQUAD *LPRGBQUAD;
-
-typedef struct tagBITMAPINFOHEADER {
- DWORD biSize;
- LONG biWidth;
- LONG biHeight;
- WORD biPlanes;
- WORD biBitCount;
- DWORD biCompression;
- DWORD biSizeImage;
- LONG biXPelsPerMeter;
- LONG biYPelsPerMeter;
- DWORD biClrUsed;
- DWORD biClrImportant;
-} BITMAPINFOHEADER,*LPBITMAPINFOHEADER,*PBITMAPINFOHEADER;
-
-typedef struct tagBITMAPINFO {
- BITMAPINFOHEADER bmiHeader;
- RGBQUAD bmiColors[1];
-} BITMAPINFO,*LPBITMAPINFO,*PBITMAPINFO;
-
-/* constants for the biCompression field */
-#define BI_RGB 0
-#define BI_RLE8 1
-#define BI_RLE4 2
-#define BI_BITFIELDS 3
-
-/* DIB color table identifiers */
-
-#define DIB_RGB_COLORS 0 /* color table in RGBs */
-#define DIB_PAL_COLORS 1 /* color table in palette indices */
-
-typedef struct tagPIXELFORMATDESCRIPTOR {
- WORD nSize;
- WORD nVersion;
- DWORD dwFlags;
- BYTE iPixelType;
- BYTE cColorBits;
- BYTE cRedBits;
- BYTE cRedShift;
- BYTE cGreenBits;
- BYTE cGreenShift;
- BYTE cBlueBits;
- BYTE cBlueShift;
- BYTE cAlphaBits;
- BYTE cAlphaShift;
- BYTE cAccumBits;
- BYTE cAccumRedBits;
- BYTE cAccumGreenBits;
- BYTE cAccumBlueBits;
- BYTE cAccumAlphaBits;
- BYTE cDepthBits;
- BYTE cStencilBits;
- BYTE cAuxBuffers;
- BYTE iLayerType;
- BYTE bReserved;
- DWORD dwLayerMask;
- DWORD dwVisibleMask;
- DWORD dwDamageMask;
-} PIXELFORMATDESCRIPTOR,*PPIXELFORMATDESCRIPTOR,*LPPIXELFORMATDESCRIPTOR;
-
-#define PFD_TYPE_RGBA 0
-#define PFD_TYPE_COLORINDEX 1
-
-#define PFD_MAIN_PLANE 0
-#define PFD_OVERLAY_PLANE 1
-#define PFD_UNDERLAY_PLANE (-1)
-
-#define PFD_DOUBLEBUFFER 0x00000001
-#define PFD_STEREO 0x00000002
-#define PFD_DRAW_TO_WINDOW 0x00000004
-#define PFD_DRAW_TO_BITMAP 0x00000008
-#define PFD_SUPPORT_GDI 0x00000010
-#define PFD_SUPPORT_OPENGL 0x00000020
-#define PFD_GENERIC_FORMAT 0x00000040
-#define PFD_NEED_PALETTE 0x00000080
-#define PFD_NEED_SYSTEM_PALETTE 0x00000100
-#define PFD_SWAP_EXCHANGE 0x00000200
-#define PFD_SWAP_COPY 0x00000400
-#define PFD_SWAP_LAYER_BUFFERS 0x00000800
-#define PFD_GENERIC_ACCELERATED 0x00001000
-#define PFD_SUPPORT_DIRECTDRAW 0x00002000
-
-#define PFD_DEPTH_DONTCARE 0x20000000
-#define PFD_DOUBLEBUFFER_DONTCARE 0x40000000
-#define PFD_STEREO_DONTCARE 0x80000000
-
-/* error codes (from winerror.h) */
-/* FIXME: these should have a trailing "L" but apparently PCPP doesn't handle that syntax */
-#define ERROR_SUCCESS 0
-#define ERROR_INVALID_PIXEL_FORMAT 2000
-#define ERROR_NO_SYSTEM_RESOURCES 1450
-#define ERROR_INVALID_DATA 13
-#define ERROR_PROC_NOT_FOUND 127
-#define ERROR_INVALID_WINDOW_HANDLE 1400
-
-/*
- * ShowWindow() Commands
- */
-#define SW_HIDE 0
-#define SW_SHOWNORMAL 1
-#define SW_NORMAL 1
-#define SW_SHOWMINIMIZED 2
-#define SW_SHOWMAXIMIZED 3
-#define SW_MAXIMIZE 3
-#define SW_SHOWNOACTIVATE 4
-#define SW_SHOW 5
-#define SW_MINIMIZE 6
-#define SW_SHOWMINNOACTIVE 7
-#define SW_SHOWNA 8
-#define SW_RESTORE 9
-#define SW_SHOWDEFAULT 10
-#define SW_FORCEMINIMIZE 11
-#define SW_MAX 11
-
-/**
- * GetObjectType() Command
- */
-#define OBJ_PEN 1
-#define OBJ_BRUSH 2
-#define OBJ_DC 3
-#define OBJ_METADC 4
-#define OBJ_PAL 5
-#define OBJ_FONT 6
-#define OBJ_BITMAP 7
-#define OBJ_REGION 8
-#define OBJ_METAFILE 9
-#define OBJ_MEMDC 10
-#define OBJ_EXTPEN 11
-#define OBJ_ENHMETADC 12
-#define OBJ_ENHMETAFILE 13
-#define OBJ_COLORSPACE 14
-
-#endif /* WGL_GDI_VERSION_1_X */
-
-#ifndef WGL_GDI_VERSION_1_X
-#define WGL_GDI_VERSION_1_X
+#ifndef GDI_VERSION_1_X
+#define GDI_VERSION_1_X
// Windows routines
WINBASEAPI DWORD WINAPI GetLastError(VOID);
-// OpenGL-related routines
+// GDI / ICD OpenGL-related routines
WINGDIAPI int WINAPI ChoosePixelFormat(HDC, CONST PIXELFORMATDESCRIPTOR *);
WINGDIAPI int WINAPI DescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
WINGDIAPI int WINAPI GetPixelFormat(HDC);
WINGDIAPI BOOL WINAPI SetPixelFormat(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
WINGDIAPI BOOL WINAPI SwapBuffers(HDC);
-/* --- FIXME: need to handle these entry points!
-WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC, int);
-WINGDIAPI BOOL WINAPI wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD);
-WINGDIAPI BOOL WINAPI wglUseFontBitmapsW(HDC, DWORD, DWORD, DWORD);
-#ifdef UNICODE
-#define wglUseFontBitmaps wglUseFontBitmapsW
-#else
-#define wglUseFontBitmaps wglUseFontBitmapsA
-#endif // !UNICODE
-*/
-
// Routines related to bitmap creation for off-screen rendering
WINGDIAPI HDC WINAPI CreateCompatibleDC(HDC);
WINGDIAPI HBITMAP WINAPI CreateDIBSection(HDC, CONST BITMAPINFO *, UINT, VOID **, HANDLE, DWORD);
@@ -207,5 +54,5 @@ WINUSERAPI BOOL WINAPI SetProcessAffinityMask(HANDLE hProcess,DWORD_PTR dwProces
WINGDIAPI BOOL WINAPI GetDeviceGammaRamp(HDC,LPVOID);
WINGDIAPI BOOL WINAPI SetDeviceGammaRamp(HDC,LPVOID);
-#endif /* WGL_GDI_VERSION_1_X */
+#endif /* GDI_VERSION_1_X */
diff --git a/make/stub_includes/win32/wingdi_types.h b/make/stub_includes/win32/wingdi_types.h
new file mode 100644
index 000000000..d23502cad
--- /dev/null
+++ b/make/stub_includes/win32/wingdi_types.h
@@ -0,0 +1,166 @@
+/**
+ *
+ * This file is derived from w64 mingw-runtime package's mingw64/x86_64-w64-mingw32/include/wingdi.h file
+ * and states:
+ *
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ *
+ * Editions / Removals and a split (wingdi.h -> wingdi.h + wingdi_types.h + winwgl.h) were made by the JogAmp Community, 2010, 2012
+ */
+
+#ifndef GDI_VERSION_1_X
+
+typedef struct tagRECT {
+ LONG left;
+ LONG top;
+ LONG right;
+ LONG bottom;
+} RECT;
+
+typedef RECT* PRECT;
+typedef RECT* LPRECT;
+
+typedef struct tagRGBQUAD {
+ BYTE rgbBlue;
+ BYTE rgbGreen;
+ BYTE rgbRed;
+ BYTE rgbReserved;
+} RGBQUAD;
+
+typedef RGBQUAD *LPRGBQUAD;
+
+typedef struct tagBITMAPINFOHEADER {
+ DWORD biSize;
+ LONG biWidth;
+ LONG biHeight;
+ WORD biPlanes;
+ WORD biBitCount;
+ DWORD biCompression;
+ DWORD biSizeImage;
+ LONG biXPelsPerMeter;
+ LONG biYPelsPerMeter;
+ DWORD biClrUsed;
+ DWORD biClrImportant;
+} BITMAPINFOHEADER,*LPBITMAPINFOHEADER,*PBITMAPINFOHEADER;
+
+typedef struct tagBITMAPINFO {
+ BITMAPINFOHEADER bmiHeader;
+ RGBQUAD bmiColors[1];
+} BITMAPINFO,*LPBITMAPINFO,*PBITMAPINFO;
+
+/* constants for the biCompression field */
+#define BI_RGB 0
+#define BI_RLE8 1
+#define BI_RLE4 2
+#define BI_BITFIELDS 3
+
+/* DIB color table identifiers */
+
+#define DIB_RGB_COLORS 0 /* color table in RGBs */
+#define DIB_PAL_COLORS 1 /* color table in palette indices */
+
+typedef struct tagPIXELFORMATDESCRIPTOR {
+ WORD nSize;
+ WORD nVersion;
+ DWORD dwFlags;
+ BYTE iPixelType;
+ BYTE cColorBits;
+ BYTE cRedBits;
+ BYTE cRedShift;
+ BYTE cGreenBits;
+ BYTE cGreenShift;
+ BYTE cBlueBits;
+ BYTE cBlueShift;
+ BYTE cAlphaBits;
+ BYTE cAlphaShift;
+ BYTE cAccumBits;
+ BYTE cAccumRedBits;
+ BYTE cAccumGreenBits;
+ BYTE cAccumBlueBits;
+ BYTE cAccumAlphaBits;
+ BYTE cDepthBits;
+ BYTE cStencilBits;
+ BYTE cAuxBuffers;
+ BYTE iLayerType;
+ BYTE bReserved;
+ DWORD dwLayerMask;
+ DWORD dwVisibleMask;
+ DWORD dwDamageMask;
+} PIXELFORMATDESCRIPTOR,*PPIXELFORMATDESCRIPTOR,*LPPIXELFORMATDESCRIPTOR;
+
+#define PFD_TYPE_RGBA 0
+#define PFD_TYPE_COLORINDEX 1
+
+#define PFD_MAIN_PLANE 0
+#define PFD_OVERLAY_PLANE 1
+#define PFD_UNDERLAY_PLANE (-1)
+
+#define PFD_DOUBLEBUFFER 0x00000001
+#define PFD_STEREO 0x00000002
+#define PFD_DRAW_TO_WINDOW 0x00000004
+#define PFD_DRAW_TO_BITMAP 0x00000008
+#define PFD_SUPPORT_GDI 0x00000010
+#define PFD_SUPPORT_OPENGL 0x00000020
+#define PFD_GENERIC_FORMAT 0x00000040
+#define PFD_NEED_PALETTE 0x00000080
+#define PFD_NEED_SYSTEM_PALETTE 0x00000100
+#define PFD_SWAP_EXCHANGE 0x00000200
+#define PFD_SWAP_COPY 0x00000400
+#define PFD_SWAP_LAYER_BUFFERS 0x00000800
+#define PFD_GENERIC_ACCELERATED 0x00001000
+#define PFD_SUPPORT_DIRECTDRAW 0x00002000
+
+#define PFD_DEPTH_DONTCARE 0x20000000
+#define PFD_DOUBLEBUFFER_DONTCARE 0x40000000
+#define PFD_STEREO_DONTCARE 0x80000000
+
+/* error codes (from winerror.h) */
+/* FIXME: these should have a trailing "L" but apparently PCPP doesn't handle that syntax */
+#define ERROR_SUCCESS 0
+#define ERROR_INVALID_PIXEL_FORMAT 2000
+#define ERROR_NO_SYSTEM_RESOURCES 1450
+#define ERROR_INVALID_DATA 13
+#define ERROR_PROC_NOT_FOUND 127
+#define ERROR_INVALID_WINDOW_HANDLE 1400
+
+/*
+ * ShowWindow() Commands
+ */
+#define SW_HIDE 0
+#define SW_SHOWNORMAL 1
+#define SW_NORMAL 1
+#define SW_SHOWMINIMIZED 2
+#define SW_SHOWMAXIMIZED 3
+#define SW_MAXIMIZE 3
+#define SW_SHOWNOACTIVATE 4
+#define SW_SHOW 5
+#define SW_MINIMIZE 6
+#define SW_SHOWMINNOACTIVE 7
+#define SW_SHOWNA 8
+#define SW_RESTORE 9
+#define SW_SHOWDEFAULT 10
+#define SW_FORCEMINIMIZE 11
+#define SW_MAX 11
+
+/**
+ * GetObjectType() Command
+ */
+#define OBJ_PEN 1
+#define OBJ_BRUSH 2
+#define OBJ_DC 3
+#define OBJ_METADC 4
+#define OBJ_PAL 5
+#define OBJ_FONT 6
+#define OBJ_BITMAP 7
+#define OBJ_REGION 8
+#define OBJ_METAFILE 9
+#define OBJ_MEMDC 10
+#define OBJ_EXTPEN 11
+#define OBJ_ENHMETADC 12
+#define OBJ_ENHMETAFILE 13
+#define OBJ_COLORSPACE 14
+
+#endif /* GDI_VERSION_1_X */
+
+
diff --git a/make/stub_includes/win32/winwgl.h b/make/stub_includes/win32/winwgl.h
index 5e9cc2fa0..c0dfb9bdb 100644
--- a/make/stub_includes/win32/winwgl.h
+++ b/make/stub_includes/win32/winwgl.h
@@ -6,9 +6,11 @@
* This file has no copyright assigned and is placed in the Public Domain.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*
- * Editions / Removals and a split (wingdi.h -> wingdi.h + winwgl.h) were made by the JogAmp Community, 2010
+ * Editions / Removals and a split (wingdi.h -> wingdi.h + wingdi_types.h + winwgl.h) were made by the JogAmp Community, 2010, 2012
*/
+#include "wingdi_types.h"
+
#ifndef WGL_GDI_VERSION_1_X
/* layer types */
@@ -59,6 +61,13 @@ WINGDIAPI BOOL WINAPI wglShareLists(HGLRC, HGLRC);
WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR);
WINGDIAPI BOOL WINAPI wglSwapLayerBuffers(HDC,UINT);
+// Runtime Link GDI/OpenGL-related routines
+WINGDIAPI int WINAPI wglChoosePixelFormat(HDC, CONST PIXELFORMATDESCRIPTOR *);
+WINGDIAPI int WINAPI wglDescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
+WINGDIAPI int WINAPI wglGetPixelFormat(HDC);
+WINGDIAPI BOOL WINAPI wglSetPixelFormat(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
+WINGDIAPI BOOL WINAPI wglSwapBuffers(HDC);
+
/* --- FIXME: need to handle these entry points!
WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC, int);
WINGDIAPI BOOL WINAPI wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD);
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java
new file mode 100644
index 000000000..845d749ba
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright 2012 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package jogamp.opengl.windows.wgl;
+
+import java.security.AccessController;
+
+import jogamp.nativewindow.windows.GDI;
+import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR;
+import jogamp.opengl.Debug;
+
+public class WGLUtil {
+ /**
+ * Switch to use the <code>wgl</code> variants of {@link jogamp.opengl.windows.wgl.WGL}
+ * to replace the following 5 GDI based functions (see below).
+ * <p>
+ * Disabled per default.
+ * </p>
+ * <p>
+ * You can enable it by defining the property <code>jogl.windows.useWGLVersionOf5WGLGDIFuncSet</code>.
+ * </p>
+ *
+ * @see jogamp.nativewindow.windows.GDI#ChoosePixelFormat(long, PIXELFORMATDESCRIPTOR)
+ * @see jogamp.nativewindow.windows.GDI#DescribePixelFormat(long, int, int, PIXELFORMATDESCRIPTOR)
+ * @see jogamp.nativewindow.windows.GDI#GetPixelFormat(long)
+ * @see jogamp.nativewindow.windows.GDI#SetPixelFormat(long, int, PIXELFORMATDESCRIPTOR)
+ * @see jogamp.nativewindow.windows.GDI#SwapBuffers(long)
+ */
+ public static final boolean USE_WGLVersion_Of_5WGLGDIFuncSet;
+
+ static {
+ USE_WGLVersion_Of_5WGLGDIFuncSet = Debug.isPropertyDefined("jogl.windows.useWGLVersionOf5WGLGDIFuncSet", true, AccessController.getContext());
+ System.err.println("USE_WGLVersion_Of_5WGLGDIFuncSet: "+USE_WGLVersion_Of_5WGLGDIFuncSet);
+ }
+
+ public static int ChoosePixelFormat(long hdc, PIXELFORMATDESCRIPTOR pfd) {
+ if(USE_WGLVersion_Of_5WGLGDIFuncSet) {
+ return WGL.wglChoosePixelFormat(hdc, pfd);
+ } else {
+ return GDI.ChoosePixelFormat(hdc, pfd);
+ }
+ }
+ public static int DescribePixelFormat(long hdc, int pfdid, int pfdSize, PIXELFORMATDESCRIPTOR pfd) {
+ if(USE_WGLVersion_Of_5WGLGDIFuncSet) {
+ return WGL.wglDescribePixelFormat(hdc, pfdid, pfdSize, pfd);
+ } else {
+ return GDI.DescribePixelFormat(hdc, pfdid, pfdSize, pfd);
+ }
+ }
+ public static int GetPixelFormat(long hdc) {
+ if(USE_WGLVersion_Of_5WGLGDIFuncSet) {
+ return WGL.wglGetPixelFormat(hdc);
+ } else {
+ return GDI.GetPixelFormat(hdc);
+ }
+ }
+ public static boolean SetPixelFormat(long hdc, int pfdid, PIXELFORMATDESCRIPTOR pfd) {
+ if(USE_WGLVersion_Of_5WGLGDIFuncSet) {
+ return WGL.wglSetPixelFormat(hdc, pfdid, pfd);
+ } else {
+ return GDI.SetPixelFormat(hdc, pfdid, pfd);
+ }
+ }
+ public static boolean SwapBuffers(long hdc) {
+ if(USE_WGLVersion_Of_5WGLGDIFuncSet) {
+ return WGL.wglSwapBuffers(hdc);
+ } else {
+ return GDI.SwapBuffers(hdc);
+ }
+ }
+}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
index f33dd21b0..b183ad59f 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
@@ -85,7 +85,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
}
AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
WindowsWGLGraphicsConfiguration cfg;
- final int pfdID = GDI.GetPixelFormat(hdc);
+ final int pfdID = WGLUtil.GetPixelFormat(hdc);
if (0 == pfdID) {
// This could have happened if the HDC was released right after the GL ctx made current (SWT),
// WinXP-32bit will not be able to use this HDC afterwards.
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
index ede504735..1e5991821 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
@@ -63,7 +63,7 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable {
if (0==hdc) {
throw new GLException("Error: attempted to make an external GLDrawable without a drawable current, werr " + GDI.GetLastError());
}
- int pfdID = GDI.GetPixelFormat(hdc);
+ int pfdID = WGLUtil.GetPixelFormat(hdc);
if (pfdID == 0) {
throw new GLException("Error: attempted to make an external GLContext without a valid pixelformat, werr " + GDI.GetLastError());
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
index 4f34c946a..6ad330ccc 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
@@ -42,7 +42,6 @@ package jogamp.opengl.windows.wgl;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import jogamp.opengl.*;
public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable {
protected WindowsOnscreenWGLDrawable(GLDrawableFactory factory, NativeSurface component) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
index 2e0f6b848..b96e0cd9b 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
@@ -77,22 +77,22 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
protected final void swapBuffersImpl() {
// single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
- long startTime = 0;
+ final long t0;
if (PROFILING) {
- startTime = System.currentTimeMillis();
+ t0 = System.currentTimeMillis();
+ } else {
+ t0 = 0;
}
- if (!GDI.SwapBuffers(getHandle()) && (GDI.GetLastError() != GDI.ERROR_SUCCESS)) {
+ if (!WGLUtil.SwapBuffers(getHandle()) && (GDI.GetLastError() != GDI.ERROR_SUCCESS)) {
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 += System.currentTimeMillis() - t0;
+ if (++profilingSwapBuffersTicks == PROFILING_TICKS) {
+ System.err.println("SwapBuffers calls: " + profilingSwapBuffersTime + " ms / " + PROFILING_TICKS + " calls (" +
+ ((float) profilingSwapBuffersTime / (float) PROFILING_TICKS) + " ms/call)");
profilingSwapBuffersTime = 0;
profilingSwapBuffersTicks = 0;
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index 2fcded885..d6788f1c9 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -161,7 +161,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
throw new GLException("Error: HDC is null");
}
- if (!GDI.SetPixelFormat(hdc, caps.getPFDID(), caps.getPFD())) {
+ if (!WGLUtil.SetPixelFormat(hdc, caps.getPFDID(), caps.getPFD())) {
throw new GLException("Unable to set pixel format " + caps +
" for device context " + toHexString(hdc) +
": error code " + GDI.GetLastError());
@@ -610,7 +610,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor();
- if (GDI.DescribePixelFormat(hdc, pfdID, PIXELFORMATDESCRIPTOR.size(), pfd) == 0) {
+ if (WGLUtil.DescribePixelFormat(hdc, pfdID, PIXELFORMATDESCRIPTOR.size(), pfd) == 0) {
// remove displayable bits, since pfdID is non displayable
drawableTypeBits = drawableTypeBits & ~(GLGraphicsConfigurationUtil.WINDOW_BIT | GLGraphicsConfigurationUtil.BITMAP_BIT);
if( 0 == drawableTypeBits ) {
@@ -629,7 +629,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
//
static int[] wglAllGDIPFIDs(long hdc) {
- int numFormats = GDI.DescribePixelFormat(hdc, 1, 0, null);
+ int numFormats = WGLUtil.DescribePixelFormat(hdc, 1, 0, null);
if (numFormats == 0) {
throw new GLException("DescribePixelFormat: No formats - HDC 0x" + Long.toHexString(hdc) +
", LastError: " + GDI.GetLastError());
@@ -736,7 +736,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
pfd.setNSize((short) PIXELFORMATDESCRIPTOR.size());
pfd.setNVersion((short) 1);
if(0 != hdc && 1 <= pfdID) {
- if (GDI.DescribePixelFormat(hdc, pfdID, PIXELFORMATDESCRIPTOR.size(), pfd) == 0) {
+ if (WGLUtil.DescribePixelFormat(hdc, pfdID, PIXELFORMATDESCRIPTOR.size(), pfd) == 0) {
// Accelerated pixel formats that are non displayable
if(DEBUG) {
System.err.println("Info: Non displayable pixel format " + pfdID + " of device context: error code " + GDI.GetLastError());
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index edcaa4a24..f02520136 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -200,8 +200,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
// set PFD if not set yet
int pfdID = -1;
boolean set = false;
- if ( 1 > ( pfdID = GDI.GetPixelFormat(hdc) ) ) {
- if (!GDI.SetPixelFormat(hdc, config.getPixelFormatID(), config.getPixelFormat())) {
+ if ( 1 > ( pfdID = WGLUtil.GetPixelFormat(hdc) ) ) {
+ if (!WGLUtil.SetPixelFormat(hdc, config.getPixelFormatID(), config.getPixelFormat())) {
throw new GLException("Unable to set pixel format " + config.getPixelFormatID() +
" for device context " + toHexString(hdc) +
": error code " + GDI.GetLastError());
@@ -311,7 +311,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
WGLGLCapabilities pixelFormatCaps = null; // chosen or preset PFD ID's caps
boolean pixelFormatSet = false; // indicates a preset PFD ID [caps]
- final int presetPFDID = extHDC ? -1 : GDI.GetPixelFormat(hdc) ;
+ final int presetPFDID = extHDC ? -1 : WGLUtil.GetPixelFormat(hdc) ;
if ( 1 <= presetPFDID ) {
// Pixelformat already set by either
// - a previous preselectGraphicsConfiguration() call on the same HDC,
@@ -433,7 +433,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
WGLGLCapabilities pixelFormatCaps = null; // chosen or preset PFD ID's caps
boolean pixelFormatSet = false; // indicates a preset PFD ID [caps]
- if ( !extHDC && 1 <= ( pfdID = GDI.GetPixelFormat(hdc) ) ) {
+ if ( !extHDC && 1 <= ( pfdID = WGLUtil.GetPixelFormat(hdc) ) ) {
// Pixelformat already set by either
// - a previous preselectGraphicsConfiguration() call on the same HDC,
// - the graphics driver, copying the HDC's pixelformat to the new one,
@@ -457,7 +457,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
// 1st choice: get GLCapabilities based on users GLCapabilities setting recommendedIndex as preferred choice
PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor();
pfd = WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(capsChosen, pfd);
- pfdID = GDI.ChoosePixelFormat(hdc, pfd);
+ pfdID = WGLUtil.ChoosePixelFormat(hdc, pfd);
int recommendedIndex = -1 ;
if( 1 <= pfdID ) {
// seek index ..