aboutsummaryrefslogtreecommitdiffstats
path: root/CNativeCode/GLDrawableFactory_Win32_SunJDK13.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2001-02-23 05:14:46 +0000
committerSven Gothel <[email protected]>2001-02-23 05:14:46 +0000
commit991622dd909d94b6ed83b84b744f0839b9ab6807 (patch)
tree3bcf3c79e8ea11358966710d0884a4416a74f8e6 /CNativeCode/GLDrawableFactory_Win32_SunJDK13.c
parent82cd20ed209f12e22e2f5a92719b3be2bb92d8ed (diff)
Version 2.6.0.0
Diffstat (limited to 'CNativeCode/GLDrawableFactory_Win32_SunJDK13.c')
-rwxr-xr-xCNativeCode/GLDrawableFactory_Win32_SunJDK13.c174
1 files changed, 174 insertions, 0 deletions
diff --git a/CNativeCode/GLDrawableFactory_Win32_SunJDK13.c b/CNativeCode/GLDrawableFactory_Win32_SunJDK13.c
new file mode 100755
index 0000000..7a085d5
--- /dev/null
+++ b/CNativeCode/GLDrawableFactory_Win32_SunJDK13.c
@@ -0,0 +1,174 @@
+#include "gl4java_drawable_Win32SunJDK13GLDrawableFactory.h"
+#include <windows.h>
+
+/* FIXME: extend to support multiple monitors on Win2K/98 */
+static HDC getScreenDC(int screen)
+{
+ return CreateDC("DISPLAY", NULL, NULL, NULL);
+}
+
+static void freeScreenDC(HDC dc)
+{
+ DeleteDC(dc);
+}
+
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_drawable_Win32SunJDK13GLDrawableFactory_getVisualSupportsOpenGL(JNIEnv *env,
+ jclass unused,
+ jint screen,
+ jint pixId)
+{
+ HDC dc;
+ PIXELFORMATDESCRIPTOR pfd;
+ jboolean res;
+ dc = getScreenDC(screen);
+ DescribePixelFormat(dc, pixId, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ res = (jboolean) (pfd.dwFlags & PFD_SUPPORT_OPENGL != 0);
+ freeScreenDC(dc);
+ return res;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_drawable_Win32SunJDK13GLDrawableFactory_getVisualDoubleBuffered(JNIEnv *env,
+ jclass unused,
+ jint screen,
+ jint pixId)
+{
+ HDC dc;
+ PIXELFORMATDESCRIPTOR pfd;
+ jboolean res;
+ dc = getScreenDC(screen);
+ DescribePixelFormat(dc, pixId, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ res = (jboolean) (pfd.dwFlags & PFD_DOUBLEBUFFER != 0);
+ freeScreenDC(dc);
+ return res;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_drawable_Win32SunJDK13GLDrawableFactory_getVisualTrueColor(JNIEnv *env,
+ jclass unused,
+ jint screen,
+ jint pixId)
+{
+ HDC dc;
+ PIXELFORMATDESCRIPTOR pfd;
+ jboolean res;
+ dc = getScreenDC(screen);
+ DescribePixelFormat(dc, pixId, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ res = (jboolean) (pfd.iPixelType == PFD_TYPE_RGBA);
+ freeScreenDC(dc);
+ return res;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_drawable_Win32SunJDK13GLDrawableFactory_getVisualStereo(JNIEnv *env,
+ jclass unused,
+ jint screen,
+ jint pixId)
+{
+ HDC dc;
+ PIXELFORMATDESCRIPTOR pfd;
+ jboolean res;
+ dc = getScreenDC(screen);
+ DescribePixelFormat(dc, pixId, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ res = (jboolean) (pfd.dwFlags & PFD_STEREO != 0);
+ freeScreenDC(dc);
+ return res;
+}
+
+JNIEXPORT jint JNICALL
+Java_gl4java_drawable_Win32SunJDK13GLDrawableFactory_getVisualDepthBits(JNIEnv *env,
+ jclass unused,
+ jint screen,
+ jint pixId)
+{
+ HDC dc;
+ PIXELFORMATDESCRIPTOR pfd;
+ jint res;
+ dc = getScreenDC(screen);
+ DescribePixelFormat(dc, pixId, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ res = pfd.cDepthBits;
+ freeScreenDC(dc);
+ return res;
+}
+
+JNIEXPORT jint JNICALL
+Java_gl4java_drawable_Win32SunJDK13GLDrawableFactory_getVisualStencilBits(JNIEnv *env,
+ jclass unused,
+ jint screen,
+ jint pixId)
+{
+ HDC dc;
+ PIXELFORMATDESCRIPTOR pfd;
+ jint res;
+ dc = getScreenDC(screen);
+ DescribePixelFormat(dc, pixId, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ res = pfd.cStencilBits;
+ freeScreenDC(dc);
+ return res;
+}
+
+JNIEXPORT jint JNICALL
+Java_gl4java_drawable_Win32SunJDK13GLDrawableFactory_getVisualColorBits(JNIEnv *env,
+ jclass unused,
+ jint screen,
+ jint pixId)
+{
+ HDC dc;
+ PIXELFORMATDESCRIPTOR pfd;
+ jint res;
+ dc = getScreenDC(screen);
+ DescribePixelFormat(dc, pixId, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ res = pfd.cColorBits;
+ freeScreenDC(dc);
+ return res;
+}
+
+JNIEXPORT jint JNICALL
+Java_gl4java_drawable_Win32SunJDK13GLDrawableFactory_getVisualColorShiftBits(JNIEnv *env,
+ jclass unused,
+ jint screen,
+ jint pixId)
+{
+ HDC dc;
+ PIXELFORMATDESCRIPTOR pfd;
+ jint res;
+ dc = getScreenDC(screen);
+ DescribePixelFormat(dc, pixId, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ res = pfd.cRedShift+pfd.cGreenShift+pfd.cBlueShift+pfd.cAlphaShift;
+ freeScreenDC(dc);
+ return res;
+}
+
+JNIEXPORT jint JNICALL
+Java_gl4java_drawable_Win32SunJDK13GLDrawableFactory_getVisualAlphaBits(JNIEnv *env,
+ jclass unused,
+ jint screen,
+ jint pixId)
+{
+ HDC dc;
+ PIXELFORMATDESCRIPTOR pfd;
+ jint res;
+ dc = getScreenDC(screen);
+ DescribePixelFormat(dc, pixId, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ res = pfd.cAlphaBits;
+ freeScreenDC(dc);
+ return res;
+}
+
+JNIEXPORT jint JNICALL
+Java_gl4java_drawable_Win32SunJDK13GLDrawableFactory_getVisualAccumBits(JNIEnv *env,
+ jclass unused,
+ jint screen,
+ jint pixId)
+{
+ HDC dc;
+ PIXELFORMATDESCRIPTOR pfd;
+ jint res;
+ dc = getScreenDC(screen);
+ DescribePixelFormat(dc, pixId, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
+ res = pfd.cAccumBits;
+ freeScreenDC(dc);
+ return res;
+}