You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
1
|
2
(5) |
3
(1) |
4
(1) |
5
|
|
6
|
7
(6) |
8
(2) |
9
(11) |
10
|
11
(1) |
12
|
|
13
(1) |
14
(2) |
15
(30) |
16
(46) |
17
(13) |
18
(2) |
19
|
|
20
(26) |
21
(12) |
22
(9) |
23
(22) |
24
(5) |
25
(2) |
26
|
|
27
|
28
|
|
|
|
|
|
|
From: Elias N. <eli...@us...> - 2005-02-23 15:35:02
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30422/src/native/win32 Modified Files: extgl_wgl.h Log Message: Win32: Compile fix Index: extgl_wgl.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/extgl_wgl.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- extgl_wgl.h 21 Feb 2005 14:46:47 -0000 1.3 +++ extgl_wgl.h 23 Feb 2005 15:34:42 -0000 1.4 @@ -56,7 +56,7 @@ extern WGLExtensions extension_flags; -extern void extgl_InitWGL(JNIEnv *env); +extern void extgl_InitWGL(); /*-------------------------------------------------------------------*/ /*------------WGL_EXT_EXTENSION_STRING-------------------------------*/ |
|
From: Elias N. <eli...@us...> - 2005-02-23 15:19:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25270/win32 Modified Files: context.c Log Message: Removed unsued JNIEnv parameter from extgl_QueryExtension Index: context.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/context.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- context.c 21 Feb 2005 14:46:47 -0000 1.1 +++ context.c 23 Feb 2005 15:19:21 -0000 1.2 @@ -368,7 +368,7 @@ throwException(env, "Could not bind context to dummy window"); return -1; } - extgl_InitWGL(env); + extgl_InitWGL(); if (!extension_flags.WGL_ARB_pixel_format) { throwException(env, "No support for WGL_ARB_pixel_format"); |
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24393/linux Modified Files: context.c extgl_glx.c extgl_glx.h org_lwjgl_opengl_LinuxCanvasImplementation.c org_lwjgl_opengl_LinuxContextImplementation.c org_lwjgl_opengl_Pbuffer.c Log Message: Removed unsued JNIEnv parameter from extgl_QueryExtension Index: extgl_glx.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/extgl_glx.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- extgl_glx.c 23 Feb 2005 14:16:57 -0000 1.4 +++ extgl_glx.c 23 Feb 2005 15:17:50 -0000 1.5 @@ -125,13 +125,13 @@ } /** returns true if the extention is available */ -static bool GLXQueryExtension(JNIEnv* env, Display *disp, int screen, const char *name) +static bool GLXQueryExtension(Display *disp, int screen, const char *name) { const GLubyte *exts = (const GLubyte *)glXQueryExtensionsString(disp, screen); - return extgl_QueryExtension(env, exts, name); + return extgl_QueryExtension(exts, name); } -static void extgl_InitGLX13(JNIEnv *env) +static void extgl_InitGLX13() { ExtFunction functions[] = { {"glXGetFBConfigs", (void*)&glXGetFBConfigs}, @@ -182,15 +182,15 @@ return extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } -static void extgl_InitGLXSupportedExtensions(JNIEnv *env, Display *disp, int screen) +static void extgl_InitGLXSupportedExtensions(Display *disp, int screen) { - extension_flags.GLX_EXT_visual_info = GLXQueryExtension(env, disp, screen, "GLX_EXT_visual_info"); - extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(env, disp, screen, "GLX_EXT_visual_rating"); - extension_flags.GLX_SGI_swap_control = GLXQueryExtension(env, disp, screen, "GLX_SGI_swap_control"); - extension_flags.GLX_ARB_multisample = GLXQueryExtension(env, disp, screen, "GLX_ARB_multisample"); + extension_flags.GLX_EXT_visual_info = GLXQueryExtension(disp, screen, "GLX_EXT_visual_info"); + extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(disp, screen, "GLX_EXT_visual_rating"); + extension_flags.GLX_SGI_swap_control = GLXQueryExtension(disp, screen, "GLX_SGI_swap_control"); + extension_flags.GLX_ARB_multisample = GLXQueryExtension(disp, screen, "GLX_ARB_multisample"); } -static void extgl_InitGLXSGISwapControl(JNIEnv *env) +static void extgl_InitGLXSGISwapControl() { ExtFunction functions[] = { {"glXSwapIntervalSGI", (void*)&glXSwapIntervalSGI}}; @@ -198,7 +198,7 @@ extension_flags.GLX_SGI_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } -bool extgl_InitGLX(JNIEnv *env, Display *disp, int screen) +bool extgl_InitGLX(Display *disp, int screen) { int major, minor; /* Assume glx ver >= 1.2 */ @@ -209,8 +209,8 @@ return false; if (major > 1 || (major == 1 && minor >= 3)) extension_flags.GLX13 = true; - extgl_InitGLX13(env); - extgl_InitGLXSupportedExtensions(env, disp, screen); - extgl_InitGLXSGISwapControl(env); + extgl_InitGLX13(); + extgl_InitGLXSupportedExtensions(disp, screen); + extgl_InitGLXSGISwapControl(); return true; } Index: org_lwjgl_opengl_LinuxCanvasImplementation.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxCanvasImplementation.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_opengl_LinuxCanvasImplementation.c 20 Feb 2005 11:24:22 -0000 1.1 +++ org_lwjgl_opengl_LinuxCanvasImplementation.c 23 Feb 2005 15:17:52 -0000 1.2 @@ -48,7 +48,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxCanvasImplementation_nFindVisualIDFromFormat (JNIEnv *env, jclass clazz, jint screen, jobject pixel_format) { - if (!extgl_InitGLX(env, getDisplay(), screen)) { + if (!extgl_InitGLX(getDisplay(), screen)) { throwException(env, "Could not initialize GLX"); return -1; } Index: org_lwjgl_opengl_Pbuffer.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- org_lwjgl_opengl_Pbuffer.c 23 Feb 2005 11:38:24 -0000 1.13 +++ org_lwjgl_opengl_Pbuffer.c 23 Feb 2005 15:17:52 -0000 1.14 @@ -60,7 +60,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint width, jint height, jobject pixel_format) { - if (!extgl_InitGLX(env, getDisplay(), getCurrentScreen()) || !isPbuffersSupported()) { + if (!extgl_InitGLX(getDisplay(), getCurrentScreen()) || !isPbuffersSupported()) { throwException(env, "No Pbuffer support"); return; } Index: org_lwjgl_opengl_LinuxContextImplementation.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_LinuxContextImplementation.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_opengl_LinuxContextImplementation.c 22 Feb 2005 13:59:32 -0000 1.2 +++ org_lwjgl_opengl_LinuxContextImplementation.c 23 Feb 2005 15:17:52 -0000 1.3 @@ -109,7 +109,7 @@ X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); - if (!extgl_InitGLX(env, peer_info->display, peer_info->screen)) { + if (!extgl_InitGLX(peer_info->display, peer_info->screen)) { throwException(env, "Could not initialize GLX"); return NULL; } Index: context.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/context.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- context.c 21 Feb 2005 15:35:09 -0000 1.2 +++ context.c 23 Feb 2005 15:17:49 -0000 1.3 @@ -247,7 +247,7 @@ return false; } X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); - if (!extgl_InitGLX(env, display, screen)) { + if (!extgl_InitGLX(display, screen)) { throwException(env, "Could not init GLX"); return false; } Index: extgl_glx.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/extgl_glx.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- extgl_glx.h 17 Feb 2005 12:39:32 -0000 1.3 +++ extgl_glx.h 23 Feb 2005 15:17:51 -0000 1.4 @@ -365,6 +365,6 @@ extern glXSwapIntervalSGIPROC glXSwapIntervalSGI; -extern bool extgl_InitGLX(JNIEnv *env, Display *disp, int screen); +extern bool extgl_InitGLX(Display *disp, int screen); #endif |
|
From: Elias N. <eli...@us...> - 2005-02-23 15:18:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24393/win32 Modified Files: extgl_wgl.c Log Message: Removed unsued JNIEnv parameter from extgl_QueryExtension Index: extgl_wgl.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/extgl_wgl.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- extgl_wgl.c 23 Feb 2005 13:22:44 -0000 1.5 +++ extgl_wgl.c 23 Feb 2005 15:17:53 -0000 1.6 @@ -114,7 +114,7 @@ } /** returns true if the extension is available */ -static bool WGLQueryExtension(JNIEnv *env, const char *name) +static bool WGLQueryExtension(const char *name) { const GLubyte *extensions; @@ -125,10 +125,10 @@ extensions = (GLubyte*)wglGetExtensionsStringEXT(); else extensions = (GLubyte*)wglGetExtensionsStringARB(wglGetCurrentDC()); - return extgl_QueryExtension(env, extensions, name); + return extgl_QueryExtension(extensions, name); } -static void extgl_InitWGLARBPbuffer(JNIEnv *env) +static void extgl_InitWGLARBPbuffer() { ExtFunction functions[] = { {"wglCreatePbufferARB", (void **)&wglCreatePbufferARB}, @@ -140,7 +140,7 @@ extension_flags.WGL_ARB_pbuffer = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } -static void extgl_InitWGLARBPixelFormat(JNIEnv *env) +static void extgl_InitWGLARBPixelFormat() { ExtFunction functions[] = { {"wglGetPixelFormatAttribivARB", (void **)&wglGetPixelFormatAttribivARB}, @@ -150,7 +150,7 @@ extension_flags.WGL_ARB_pixel_format = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } -static void extgl_InitWGLARBRenderTexture(JNIEnv *env) +static void extgl_InitWGLARBRenderTexture() { ExtFunction functions[] = { {"wglBindTexImageARB", (void **)&wglBindTexImageARB}, @@ -160,7 +160,7 @@ extension_flags.WGL_ARB_render_texture = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } -static void extgl_InitWGLEXTSwapControl(JNIEnv *env) +static void extgl_InitWGLEXTSwapControl() { ExtFunction functions[] = { {"wglSwapIntervalEXT", (void **)&wglSwapIntervalEXT}, @@ -169,7 +169,7 @@ extension_flags.WGL_EXT_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } -static void extgl_InitWGLARBMakeCurrentRead(JNIEnv *env) +static void extgl_InitWGLARBMakeCurrentRead() { ExtFunction functions[] = { {"wglMakeContextCurrentARB", (void **)&wglMakeContextCurrentARB}, @@ -178,20 +178,20 @@ extension_flags.WGL_ARB_make_current_read = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); } -static void extgl_InitSupportedWGLExtensions(JNIEnv *env) +static void extgl_InitSupportedWGLExtensions() { - extension_flags.WGL_ARB_buffer_region = WGLQueryExtension(env, "WGL_ARB_buffer_region"); - extension_flags.WGL_ARB_make_current_read = WGLQueryExtension(env, "WGL_ARB_make_current_read"); - extension_flags.WGL_ARB_multisample = WGLQueryExtension(env, "WGL_ARB_multisample"); - extension_flags.WGL_ARB_pbuffer = WGLQueryExtension(env, "WGL_ARB_pbuffer"); - extension_flags.WGL_ARB_pixel_format = WGLQueryExtension(env, "WGL_ARB_pixel_format"); - extension_flags.WGL_ARB_render_texture = WGLQueryExtension(env, "WGL_ARB_render_texture"); - extension_flags.WGL_EXT_swap_control = WGLQueryExtension(env, "WGL_EXT_swap_control"); - extension_flags.WGL_NV_render_depth_texture = WGLQueryExtension(env, "WGL_NV_render_depth_texture"); - extension_flags.WGL_NV_render_texture_rectangle = WGLQueryExtension(env, "WGL_NV_render_texture_rectangle"); + extension_flags.WGL_ARB_buffer_region = WGLQueryExtension("WGL_ARB_buffer_region"); + extension_flags.WGL_ARB_make_current_read = WGLQueryExtension("WGL_ARB_make_current_read"); + extension_flags.WGL_ARB_multisample = WGLQueryExtension("WGL_ARB_multisample"); + extension_flags.WGL_ARB_pbuffer = WGLQueryExtension("WGL_ARB_pbuffer"); + extension_flags.WGL_ARB_pixel_format = WGLQueryExtension("WGL_ARB_pixel_format"); + extension_flags.WGL_ARB_render_texture = WGLQueryExtension("WGL_ARB_render_texture"); + extension_flags.WGL_EXT_swap_control = WGLQueryExtension("WGL_EXT_swap_control"); + extension_flags.WGL_NV_render_depth_texture = WGLQueryExtension("WGL_NV_render_depth_texture"); + extension_flags.WGL_NV_render_texture_rectangle = WGLQueryExtension("WGL_NV_render_texture_rectangle"); } -void extgl_InitWGL(JNIEnv *env) +void extgl_InitWGL() { ExtFunction functions[] = { {"wglGetExtensionsStringARB", (void **)&wglGetExtensionsStringARB}, @@ -200,12 +200,11 @@ extension_flags.WGL_ARB_extensions_string = wglGetExtensionsStringARB != NULL; extension_flags.WGL_EXT_extensions_string = wglGetExtensionsStringEXT != NULL; - extgl_InitSupportedWGLExtensions(env); + extgl_InitSupportedWGLExtensions(); - extgl_InitWGLARBMakeCurrentRead(env); - extgl_InitWGLEXTSwapControl(env); - extgl_InitWGLARBRenderTexture(env); - extgl_InitWGLARBPixelFormat(env); - extgl_InitWGLARBPbuffer(env); - //extgl_InitWGLARBBufferRegion(env); + extgl_InitWGLARBMakeCurrentRead(); + extgl_InitWGLEXTSwapControl(); + extgl_InitWGLARBRenderTexture(); + extgl_InitWGLARBPixelFormat(); + extgl_InitWGLARBPbuffer(); } |
|
From: Elias N. <eli...@us...> - 2005-02-23 15:18:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24393/common Modified Files: extgl.c extgl.h Log Message: Removed unsued JNIEnv parameter from extgl_QueryExtension Index: extgl.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.h,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- extgl.h 21 Feb 2005 14:46:43 -0000 1.53 +++ extgl.h 23 Feb 2005 15:17:17 -0000 1.54 @@ -72,7 +72,6 @@ #include <jni.h> - /*-----------------------------------------*/ /*-----------------------------------------*/ @@ -162,7 +161,7 @@ extern void extgl_Close(void); extern void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions); extern bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions); -extern bool extgl_QueryExtension(JNIEnv *env, const GLubyte*extensions, const char *name); +extern bool extgl_QueryExtension(const GLubyte*extensions, const char *name); extern void *extgl_GetProcAddress(const char *name); #ifdef __cplusplus Index: extgl.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- extgl.c 23 Feb 2005 13:22:42 -0000 1.34 +++ extgl.c 23 Feb 2005 15:16:59 -0000 1.35 @@ -46,7 +46,7 @@ return ext_InitializeFunctions(&extgl_GetProcAddress, num_functions, functions); } -bool extgl_QueryExtension(JNIEnv *env, const GLubyte*extensions, const char *name) +bool extgl_QueryExtension(const GLubyte*extensions, const char *name) { const GLubyte *start; GLubyte *where, *terminator; |
|
From: Elias N. <eli...@us...> - 2005-02-23 14:17:06
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4430 Modified Files: extgl_glx.c Log Message: Linux: Fixed glx Index: extgl_glx.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/extgl_glx.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- extgl_glx.c 23 Feb 2005 13:22:43 -0000 1.3 +++ extgl_glx.c 23 Feb 2005 14:16:57 -0000 1.4 @@ -205,12 +205,12 @@ if (!extgl_InitGLX12()) return false; extension_flags.GLX12 = true; + if (glXQueryVersion(disp, &major, &minor) != True) + return false; if (major > 1 || (major == 1 && minor >= 3)) extension_flags.GLX13 = true; extgl_InitGLX13(env); extgl_InitGLXSupportedExtensions(env, disp, screen); - if (glXQueryVersion(disp, &major, &minor) != True) - return false; extgl_InitGLXSGISwapControl(env); return true; } |
|
From: Elias N. <eli...@us...> - 2005-02-23 13:22:58
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21131/win32 Modified Files: extgl_wgl.c Log Message: Moved platform specific stuff from extgl.c into platform directories Index: extgl_wgl.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/extgl_wgl.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- extgl_wgl.c 23 Feb 2005 12:38:39 -0000 1.4 +++ extgl_wgl.c 23 Feb 2005 13:22:44 -0000 1.5 @@ -78,6 +78,41 @@ wglMakeContextCurrentARBPROC wglMakeContextCurrentARB = NULL; wglGetCurrentReadDCARBPROC wglGetCurrentReadDCARB = NULL; +static HMODULE lib_gl_handle = NULL; + +void *extgl_GetProcAddress(const char *name) +{ + void *t = wglGetProcAddress(name); + if (t == NULL) + { + t = GetProcAddress(lib_gl_handle, name); + if (t == NULL) + { + printfDebug("Could not locate symbol %s\n", name); + } + } + return t; +} + +bool extgl_Open(JNIEnv *env) +{ + if (lib_gl_handle != NULL) + return true; + // load the dynamic libraries for OpenGL + lib_gl_handle = LoadLibrary("opengl32.dll"); + if (lib_gl_handle == NULL) { + throwException(env, "Could not load OpenGL library"); + return false; + } + return true; +} + +void extgl_Close(void) +{ + FreeLibrary(lib_gl_handle); + lib_gl_handle = NULL; +} + /** returns true if the extension is available */ static bool WGLQueryExtension(JNIEnv *env, const char *name) { |
|
From: Elias N. <eli...@us...> - 2005-02-23 13:22:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21131/common Modified Files: extgl.c Log Message: Moved platform specific stuff from extgl.c into platform directories Index: extgl.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- extgl.c 17 Feb 2005 12:39:31 -0000 1.33 +++ extgl.c 23 Feb 2005 13:22:42 -0000 1.34 @@ -38,80 +38,6 @@ #include "extgl.h" #include "common_tools.h" -/* turn off the warning for the borland compiler*/ -#ifdef __BORLANDC__ -#pragma warn -8064 -#pragma warn -8065 -#endif /* __BORLANDC__ */ - -#ifdef _X11 - -#include <dlfcn.h> -#endif - -#ifdef _WIN32 -HMODULE lib_gl_handle = NULL; -#endif - -#ifdef _X11 -void * lib_gl_handle = NULL; - -typedef void * (APIENTRY * glXGetProcAddressARBPROC) (const GLubyte *procName); - -static glXGetProcAddressARBPROC glXGetProcAddressARB; -#endif - -#ifdef _MACOSX -#include <mach-o/dyld.h> -static const struct mach_header *opengl_lib_handle = NULL; -#endif - -/* getProcAddress */ - -void *extgl_GetProcAddress(const char *name) -{ -#ifdef _WIN32 - void *t = wglGetProcAddress(name); - if (t == NULL) - { - t = GetProcAddress(lib_gl_handle, name); - if (t == NULL) - { - printfDebug("Could not locate symbol %s\n", name); - } - } - return t; -#endif - -#ifdef _X11 - void *t = (void*)glXGetProcAddressARB((const GLubyte*)name); - if (t == NULL) - { - t = dlsym(lib_gl_handle, name); - if (t == NULL) - { - printfDebug("Could not locate symbol %s\n", name); - } - } - return t; -#endif - -#ifdef _MACOSX - #define BUFFER_SIZE 1024 - char mach_name[BUFFER_SIZE] = "_"; - strncat(mach_name, name, BUFFER_SIZE - 1); - - if (NSIsSymbolNameDefinedInImage(opengl_lib_handle, mach_name)) { - NSSymbol sym = NSLookupSymbolInImage(opengl_lib_handle, mach_name, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); - void *address = NSAddressOfSymbol(sym); - return address; - } else { - printfDebug("Could not locate symbol %s\n", name); - return NULL; - } -#endif -} - void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) { ext_InitializeClass(env, clazz, &extgl_GetProcAddress, num_functions, functions); } @@ -120,12 +46,6 @@ return ext_InitializeFunctions(&extgl_GetProcAddress, num_functions, functions); } -#ifdef _MACOSX -static const struct mach_header *loadImage(const char *lib_name) { - return NSAddImage(lib_name, NSADDIMAGE_OPTION_RETURN_ON_ERROR); -} -#endif - bool extgl_QueryExtension(JNIEnv *env, const GLubyte*extensions, const char *name) { const GLubyte *start; @@ -161,82 +81,3 @@ } -/*-----------------------------------------------------*/ -/* AGL stuff END*/ -/*-----------------------------------------------------*/ - -#ifdef _MACOSX -bool extgl_Open(JNIEnv *env) { - if (opengl_lib_handle != NULL) - return true; - opengl_lib_handle = loadImage("/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"); - if (opengl_lib_handle != NULL) { - return true; - } else { - throwException(env, "Could not load OpenGL library"); - return false; - } -} -#endif - -#ifdef _X11 -bool extgl_Open(JNIEnv *env) -{ -#define BUFFER_SIZE 2000 - static char buffer[BUFFER_SIZE]; - if (lib_gl_handle != NULL) - return true; - lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); - if (lib_gl_handle == NULL) { - snprintf(buffer, BUFFER_SIZE, "Error loading libGL.so.1: %s", dlerror()); - buffer[BUFFER_SIZE - 1] = '\0'; - throwException(env, buffer); - return false; - } - glXGetProcAddressARB = (glXGetProcAddressARBPROC)dlsym(lib_gl_handle, "glXGetProcAddressARB"); - if (glXGetProcAddressARB == NULL) { - extgl_Close(); - throwException(env, "Could not get address of glXGetProcAddressARB"); - return false; - } - return true; -} - -#endif /* X11 */ - -#ifdef _WIN32 -bool extgl_Open(JNIEnv *env) -{ - if (lib_gl_handle != NULL) - return true; - // load the dynamic libraries for OpenGL - lib_gl_handle = LoadLibrary("opengl32.dll"); - if (lib_gl_handle == NULL) { - throwException(env, "Could not load OpenGL library"); - return false; - } - return true; -} -#endif /* WIN32 */ - -void extgl_Close(void) -{ -#ifdef _X11 - dlclose(lib_gl_handle); - lib_gl_handle = NULL; -#endif -#ifdef _WIN32 - FreeLibrary(lib_gl_handle); - lib_gl_handle = NULL; -#endif -#ifdef _MACOSX - opengl_lib_handle = NULL; -#endif -} - -/* turn on the warning for the borland compiler*/ -#ifdef __BORLANDC__ -#pragma warn .8064 -#pragma warn .8065 -#endif /* __BORLANDC__ */ - |
|
From: Elias N. <eli...@us...> - 2005-02-23 13:22:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21131/macosx Modified Files: context.m Log Message: Moved platform specific stuff from extgl.c into platform directories Index: context.m =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/context.m,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- context.m 23 Feb 2005 11:11:07 -0000 1.1 +++ context.m 23 Feb 2005 13:22:43 -0000 1.2 @@ -42,6 +42,46 @@ #import <Cocoa/Cocoa.h> #import <Carbon/Carbon.h> +#include <mach-o/dyld.h> +static const struct mach_header *opengl_lib_handle = NULL; + +void *extgl_GetProcAddress(const char *name) +{ + #define BUFFER_SIZE 1024 + char mach_name[BUFFER_SIZE] = "_"; + strncat(mach_name, name, BUFFER_SIZE - 1); + + if (NSIsSymbolNameDefinedInImage(opengl_lib_handle, mach_name)) { + NSSymbol sym = NSLookupSymbolInImage(opengl_lib_handle, mach_name, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); + void *address = NSAddressOfSymbol(sym); + return address; + } else { + printfDebug("Could not locate symbol %s\n", name); + return NULL; + } +} + +static const struct mach_header *loadImage(const char *lib_name) { + return NSAddImage(lib_name, NSADDIMAGE_OPTION_RETURN_ON_ERROR); +} + +bool extgl_Open(JNIEnv *env) { + if (opengl_lib_handle != NULL) + return true; + opengl_lib_handle = loadImage("/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"); + if (opengl_lib_handle != NULL) { + return true; + } else { + throwException(env, "Could not load OpenGL library"); + return false; + } +} + +void extgl_Close(void) +{ + opengl_lib_handle = NULL; +} + NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered) { int bpp; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); |
|
From: Elias N. <eli...@us...> - 2005-02-23 13:22:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21131/linux Modified Files: extgl_glx.c Log Message: Moved platform specific stuff from extgl.c into platform directories Index: extgl_glx.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/extgl_glx.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- extgl_glx.c 17 Feb 2005 12:39:32 -0000 1.2 +++ extgl_glx.c 23 Feb 2005 13:22:43 -0000 1.3 @@ -29,6 +29,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <dlfcn.h> #include "extgl_glx.h" GLXExtensions extension_flags; @@ -75,6 +76,54 @@ /* GLX_SGI_swap_control */ glXSwapIntervalSGIPROC glXSwapIntervalSGI = NULL; +static void * lib_gl_handle = NULL; + +typedef void * (APIENTRY * glXGetProcAddressARBPROC) (const GLubyte *procName); + +static glXGetProcAddressARBPROC glXGetProcAddressARB; + +bool extgl_Open(JNIEnv *env) +{ +#define BUFFER_SIZE 2000 + static char buffer[BUFFER_SIZE]; + if (lib_gl_handle != NULL) + return true; + lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); + if (lib_gl_handle == NULL) { + snprintf(buffer, BUFFER_SIZE, "Error loading libGL.so.1: %s", dlerror()); + buffer[BUFFER_SIZE - 1] = '\0'; + throwException(env, buffer); + return false; + } + glXGetProcAddressARB = (glXGetProcAddressARBPROC)dlsym(lib_gl_handle, "glXGetProcAddressARB"); + if (glXGetProcAddressARB == NULL) { + extgl_Close(); + throwException(env, "Could not get address of glXGetProcAddressARB"); + return false; + } + return true; +} + +void *extgl_GetProcAddress(const char *name) +{ + void *t = (void*)glXGetProcAddressARB((const GLubyte*)name); + if (t == NULL) + { + t = dlsym(lib_gl_handle, name); + if (t == NULL) + { + printfDebug("Could not locate symbol %s\n", name); + } + } + return t; +} + +void extgl_Close(void) +{ + dlclose(lib_gl_handle); + lib_gl_handle = NULL; +} + /** returns true if the extention is available */ static bool GLXQueryExtension(JNIEnv* env, Display *disp, int screen, const char *name) { @@ -153,15 +202,15 @@ { int major, minor; /* Assume glx ver >= 1.2 */ - extension_flags.GLX12 = true; if (!extgl_InitGLX12()) return false; - extgl_InitGLXSupportedExtensions(env, disp, screen); - if (glXQueryVersion(disp, &major, &minor) != True) - return false; + extension_flags.GLX12 = true; if (major > 1 || (major == 1 && minor >= 3)) extension_flags.GLX13 = true; extgl_InitGLX13(env); + extgl_InitGLXSupportedExtensions(env, disp, screen); + if (glXQueryVersion(disp, &major, &minor) != True) + return false; extgl_InitGLXSGISwapControl(env); return true; } |
|
From: Elias N. <eli...@us...> - 2005-02-23 12:38:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10353/win32 Modified Files: extgl_wgl.c Log Message: Typo fix Index: extgl_wgl.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/extgl_wgl.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- extgl_wgl.c 21 Feb 2005 14:46:47 -0000 1.3 +++ extgl_wgl.c 23 Feb 2005 12:38:39 -0000 1.4 @@ -78,7 +78,7 @@ wglMakeContextCurrentARBPROC wglMakeContextCurrentARB = NULL; wglGetCurrentReadDCARBPROC wglGetCurrentReadDCARB = NULL; -/** returns true if the extention is available */ +/** returns true if the extension is available */ static bool WGLQueryExtension(JNIEnv *env, const char *name) { const GLubyte *extensions; |
|
From: Elias N. <eli...@us...> - 2005-02-23 12:12:56
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2428/src/java/org/lwjgl/opengl Modified Files: Context.java LinuxContextImplementation.java MacOSXContextImplementation.java Win32ContextImplementation.java Log Message: Made Context.setVSync static. Added synchronization. Index: Context.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Context.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Context.java 23 Feb 2005 11:11:06 -0000 1.2 +++ Context.java 23 Feb 2005 12:12:46 -0000 1.3 @@ -208,7 +208,7 @@ * the monitor vertical refresh synchronization of the context, and is not guaranteed to be successful. * @param sync true to synchronize; false to ignore synchronization */ - public synchronized void setVSync(boolean enable) { + public static void setVSync(boolean enable) { implementation.setVSync(enable); } Index: MacOSXContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MacOSXContextImplementation.java 23 Feb 2005 11:47:47 -0000 1.2 +++ MacOSXContextImplementation.java 23 Feb 2005 12:12:47 -0000 1.3 @@ -43,10 +43,6 @@ * @version $Revision$ */ final class MacOSXContextImplementation implements ContextImplementation { - private static PeerInfo getCurrentPeerInfo() { - return Context.getCurrentContext().getPeerInfo(); - } - public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { @@ -59,7 +55,11 @@ public void swapBuffers() throws LWJGLException { Context current_context = Context.getCurrentContext(); - nSwapBuffers(current_context.getHandle()); + if (current_context == null) + throw new IllegalStateException("No context is current"); + synchronized (current_context) { + nSwapBuffers(current_context.getHandle()); + } } private static native void nSwapBuffers(ByteBuffer context_handle) throws LWJGLException; @@ -70,8 +70,11 @@ public void releaseCurrentContext() throws LWJGLException { Context current_context = Context.getCurrentContext(); - if (current_context != null) - clearDrawable(current_context.getHandle()); + if (current_context != null) { + synchronized (current_context) { + clearDrawable(current_context.getHandle()); + } + } nReleaseCurrentContext(); } private static native void nReleaseCurrentContext() throws LWJGLException; @@ -97,7 +100,10 @@ private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; public void setVSync(boolean enabled) { - nSetVSync(Context.getCurrentContext().getHandle(), enabled); + Context current_context = Context.getCurrentContext(); + synchronized (current_context) { + nSetVSync(current_context.getHandle(), enabled); + } } private static native void nSetVSync(ByteBuffer context_handle, boolean enabled); Index: Win32ContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Win32ContextImplementation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Win32ContextImplementation.java 23 Feb 2005 11:11:07 -0000 1.2 +++ Win32ContextImplementation.java 23 Feb 2005 12:12:47 -0000 1.3 @@ -43,10 +43,6 @@ * @version $Revision$ */ final class Win32ContextImplementation implements ContextImplementation { - private static PeerInfo getCurrentPeerInfo() { - return Context.getCurrentContext().getPeerInfo(); - } - public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { @@ -58,14 +54,17 @@ private static native ByteBuffer nCreate(ByteBuffer peer_handle, ByteBuffer shared_context_handle) throws LWJGLException; public void swapBuffers() throws LWJGLException { - PeerInfo current_peer_info = getCurrentPeerInfo(); - if (current_peer_info == null) + Context current_context = Context.getCurrentContext(); + if (current_context == null) throw new IllegalStateException("No context is current"); - ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); - try { - nSwapBuffers(peer_handle); - } finally { - current_peer_info.unlock(); + synchronized (current_context) { + PeerInfo current_peer_info = current_context.getPeerInfo(); + ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); + try { + nSwapBuffers(peer_handle); + } finally { + current_peer_info.unlock(); + } } } private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException; Index: LinuxContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- LinuxContextImplementation.java 23 Feb 2005 11:11:07 -0000 1.3 +++ LinuxContextImplementation.java 23 Feb 2005 12:12:47 -0000 1.4 @@ -43,10 +43,6 @@ * @version $Revision$ */ final class LinuxContextImplementation implements ContextImplementation { - private static PeerInfo getCurrentPeerInfo() { - return Context.getCurrentContext().getPeerInfo(); - } - public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException { LinuxDisplay.lockAWT(); try { @@ -64,37 +60,43 @@ private static native ByteBuffer nCreate(ByteBuffer peer_handle, ByteBuffer shared_context_handle) throws LWJGLException; public void swapBuffers() throws LWJGLException { - PeerInfo current_peer_info = getCurrentPeerInfo(); - if (current_peer_info == null) + Context current_context = Context.getCurrentContext(); + if (current_context == null) throw new IllegalStateException("No context is current"); - LinuxDisplay.lockAWT(); - try { - ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); + synchronized (current_context) { + PeerInfo current_peer_info = current_context.getPeerInfo(); + LinuxDisplay.lockAWT(); try { - nSwapBuffers(peer_handle); + ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); + try { + nSwapBuffers(peer_handle); + } finally { + current_peer_info.unlock(); + } } finally { - current_peer_info.unlock(); + LinuxDisplay.unlockAWT(); } - } finally { - LinuxDisplay.unlockAWT(); } } private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException; public void releaseCurrentContext() throws LWJGLException { - PeerInfo current_peer_info = getCurrentPeerInfo(); - if (current_peer_info == null) - return; // No context is current - LinuxDisplay.lockAWT(); - try { - ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); + Context current_context = Context.getCurrentContext(); + if (current_context == null) + throw new IllegalStateException("No context is current"); + synchronized (current_context) { + PeerInfo current_peer_info = current_context.getPeerInfo(); + LinuxDisplay.lockAWT(); try { - nReleaseCurrentContext(peer_handle); + ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); + try { + nReleaseCurrentContext(peer_handle); + } finally { + current_peer_info.unlock(); + } } finally { - current_peer_info.unlock(); + LinuxDisplay.unlockAWT(); } - } finally { - LinuxDisplay.unlockAWT(); } } private static native void nReleaseCurrentContext(ByteBuffer peer_info_handle) throws LWJGLException; |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:47:55
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28215/src/java/org/lwjgl/opengl Modified Files: MacOSXContextImplementation.java Log Message: Removed debug Index: MacOSXContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- MacOSXContextImplementation.java 23 Feb 2005 11:11:07 -0000 1.1 +++ MacOSXContextImplementation.java 23 Feb 2005 11:47:47 -0000 1.2 @@ -64,7 +64,6 @@ private static native void nSwapBuffers(ByteBuffer context_handle) throws LWJGLException; public void update(ByteBuffer context_handle) { -System.out.println("context_handle = " + context_handle); nUpdate(context_handle); } private static native void nUpdate(ByteBuffer context_handle); |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:45:35
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27610 Modified Files: LinuxDisplay.java MacOSXDisplay.java Win32Display.java Log Message: Clean up java code Index: Win32Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Win32Display.java 23 Feb 2005 11:11:07 -0000 1.13 +++ Win32Display.java 23 Feb 2005 11:45:25 -0000 1.14 @@ -48,8 +48,6 @@ import org.lwjgl.input.Cursor; final class Win32Display implements DisplayImplementation { -// private static final int PBUFFER_HANDLE_SIZE = 24; - private static Win32DisplayPeerInfo peer_info; public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException { @@ -70,14 +68,10 @@ public native boolean isVisible(); public native boolean isActive(); public native boolean isDirty(); -// public native void swapBuffers(); -// public native void makeCurrent() throws LWJGLException; public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { peer_info = new Win32DisplayPeerInfo(pixel_format); return peer_info; } -// public native void createContext(PixelFormat pixel_format) throws LWJGLException; -// public native void destroyContext(); public void update() { nUpdate(); if (didMaximize()) { @@ -97,7 +91,6 @@ private native void nUpdate(); private native boolean didMaximize(); -// public native void setVSyncEnabled(boolean sync); public native void reshape(int x, int y, int width, int height); public native DisplayMode[] getAvailableDisplayModes() throws LWJGLException; @@ -136,29 +129,12 @@ return ((Win32PbufferPeerInfo)handle).isBufferLost(); } -// public native boolean isBufferLost(ByteBuffer handle); -// public native void makePbufferCurrent(ByteBuffer handle) throws LWJGLException; - public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { return new Win32PbufferPeerInfo(width, height, pixel_format, pixelFormatCaps, pBufferAttribs); } -/* public ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, - IntBuffer pixelFormatCaps, - IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException { - ByteBuffer handle = BufferUtils.createByteBuffer(PBUFFER_HANDLE_SIZE); - nCreatePbuffer(handle, width, height, pixel_format, pixelFormatCaps, pBufferAttribs, shared_pbuffer_handle); - return handle; - } - - private native void nCreatePbuffer(ByteBuffer handle, int width, int height, PixelFormat pixel_format, - IntBuffer pixelFormatCaps, - IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException; -*/ -// public native void destroyPbuffer(ByteBuffer handle); - public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { ((Win32PbufferPeerInfo)handle).setPbufferAttrib(attrib, value); } @@ -170,7 +146,4 @@ public void releaseTexImageFromPbuffer(PeerInfo handle, int buffer) { ((Win32PbufferPeerInfo)handle).releaseTexImageFromPbuffer(buffer); } -/* public native void setPbufferAttrib(ByteBuffer handle, int attrib, int value); - public native void bindTexImageToPbuffer(ByteBuffer handle, int buffer); - public native void releaseTexImageFromPbuffer(ByteBuffer handle, int buffer);*/ } Index: MacOSXDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- MacOSXDisplay.java 23 Feb 2005 11:11:07 -0000 1.23 +++ MacOSXDisplay.java 23 Feb 2005 11:45:25 -0000 1.24 @@ -201,19 +201,9 @@ return frame.getCanvas().syncIsDirty(); } -// public native void setView(MacOSXGLCanvas canvas); - -// public native void swapBuffers(); - -// public native void makeCurrent() throws LWJGLException; - public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { return new MacOSXDisplayPeerInfo(pixel_format); } -// public native void createContext(PixelFormat pixel_format) throws LWJGLException; - -// public native void destroyPeerInfo(); -// public native void destroyContext(); public void update() { if (frame.getCanvas().syncShouldUpdateContext()) { @@ -246,8 +236,6 @@ private native void updateContext(); -// public native void setVSyncEnabled(boolean sync); - public void reshape(int x, int y, int width, int height) { frame.resize(x, y, width, height); } @@ -423,28 +411,12 @@ return false; } -// public native void makePbufferCurrent(ByteBuffer handle) throws LWJGLException; - public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { return new MacOSXPbufferPeerInfo(width, height, pixel_format); } -/* public ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, - IntBuffer pixelFormatCaps, - IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException { - ByteBuffer handle = BufferUtils.createByteBuffer(PBUFFER_HANDLE_SIZE); - nCreatePbuffer(handle, width, height, pixel_format, pixelFormatCaps, pBufferAttribs, shared_pbuffer_handle); - return handle; - } - - private native void nCreatePbuffer(ByteBuffer handle, int width, int height, PixelFormat pixel_format, - IntBuffer pixelFormatCaps, - IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException; -*/ -// public native void destroyPbuffer(ByteBuffer handle); - public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { throw new UnsupportedOperationException(); } Index: LinuxDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- LinuxDisplay.java 23 Feb 2005 11:11:07 -0000 1.18 +++ LinuxDisplay.java 23 Feb 2005 11:45:24 -0000 1.19 @@ -48,7 +48,6 @@ import org.lwjgl.input.Keyboard; final class LinuxDisplay implements DisplayImplementation { -// private static final int PBUFFER_HANDLE_SIZE = 24; private static final int NUM_BUTTONS = 3; private static PeerInfo peer_info; @@ -370,40 +369,6 @@ return false; } -/* public void makePbufferCurrent(ByteBuffer handle) throws LWJGLException { - lockAWT(); - try { - nMakePbufferCurrent(handle); - } finally { - unlockAWT(); - } - } - - private static native void nMakePbufferCurrent(ByteBuffer handle) throws LWJGLException; -*/ -/* public ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, - IntBuffer pixelFormatCaps, - IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException { - lockAWT(); - try { - ByteBuffer handle = BufferUtils.createByteBuffer(PBUFFER_HANDLE_SIZE); - incDisplay(); - try { - nCreatePbuffer(handle, width, height, pixel_format, pixelFormatCaps, pBufferAttribs, shared_pbuffer_handle); - return handle; - } catch (LWJGLException e) { - decDisplay(); - throw e; - } - } finally { - unlockAWT(); - } - } - - private static native void nCreatePbuffer(ByteBuffer handle, int width, int height, PixelFormat pixel_format, - IntBuffer pixelFormatCaps, - IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException; -*/ public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:42:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26806/win32 Modified Files: Window.h org_lwjgl_opengl_Display.c org_lwjgl_opengl_Pbuffer.c Log Message: Clean out commented code Index: org_lwjgl_opengl_Pbuffer.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Pbuffer.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- org_lwjgl_opengl_Pbuffer.c 21 Feb 2005 14:46:47 -0000 1.10 +++ org_lwjgl_opengl_Pbuffer.c 23 Feb 2005 11:42:04 -0000 1.11 @@ -78,78 +78,6 @@ return caps; } -/*static HPBUFFERARB createPbuffer(JNIEnv *env, int width, int height, jobject pixel_format, jobject pixelFormatCaps, const int *pBufferAttribs_ptr) { - HWND dummy_hwnd = createWindow(0, 0, 1, 1, false, false); - HDC dummy_hdc; - int iPixelFormat; - HGLRC dummy_hglrc; - BOOL result; - HPBUFFERARB Pbuffer; - bool pbuffers_supported; - - if (dummy_hwnd == NULL) { - throwException(env, "Could not create dummy window"); - return NULL; - } - dummy_hdc = GetDC(dummy_hwnd); - iPixelFormat = findPixelFormat(env, dummy_hdc, pixel_format); - if (iPixelFormat == -1) { - return NULL; - } - if (!applyPixelFormat(dummy_hdc, iPixelFormat)) { - closeWindow(&dummy_hwnd, &dummy_hdc); - throwException(env, "Could not apply pixel format to window"); - return NULL; - } - - dummy_hglrc = wglCreateContext(dummy_hdc); - if (dummy_hglrc == NULL) { - closeWindow(&dummy_hwnd, &dummy_hdc); - throwException(env, "Failed to create OpenGL rendering context"); - return NULL; - } - result = wglMakeCurrent(dummy_hdc, dummy_hglrc); - if (!result) { - wglDeleteContext(dummy_hglrc); - closeWindow(&dummy_hwnd, &dummy_hdc); - throwException(env, "Could not bind context to dummy window"); - return NULL; - } - extgl_InitWGL(env); - pbuffers_supported = isPbuffersSupported(); - iPixelFormat = findPixelFormatARB(env, dummy_hdc, pixel_format, pixelFormatCaps, false, false, true, false); - if (iPixelFormat == -1) - iPixelFormat = findPixelFormatARB(env, dummy_hdc, pixel_format, pixelFormatCaps, false, false, true, true); - wglDeleteContext(dummy_hglrc); - if (!pbuffers_supported) { - closeWindow(&dummy_hwnd, &dummy_hdc); - throwException(env, "No Pbuffer support."); - return NULL; - } - if (iPixelFormat == -1) { - closeWindow(&dummy_hwnd, &dummy_hdc); - throwException(env, "Could not find suitable pixel format."); - return NULL; - } - Pbuffer = wglCreatePbufferARB(dummy_hdc, iPixelFormat, width, height, pBufferAttribs_ptr); - closeWindow(&dummy_hwnd, &dummy_hdc); - return Pbuffer; -} - -static HGLRC createPbufferContext(JNIEnv *env, HDC Pbuffer_dc, HGLRC shared_context) { - HGLRC Pbuffer_context = wglCreateContext(Pbuffer_dc); - if (Pbuffer_context == NULL) { - throwException(env, "Failed to create Pbuffer rendering context"); - return NULL; - } - if (shared_context != NULL && !wglShareLists(shared_context, Pbuffer_context)) { - wglDeleteContext(Pbuffer_context); - throwException(env, "Could not share buffer context."); - return NULL; - } - return Pbuffer_context; -} -*/ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nCreate (JNIEnv *env, jobject self, jobject peer_info_handle, jint width, jint height, jobject pixel_format, @@ -214,71 +142,6 @@ wglQueryPbufferARB(peer_info->pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost); return buffer_lost ? JNI_TRUE : JNI_FALSE; } -/* HDC Pbuffer_dc; - HGLRC Pbuffer_context; - HGLRC shared_context; - PbufferInfo *Pbuffer_info; - if ((*env)->GetDirectBufferCapacity(env, buffer_handle) < sizeof(PbufferInfo)) { - throwException(env, "Buffer handle not large enough"); - return; - } - Pbuffer = createPbuffer(env, width, height, pixel_format, pixelFormatCaps, pBufferAttribs_ptr); - - if (Pbuffer == NULL) { - throwException(env, "Could not create Pbuffer."); - return; - } - - Pbuffer_dc = wglGetPbufferDCARB(Pbuffer); - if (Pbuffer_dc == NULL) { - wglDestroyPbufferARB(Pbuffer); - throwException(env, "Could not get Pbuffer dc."); - return; - } - shared_context = getCurrentContext(); - if (shared_context_handle_buffer != NULL) { - Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, shared_context_handle_buffer); - shared_context = Pbuffer_info->Pbuffer_context; - } - Pbuffer_context = createPbufferContext(env, Pbuffer_dc, shared_context); - if (Pbuffer_context == NULL) { - wglReleasePbufferDCARB(Pbuffer, Pbuffer_dc); - wglDestroyPbufferARB(Pbuffer); - return; - } - Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, buffer_handle); - Pbuffer_info->Pbuffer = Pbuffer; - Pbuffer_info->Pbuffer_context = Pbuffer_context; - Pbuffer_info->Pbuffer_dc = Pbuffer_dc; -} - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isBufferLost - (JNIEnv *env, jobject self, jobject buffer_handle) -{ - PbufferInfo *Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, buffer_handle); - BOOL buffer_lost; - wglQueryPbufferARB(Pbuffer_info->Pbuffer, WGL_PBUFFER_LOST_ARB, &buffer_lost); - return buffer_lost ? JNI_TRUE : JNI_FALSE; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_makePbufferCurrent - (JNIEnv *env, jobject self, jobject buffer_handle) -{ - PbufferInfo *Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, buffer_handle); -// PbufferInfo *Pbuffer_info = (PbufferInfo *)handle; - if (!wglMakeCurrent(Pbuffer_info->Pbuffer_dc, Pbuffer_info->Pbuffer_context)) - throwException(env, "Could not make pbuffer context current"); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyPbuffer - (JNIEnv *env, jobject self, jobject buffer_handle) -{ - PbufferInfo *Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, buffer_handle); - wglDeleteContext(Pbuffer_info->Pbuffer_context); - wglReleasePbufferDCARB(Pbuffer_info->Pbuffer, Pbuffer_info->Pbuffer_dc); - wglDestroyPbufferARB(Pbuffer_info->Pbuffer); -} -*/ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32PbufferPeerInfo_nSetPbufferAttrib (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint attrib, jint value) { @@ -303,31 +166,3 @@ Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); wglReleaseTexImageARB(peer_info->pbuffer, buffer); } -/* -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setPbufferAttrib - (JNIEnv *env, jobject self, jobject buffer_handle, jint attrib, jint value) -{ - PbufferInfo *Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, buffer_handle); - - int attribs[3]; - - attribs[0] = attrib; - attribs[1] = value; - attribs[2] = 0; - - wglSetPbufferAttribARB(Pbuffer_info->Pbuffer, attribs); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_bindTexImageToPbuffer - (JNIEnv *env, jobject self, jobject buffer_handle, jint buffer) -{ - PbufferInfo *Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, buffer_handle); - wglBindTexImageARB(Pbuffer_info->Pbuffer, buffer); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_releaseTexImageFromPbuffer - (JNIEnv *env, jobject self, jobject buffer_handle, jint buffer) -{ - PbufferInfo *Pbuffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, buffer_handle); - wglReleaseTexImageARB(Pbuffer_info->Pbuffer, buffer); -}*/ Index: org_lwjgl_opengl_Display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Display.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- org_lwjgl_opengl_Display.c 21 Feb 2005 14:46:47 -0000 1.16 +++ org_lwjgl_opengl_Display.c 23 Feb 2005 11:42:04 -0000 1.17 @@ -51,7 +51,6 @@ static HWND display_hwnd = NULL; // Handle to the window static HDC display_hdc = NULL; // Device context -//static HGLRC display_hglrc = NULL; // OpenGL context static bool isFullScreen = false; // Whether we're fullscreen or not static bool isMinimized = false; // Whether we're minimized or not static bool isFocused = false; // whether we're focused or not @@ -61,24 +60,9 @@ // has recovered from minimized static bool closerequested; -//static int pixel_format_index; #define WINDOWCLASSNAME "LWJGL" -/*bool applyPixelFormat(HDC hdc, int iPixelFormat) { - PIXELFORMATDESCRIPTOR desc; - if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { - return false; - } - - // make that the pixel format of the device context - if (SetPixelFormat(hdc, iPixelFormat, &desc) == FALSE) { - return false; - } - return true; -} -*/ - HDC getCurrentHDC() { return display_hdc; } @@ -87,185 +71,6 @@ return display_hwnd; } -/*HGLRC getCurrentContext() { - return display_hglrc; -} - -static int findPixelFormatARBFromBPP(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixelFormatCaps, int bpp, bool window, bool pbuffer, bool double_buffer) { - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); - int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); - int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); - int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); - int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); - int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); - jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); - int iPixelFormat; - unsigned int num_formats_returned; - attrib_list_t attrib_list; - GLuint *pixelFormatCaps_ptr; - jlong pixelFormatCapsSize; - BOOL result; - jlong i; - - initAttribList(&attrib_list); - if (window) { - putAttrib(&attrib_list, WGL_DRAW_TO_WINDOW_ARB); putAttrib(&attrib_list, TRUE); - } - if (pbuffer) { - putAttrib(&attrib_list, WGL_DRAW_TO_PBUFFER_ARB); putAttrib(&attrib_list, TRUE); - } - putAttrib(&attrib_list, WGL_ACCELERATION_ARB); putAttrib(&attrib_list, WGL_FULL_ACCELERATION_ARB); - putAttrib(&attrib_list, WGL_PIXEL_TYPE_ARB); putAttrib(&attrib_list, WGL_TYPE_RGBA_ARB); - putAttrib(&attrib_list, WGL_DOUBLE_BUFFER_ARB); putAttrib(&attrib_list, double_buffer ? TRUE : FALSE); - putAttrib(&attrib_list, WGL_SUPPORT_OPENGL_ARB); putAttrib(&attrib_list, TRUE); - putAttrib(&attrib_list, WGL_COLOR_BITS_ARB); putAttrib(&attrib_list, bpp); - putAttrib(&attrib_list, WGL_ALPHA_BITS_ARB); putAttrib(&attrib_list, alpha); - putAttrib(&attrib_list, WGL_DEPTH_BITS_ARB); putAttrib(&attrib_list, depth); - putAttrib(&attrib_list, WGL_STENCIL_BITS_ARB); putAttrib(&attrib_list, stencil); - if (samples > 0 && extension_flags.WGL_ARB_multisample) { - putAttrib(&attrib_list, WGL_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); - putAttrib(&attrib_list, WGL_SAMPLES_ARB); putAttrib(&attrib_list, samples); - } - putAttrib(&attrib_list, WGL_ACCUM_BITS_ARB); putAttrib(&attrib_list, accum_bpp); - putAttrib(&attrib_list, WGL_ACCUM_ALPHA_BITS_ARB); putAttrib(&attrib_list, accum_alpha); - putAttrib(&attrib_list, WGL_STEREO_ARB); putAttrib(&attrib_list, stereo ? TRUE : FALSE); - putAttrib(&attrib_list, WGL_AUX_BUFFERS_ARB); putAttrib(&attrib_list, num_aux_buffers); - if ( pixelFormatCaps != NULL ) { - if ( !extension_flags.WGL_ARB_render_texture ) { - return -1; - } - - pixelFormatCaps_ptr = (GLuint *)(*env)->GetDirectBufferAddress(env, pixelFormatCaps); - pixelFormatCapsSize = (*env)->GetDirectBufferCapacity(env, pixelFormatCaps); - - for (i = 0; i < pixelFormatCapsSize; i++) - putAttrib(&attrib_list, pixelFormatCaps_ptr[i]); - } - putAttrib(&attrib_list, 0); putAttrib(&attrib_list, 0); - result = wglChoosePixelFormatARB(hdc, attrib_list.attribs, NULL, 1, &iPixelFormat, &num_formats_returned); - - if (result == FALSE || num_formats_returned < 1) { - return -1; - } - return iPixelFormat; -} - -int findPixelFormatARB(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer) { - int bpp; - int iPixelFormat; - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - if (use_hdc_bpp) { - bpp = GetDeviceCaps(hdc, BITSPIXEL); - iPixelFormat = findPixelFormatARBFromBPP(env, hdc, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); - if (iPixelFormat == -1) - bpp = 16; - else - return iPixelFormat; - } else - bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); - return findPixelFormatARBFromBPP(env, hdc, pixel_format, pixelFormatCaps, bpp, window, pbuffer, double_buffer); -} -*/ -/* - * Find an appropriate pixel format - */ -/* -static int findPixelFormatFromBPP(JNIEnv *env, HDC hdc, jobject pixel_format, int bpp) -{ - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); - int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); - int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); - int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); - int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); - int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); - jboolean stereo = (*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); - unsigned int flags = PFD_DRAW_TO_WINDOW | // support window - PFD_SUPPORT_OPENGL | - PFD_DOUBLEBUFFER | - (stereo ? PFD_STEREO : 0); - PIXELFORMATDESCRIPTOR desc; - int iPixelFormat; - PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd - 1, // version number - flags, // RGBA type - PFD_TYPE_RGBA, - (BYTE)bpp, - 0, 0, 0, 0, 0, 0, // color bits ignored - (BYTE)alpha, - 0, // shift bit ignored - accum_bpp + accum_alpha, // no accumulation buffer - 0, 0, 0, 0, // accum bits ignored - (BYTE)depth, - (BYTE)stencil, - num_aux_buffers, - PFD_MAIN_PLANE, // main layer - 0, // reserved - 0, 0, 0 // layer masks ignored - }; - // get the best available match of pixel format for the device context - iPixelFormat = ChoosePixelFormat(hdc, &pfd); - if (iPixelFormat == 0) { - printfDebugJava(env, "Failed to choose pixel format"); - return -1; - } - - if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { - printfDebugJava(env, "Could not describe pixel format"); - return -1; - } - - if (desc.cColorBits < bpp) { - printfDebugJava(env, "Insufficient color precision"); - return -1; - } - - if (desc.cAlphaBits < alpha) { - printfDebugJava(env, "Insufficient alpha precision"); - return -1; - } - - if (desc.cStencilBits < stencil) { - printfDebugJava(env, "Insufficient stencil precision"); - return -1; - } - - if (desc.cDepthBits < depth) { - printfDebugJava(env, "Insufficient depth buffer precision"); - return -1; - } - - if ((desc.dwFlags & PFD_GENERIC_FORMAT) != 0 || (desc.dwFlags & PFD_GENERIC_ACCELERATED) != 0) { - jboolean allowSoftwareOpenGL = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); - // secondary check for software override - if(!allowSoftwareOpenGL) { - printfDebugJava(env, "Pixel format not accelerated"); - return -1; - } - } - - if ((desc.dwFlags & flags) != flags) { - printfDebugJava(env, "Capabilities not supported"); - return -1; - } - - return iPixelFormat; -} - -int findPixelFormat(JNIEnv *env, HDC hdc, jobject pixel_format) { - int bpp = GetDeviceCaps(hdc, BITSPIXEL); - int iPixelFormat; - iPixelFormat = findPixelFormatFromBPP(env, hdc, pixel_format, bpp); - if (iPixelFormat == -1) { - return findPixelFormatFromBPP(env, hdc, pixel_format, 16); - } else - return iPixelFormat; -} -*/ /* * Called when the application is alt-tabbed to or from */ @@ -408,36 +213,6 @@ } /* - * Register the LWJGL window class. - * Returns true for success, or false for failure - */ -/*static bool registerWindow() -{ - WNDCLASS windowClass; - if (!oneShotInitialised) { - windowClass.style = CS_OWNDC; - windowClass.lpfnWndProc = lwjglWindowProc; - windowClass.cbClsExtra = 0; - windowClass.cbWndExtra = 0; - windowClass.hInstance = dll_handle; - windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); - windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); - windowClass.hbrBackground = NULL; - windowClass.lpszMenuName = NULL; - windowClass.lpszClassName = WINDOWCLASSNAME; - - if (RegisterClass(&windowClass) == 0) { - printfDebug("Failed to register window class\n"); - return false; - } - printfDebug("Window registered\n"); - oneShotInitialised = true; - } - - return true; -} -*/ -/* * Handle native Win32 messages */ void handleMessages(void) @@ -473,11 +248,6 @@ free(title); } -/* - * Class: org_lwjgl_Window - * Method: update - * Signature: ()V - */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_nUpdate (JNIEnv * env, jobject self) { @@ -485,23 +255,6 @@ } -/* - * Class: org_lwjgl_Window - * Method: swapBuffers - * Signature: ()V - */ -/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_swapBuffers - (JNIEnv * env, jobject self) -{ - isDirty = false; - SwapBuffers(display_hdc); -} -*/ -/* - * Class: org_lwjgl_opengl_Window - * Method: nIsDirty - * Signature: ()Z - */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isDirty (JNIEnv *env, jobject self) { bool result = isDirty; @@ -509,21 +262,11 @@ return result ? JNI_TRUE : JNI_FALSE; } -/* - * Class: org_lwjgl_opengl_Window - * Method: nIsVisible - * Signature: ()Z - */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isVisible (JNIEnv *env, jobject self) { return isMinimized ? JNI_FALSE : JNI_TRUE; } -/* - * Class: org_lwjgl_opengl_Window - * Method: nIsCloseRequested - * Signature: ()Z - */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isCloseRequested (JNIEnv *env, jobject self) { bool saved = closerequested; @@ -531,41 +274,11 @@ return saved; } -/* - * Class: org_lwjgl_opengl_Window - * Method: nIsActive - * Signature: ()Z - */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Win32Display_isActive (JNIEnv *env, jobject self) { return isFocused; } -/* - * Class: org_lwjgl_opengl_Window - * Method: nSetVSyncEnabled - * Signature: (Z)Z - */ -/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_setVSyncEnabled - (JNIEnv * env, jobject self, jboolean sync) -{ - if (extension_flags.WGL_EXT_swap_control) { - if (sync == JNI_TRUE) { - wglSwapIntervalEXT(1); - } else { - wglSwapIntervalEXT(0); - } - } -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_makeCurrent - (JNIEnv *env, jobject self) -{ - BOOL result = wglMakeCurrent(display_hdc, display_hglrc); - if (!result) - throwException(env, "Could not make display context current"); -} -*/ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_Win32Display_getAvailableDisplayModes(JNIEnv *env, jobject self) { return getAvailableDisplayModes(env); } @@ -598,12 +311,6 @@ return; } display_hdc = GetDC(display_hwnd); -/* if (!applyPixelFormat(display_hdc, pixel_format_index)) { - closeWindow(&display_hwnd, &display_hdc); - throwException(env, "Could not apply pixel format to window"); - return; - } -*/ ShowWindow(display_hwnd, SW_SHOWDEFAULT); UpdateWindow(display_hwnd); SetForegroundWindow(display_hwnd); @@ -642,119 +349,6 @@ return initDisplay(env); } -/*bool createARBContextAndPixelFormat(JNIEnv *env, HDC hdc, jobject pixel_format, int *pixel_format_index_return, HGLRC *context_return) { - int pixel_format_index; - HWND arb_hwnd; - HDC arb_hdc; - HGLRC arb_context; - - // Some crazy strangeness here so we can use ARB_pixel_format to specify the number - // of multisamples we want. If the extension is present we'll delete the existing - // rendering context and start over, using the ARB extension instead to pick the context. - if (!extension_flags.WGL_ARB_pixel_format) - return false; - pixel_format_index = findPixelFormatARB(env, hdc, pixel_format, NULL, true, true, true, true); - if (pixel_format_index == -1) { - pixel_format_index = findPixelFormatARB(env, hdc, pixel_format, NULL, true, true, false, true); - if ( pixel_format_index == -1) - return false; - } - - arb_hwnd = createWindow(0, 0, 1, 1, false, false); - if (arb_hwnd == NULL) - return false; - - arb_hdc = GetDC(arb_hwnd); - if (!applyPixelFormat(arb_hdc, pixel_format_index)) { - closeWindow(&arb_hwnd, &arb_hdc); - return false; - } - - arb_context = wglCreateContext(arb_hdc); - if (arb_context == NULL) { - closeWindow(&arb_hwnd, &arb_hdc); - return false; - } - if (!wglMakeCurrent(arb_hdc, arb_context)) { - wglDeleteContext(arb_context); - closeWindow(&arb_hwnd, &arb_hdc); - return false; - } - - extgl_InitWGL(env); - wglMakeCurrent(NULL, NULL); - closeWindow(&arb_hwnd, &arb_hdc); - *pixel_format_index_return = pixel_format_index; - *context_return = arb_context; - - return true; -} -*/ -/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_createContext(JNIEnv *env, jobject self, jobject pixel_format) { - HWND dummy_hwnd; - HDC dummy_hdc; - BOOL result; - jclass cls_pixel_format; - int samples; - int pixel_format_index_arb; - HGLRC context_arb; - bool arb_success; - dummy_hwnd = createWindow(0, 0, 1, 1, false, false); - if (dummy_hwnd == NULL) { - throwException(env, "Failed to create the window."); - return; - } - dummy_hdc = GetDC(dummy_hwnd); - pixel_format_index = findPixelFormat(env, dummy_hdc, pixel_format); - if (pixel_format_index == -1) { - return; - } - if (!applyPixelFormat(dummy_hdc, pixel_format_index)) { - closeWindow(&dummy_hwnd, &dummy_hdc); - throwException(env, "Could not apply pixel format to window"); - return; - } - display_hglrc = wglCreateContext(dummy_hdc); - if (display_hglrc == NULL) { - closeWindow(&dummy_hwnd, &dummy_hdc); - throwException(env, "Failed to create OpenGL rendering context"); - return; - } - result = wglMakeCurrent(dummy_hdc, display_hglrc); - if (!result) { - throwException(env, "Could not bind context to dummy window"); - wglDeleteContext(display_hglrc); - closeWindow(&dummy_hwnd, &dummy_hdc); - return; - } - extgl_InitWGL(env); - cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - if (samples > 0) { - arb_success = createARBContextAndPixelFormat(env, dummy_hdc, pixel_format, &pixel_format_index_arb, &context_arb); - closeWindow(&dummy_hwnd, &dummy_hdc); - wglDeleteContext(display_hglrc); - if (!arb_success) { - throwException(env, "Samples > 0 but could not find a suitable ARB pixel format"); - return; - } - display_hglrc = context_arb; - pixel_format_index = pixel_format_index_arb; - } else - closeWindow(&dummy_hwnd, &dummy_hdc); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_destroyContext(JNIEnv *env, jobject self) { - wglMakeCurrent(NULL, NULL); - - // Delete the rendering context - if (display_hglrc != NULL) { - printfDebug("Deleting GL context\n"); - wglDeleteContext(display_hglrc); - display_hglrc = NULL; - } -} -*/ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32Display_reshape(JNIEnv *env, jobject self, jint x, jint y, jint width, jint height) { int exstyle, windowflags; RECT clientSize; Index: Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/Window.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- Window.h 21 Feb 2005 14:46:47 -0000 1.23 +++ Window.h 23 Feb 2005 11:42:04 -0000 1.24 @@ -64,12 +64,6 @@ WINDOW_H_API HDC getCurrentHDC(); -// WINDOW_H_API HGLRC getCurrentContext(); - -// WINDOW_H_API bool applyPixelFormat(HDC hdc, int iPixelFormat); - -// WINDOW_H_API void closeWindow(HWND *hwnd, HDC *hdc); - WINDOW_H_API void handleMouseMoved(int x, int y); WINDOW_H_API void handleMouseScrolled(int dwheel); @@ -79,17 +73,6 @@ WINDOW_H_API void handleMessages(void); /* - * Find a suitable pixel format - */ -// WINDOW_H_API int findPixelFormat(JNIEnv *env, HDC hdc, jobject pixel_format); - - /* - * Find a suitable pixel format using the WGL_ARB_pixel_format extension - */ -// WINDOW_H_API int findPixelFormatARB(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixelFormatCaps, bool use_hdc_bpp, bool window, bool pbuffer, bool double_buffer); - - - /* * Handle native Win32 messages */ WINDOW_H_API void handleMessage(JNIEnv * env, jobject obj); |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:42:13
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26806/macosx Modified Files: org_lwjgl_opengl_Display.m Log Message: Clean out commented code Index: org_lwjgl_opengl_Display.m =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- org_lwjgl_opengl_Display.m 23 Feb 2005 11:11:07 -0000 1.8 +++ org_lwjgl_opengl_Display.m 23 Feb 2005 11:42:03 -0000 1.9 @@ -49,131 +49,6 @@ #define WAIT_DELAY 100 -/*static NSOpenGLContext *gl_context; - -NSOpenGLContext *createContext(JNIEnv *env, jobject pixel_format, bool double_buffered, bool use_display_bpp, long drawable_type, NSOpenGLContext *share_context) { - int bpp; - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - if (use_display_bpp) - bpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); - else - bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); - - int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); - int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); - int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); - int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); - int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); - int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); - bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); - - attrib_list_t attribs; - jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); - initAttribList(&attribs); - if (!allow_software_acceleration) - putAttrib(&attribs, NSOpenGLPFAAccelerated); - if (double_buffered) - putAttrib(&attribs, NSOpenGLPFADoubleBuffer); - putAttrib(&attribs, NSOpenGLPFAColorSize); putAttrib(&attribs, bpp); - putAttrib(&attribs, NSOpenGLPFAAlphaSize); putAttrib(&attribs, alpha); - putAttrib(&attribs, NSOpenGLPFADepthSize); putAttrib(&attribs, depth); - putAttrib(&attribs, NSOpenGLPFAStencilSize); putAttrib(&attribs, stencil); - putAttrib(&attribs, NSOpenGLPFAAccumSize); putAttrib(&attribs, accum_bpp + accum_alpha); - putAttrib(&attribs, NSOpenGLPFASampleBuffers); putAttrib(&attribs, samples > 0 ? 1 : 0); - putAttrib(&attribs, NSOpenGLPFASamples); putAttrib(&attribs, samples); - putAttrib(&attribs, NSOpenGLPFAAuxBuffers); putAttrib(&attribs, num_aux_buffers); - putAttrib(&attribs, drawable_type); - if (stereo) - putAttrib(&attribs, NSOpenGLPFAStereo); - putAttrib(&attribs, 0); - NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:(NSOpenGLPixelFormatAttribute *)attribs.attribs]; - - if (fmt == nil) { - throwException(env, "Could not create pixel format"); - return NULL; - } - - NSOpenGLContext *context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:share_context]; - - [fmt release]; - if (context == nil) - throwException(env, "Could not create context"); - return context; -} - -NSOpenGLContext *getDisplayContext() { - return gl_context; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_createContext(JNIEnv *env, jobject this, jobject pixel_format) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - gl_context = createContext(env, pixel_format, true, true, NSOpenGLPFAWindow, nil); - [pool release]; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_updateContext(JNIEnv *env, jobject this) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [gl_context update]; - [pool release]; -} - -static void setView(JNIEnv *env, jobject canvas) { - JAWT awt; - JAWT_DrawingSurface* ds; - JAWT_DrawingSurfaceInfo* dsi; - JAWT_MacOSXDrawingSurfaceInfo* dsi_mac; - jboolean result = JNI_FALSE; - jint lock = 0; - - // get the AWT - awt.version = JAWT_VERSION_1_4; - NSView *view; - while (true) { - result = JAWT_GetAWT(env, &awt); - if (result == JNI_FALSE) { - throwException(env, "Could not get the JAWT interface"); - return; - } - - ds = awt.GetDrawingSurface(env, canvas); - if (ds == NULL) { - throwException(env, "Could not get the drawing surface"); - return; - } - - lock = ds->Lock(ds); - if((lock & JAWT_LOCK_ERROR) != 0) { - awt.FreeDrawingSurface(ds); - throwException(env, "Could not lock the drawing surface"); - return; - } - - dsi = ds->GetDrawingSurfaceInfo(ds); - if (dsi != NULL) { - dsi_mac = (JAWT_MacOSXDrawingSurfaceInfo*)dsi->platformInfo; - view = dsi_mac->cocoaViewRef; - if ([view lockFocusIfCanDraw] == YES) - break; - view = NULL; - ds->FreeDrawingSurfaceInfo(dsi); - } - - printfDebug("Could not get drawing surface info, retrying... \n"); - ds->Unlock(ds); - awt.FreeDrawingSurface(ds); - usleep(WAIT_DELAY); - } - - [gl_context setView:view]; - - [view unlockFocus]; - - ds->FreeDrawingSurfaceInfo(dsi); - ds->Unlock(ds); - awt.FreeDrawingSurface(ds); -} -*/ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_restoreGamma(JNIEnv *env, jobject this) { CGDisplayRestoreColorSyncSettings(); } @@ -194,43 +69,3 @@ SetSystemUIMode(kUIModeNormal, 0); } } -/* -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_setVSyncEnabled(JNIEnv *env, jobject this, jboolean vsync) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - long vsync_value = vsync == JNI_TRUE ? 1 : 0; - [gl_context setValues:&vsync_value forParameter:NSOpenGLCPSwapInterval]; - [pool release]; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_swapBuffers(JNIEnv *env, jobject this) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [gl_context flushBuffer]; - [pool release]; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_setView(JNIEnv *env, jobject this, jobject canvas) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - if (canvas != NULL) { - setView(env, canvas); - } else { - [gl_context clearDrawable]; - } - [pool release]; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_makeCurrent(JNIEnv *env, jobject this) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [gl_context makeCurrentContext]; - [pool release]; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_destroyContext(JNIEnv *env, jobject this) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - if (gl_context != nil) { - [gl_context clearDrawable]; - [gl_context release]; - gl_context = nil; - } - [pool release]; -} -*/ |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:38:34
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25828 Modified Files: org_lwjgl_opengl_Display.c org_lwjgl_opengl_Pbuffer.c Log Message: Clean out commented code Index: org_lwjgl_opengl_Pbuffer.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- org_lwjgl_opengl_Pbuffer.c 20 Feb 2005 11:24:22 -0000 1.12 +++ org_lwjgl_opengl_Pbuffer.c 23 Feb 2005 11:38:24 -0000 1.13 @@ -46,12 +46,7 @@ #include "context.h" #include "Window.h" #include "common_tools.h" -/* -typedef struct _PbufferInfo { - GLXPbuffer buffer; - GLXContext context; -} PbufferInfo; -*/ + static bool isPbuffersSupported() { // Only support the GLX 1.3 Pbuffers and ignore the GLX_SGIX_pbuffer extension return extension_flags.GLX13 ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0; @@ -63,67 +58,6 @@ return isPbuffersSupported() ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0; } -/*static void destroyPbuffer(PbufferInfo *buffer_info) { - GLXPbuffer buffer = buffer_info->buffer; - GLXContext context = buffer_info->context; - glXDestroyPbuffer(getDisplay(), buffer); - releaseContext(context); - glXDestroyContext(getDisplay(), context); -} -*/ -/*static bool checkPbufferCaps(JNIEnv *env, GLXFBConfig config, int width, int height) { - int max; - int result = glXGetFBConfigAttrib(getDisplay(), config, GLX_MAX_PBUFFER_WIDTH, &max); - if (result != Success) { - throwException(env, "Could not get GLX_MAX_PBUFFER_WIDTH from configuration"); - return false; - } - if (max < width) { - throwException(env, "Width too large"); - return false; - } - result = glXGetFBConfigAttrib(getDisplay(), config, GLX_MAX_PBUFFER_HEIGHT, &max); - if (result != Success) { - throwException(env, "Could not get GLX_MAX_PBUFFER_WIDTH from configuration"); - return false; - } - if (max < height) { - throwException(env, "Height too large"); - return false; - } - return true; -} - -static bool createPbufferUsingUniqueContext(JNIEnv *env, PbufferInfo *pbuffer_info, jobject pixel_format, int width, int height, const int *buffer_attribs, GLXContext shared_context) { - GLXFBConfig *configs = chooseVisualGLX13(env, getDisplay(), getCurrentScreen(), pixel_format, false, GLX_PBUFFER_BIT, false); - if (configs == NULL) { - throwException(env, "No matching pixel format"); - return false; - } - if (!checkPbufferCaps(env, configs[0], width, height)) { - XFree(configs); - return false; - } - GLXContext context = glXCreateNewContext(getDisplay(), configs[0], GLX_RGBA_TYPE, shared_context, True); - if (context == NULL) { - XFree(configs); - throwException(env, "Could not create a GLX context"); - return false; - } - jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); - if (!allow_software_acceleration && glXIsDirect(getDisplay(), context) == False) { - glXDestroyContext(getDisplay(), context); - XFree(configs); - throwException(env, "Could not create a direct GLX context"); - return false; - } - GLXPbuffer buffer = glXCreatePbuffer(getDisplay(), configs[0], buffer_attribs); - XFree(configs); - pbuffer_info->context = context; - pbuffer_info->buffer = buffer; - return true; -} -*/ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint width, jint height, jobject pixel_format) { if (!extgl_InitGLX(env, getDisplay(), getCurrentScreen()) || !isPbuffersSupported()) { @@ -151,55 +85,3 @@ X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); glXDestroyPbuffer(peer_info->display, peer_info->drawable); } -/* -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreatePbuffer(JNIEnv *env, jclass clazz, jobject handle_buffer, jint width, jint height, jobject pixel_format, jobject pixelFormatCaps, jobject pBufferAttribs, jobject shared_context_handle_buffer) -{ - if ((*env)->GetDirectBufferCapacity(env, handle_buffer) < sizeof(PbufferInfo)) { - throwException(env, "Handle buffer not large enough"); - return; - } - int current_screen = getCurrentScreen(); - if (!extgl_InitGLX(env, getDisplay(), current_screen) || !isPbuffersSupported()) { - throwException(env, "No Pbuffer support"); - return; - } - - const int buffer_attribs[] = {GLX_PBUFFER_WIDTH, width, - GLX_PBUFFER_HEIGHT, height, - GLX_PRESERVED_CONTENTS, True, - GLX_LARGEST_PBUFFER, False, - None, None}; - - GLXContext shared_context = getDisplayContext(); - if (shared_context_handle_buffer != NULL) { - PbufferInfo *shared_buffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, shared_context_handle_buffer); - shared_context = shared_buffer_info->context; - } - PbufferInfo *buffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, handle_buffer); - bool result; - result = createPbufferUsingUniqueContext(env, buffer_info, pixel_format, width, height, buffer_attribs, shared_context); - if (!result) - return; - if (!checkXError(env, getDisplay())) { - destroyPbuffer(buffer_info); - return; - } -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nMakePbufferCurrent - (JNIEnv *env, jclass clazz, jobject handle_buffer) -{ - PbufferInfo *buffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, handle_buffer); - GLXPbuffer buffer = buffer_info->buffer; - GLXContext context = buffer_info->context; - if (glXMakeContextCurrent(getDisplay(), buffer, buffer, context) == False) { - throwException(env, "Could not make pbuffer context current"); - } -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyPbuffer - (JNIEnv *env, jclass clazz, jobject handle_buffer) -{ - PbufferInfo *buffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, handle_buffer); - destroyPbuffer(buffer_info); -}*/ Index: org_lwjgl_opengl_Display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- org_lwjgl_opengl_Display.c 20 Feb 2005 11:24:22 -0000 1.24 +++ org_lwjgl_opengl_Display.c 23 Feb 2005 11:38:24 -0000 1.25 @@ -56,7 +56,6 @@ #include "org_lwjgl_opengl_LinuxDisplay.h" #include "org_lwjgl_opengl_LinuxDisplayPeerInfo.h" -//#define USEGLX13 extension_flags.GLX13 #define ERR_MSG_SIZE 1024 typedef struct { @@ -71,10 +70,7 @@ typedef enum {FULLSCREEN_LEGACY, FULLSCREEN_NETWM, WINDOWED} window_mode; -//static GLXContext display_context = NULL; // OpenGL rendering context -//static GLXFBConfig *configs = NULL; static GLXWindow glx_window = None; -//static XVisualInfo *vis_info = NULL; static Atom delete_atom; static Colormap cmap; @@ -99,10 +95,6 @@ static char error_message[ERR_MSG_SIZE]; static Atom warp_atom; -/*GLXContext getDisplayContext(void) { - return display_context; -} -*/ int getCurrentScreen(void) { return current_screen; } @@ -468,103 +460,6 @@ handleMessages(env); } -/*bool releaseContext(GLXContext context) { - if (glXGetCurrentContext() != context) - return true; - if (USEGLX13) - return glXMakeContextCurrent(getDisplay(), None, None, NULL) == True; - else - return glXMakeCurrent(getDisplay(), None, NULL) == True; -} - -static bool makeCurrent(void) { - if (USEGLX13) - return glXMakeContextCurrent(getDisplay(), glx_window, glx_window, display_context) == True; - else - return glXMakeCurrent(getDisplay(), getCurrentWindow(), display_context) == True; -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nMakeCurrent - (JNIEnv *env, jclass clazz) -{ - if (!makeCurrent()) - throwException(env, "Could not make display context current"); -} -*/ -/*static void destroyContext(void) { - if (USEGLX13) { - XFree(configs); - configs = NULL; - } - XFree(vis_info); - vis_info = NULL; - releaseContext(display_context); - glXDestroyContext(getDisplay(), display_context); - display_context = NULL; -} -*/ -/*static bool initWindowGLX13(JNIEnv *env, jobject pixel_format) { - configs = chooseVisualGLX13(env, getDisplay(), getCurrentScreen(), pixel_format, true, GLX_WINDOW_BIT, true); - if (configs == NULL) { - throwException(env, "Could not find a matching pixel format"); - return false; - } - display_context = glXCreateNewContext(getDisplay(), configs[0], GLX_RGBA_TYPE, NULL, True); - if (display_context == NULL) { - XFree(configs); - throwException(env, "Could not create a GLX context"); - return false; - } - jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); - if (!allow_software_acceleration && (glXIsDirect(getDisplay(), display_context) == False)) { - glXDestroyContext(getDisplay(), display_context); - XFree(configs); - throwException(env, "Could not create a direct GLX context"); - return false; - } - vis_info = glXGetVisualFromFBConfig(getDisplay(), configs[0]); - if (vis_info == NULL) { - glXDestroyContext(getDisplay(), display_context); - XFree(configs); - throwException(env, "Could not get visual from FB config"); - return false; - } - if (!checkXError(env, getDisplay())) { - glXDestroyContext(getDisplay(), display_context); - XFree(configs); - XFree(vis_info); - return false; - } - return true; -} - -static bool initWindowGLX(JNIEnv *env, jobject pixel_format) { - vis_info = chooseVisualGLX(env, getDisplay(), getCurrentScreen(), pixel_format, true, true); - if (vis_info == NULL) { - throwException(env, "Could not find a matching pixel format"); - return false; - } - display_context = glXCreateContext(getDisplay(), vis_info, NULL, True); - if (display_context == NULL) { - XFree(vis_info); - throwException(env, "Could not create a GLX context"); - return false; - } - jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); - if (!allow_software_acceleration && glXIsDirect(getDisplay(), display_context) == False) { - glXDestroyContext(getDisplay(), display_context); - XFree(vis_info); - throwException(env, "Could not create a direct GLX context"); - return false; - } - if (!checkXError(env, getDisplay())) { - glXDestroyContext(getDisplay(), display_context); - XFree(vis_info); - return false; - } - return true; -} -*/ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz) { return getAvailableDisplayModes(env, getCurrentScreen()); } @@ -589,33 +484,6 @@ return initDisplay(env, getCurrentScreen()); } -/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateContext(JNIEnv *env, jclass clazz, jobject pixel_format) { - Display *disp = incDisplay(env); - if (disp == NULL) { - return; - } - current_screen = XDefaultScreen(disp); - if (!extgl_InitGLX(env, disp, current_screen)) { - decDisplay(); - throwException(env, "Could not init GLX"); - return; - } - - bool result; - if (USEGLX13) { - result = initWindowGLX13(env, pixel_format); - } else { - result = initWindowGLX(env, pixel_format); - } - if (!result) - decDisplay(); -} -*/ -/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyContext(JNIEnv *env, jclass clazz) { - destroyContext(); - decDisplay(); -} -*/ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject mode, jboolean fullscreen, jint x, jint y) { bool current_fullscreen = fullscreen == JNI_TRUE; if (current_fullscreen) { @@ -658,15 +526,6 @@ destroyWindow(env); } -/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwapBuffers(JNIEnv * env, jclass clazz) -{ - dirty = false; - if (USEGLX13) - glXSwapBuffers(getDisplay(), glx_window); - else - glXSwapBuffers(getDisplay(), getCurrentWindow()); -} -*/ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsDirty (JNIEnv *env, jclass clazz) { bool result = dirty; @@ -691,19 +550,6 @@ return focused || isLegacyFullscreen() ? JNI_TRUE : JNI_FALSE; } -/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetVSyncEnabled - (JNIEnv *env, jclass clazz, jboolean sync) -{ - if (extension_flags.GLX_SGI_swap_control) { - bool vsync = sync == JNI_TRUE ? true : false; - if (vsync != vsync_enabled) { - int interval = vsync ? 1 : 0; - glXSwapIntervalSGI(interval); - vsync_enabled = vsync; - } - } -} -*/ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_lockAWT(JNIEnv *env, jclass clazz) { JAWT jawt; jawt.version = JAWT_VERSION_1_4; |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:22:24
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22284/src/java/org/lwjgl Modified Files: LinuxSysImplementation.java Sys.java Log Message: Linux: Make sure libjawt.so can be loaded Index: LinuxSysImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- LinuxSysImplementation.java 3 Feb 2005 13:51:45 -0000 1.3 +++ LinuxSysImplementation.java 23 Feb 2005 11:22:14 -0000 1.4 @@ -40,6 +40,10 @@ * @version $Revision$ */ class LinuxSysImplementation extends J2SESysImplementation { + static { + java.awt.Toolkit.getDefaultToolkit(); // This will make sure libjawt.so is loaded + } + public boolean openURL(String url) { // Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it // right anyway. Index: Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -r1.78 -r1.79 --- Sys.java 21 Feb 2005 15:58:24 -0000 1.78 +++ Sys.java 23 Feb 2005 11:22:14 -0000 1.79 @@ -63,8 +63,8 @@ private final static SysImplementation implementation; static { - System.loadLibrary(LIBRARY_NAME); implementation = createImplementation(); + System.loadLibrary(LIBRARY_NAME); String native_version = implementation.getNativeLibraryVersion(); if (!native_version.equals(VERSION)) throw new LinkageError("Version mismatch: jar version is '" + VERSION + |
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20041/src/java/org/lwjgl/opengl Modified Files: AWTGLCanvas.java Context.java ContextImplementation.java Display.java DisplayImplementation.java LinuxContextImplementation.java LinuxDisplay.java LinuxDisplayPeerInfo.java LinuxPbufferPeerInfo.java MacOSXDisplay.java MacOSXFrame.java MacOSXGLCanvas.java Pbuffer.java PeerInfo.java Win32ContextImplementation.java Win32Display.java Win32DisplayPeerInfo.java Added Files: MacOSXAWTGLCanvasPeerInfo.java MacOSXCanvasImplementation.java MacOSXCanvasPeerInfo.java MacOSXContextImplementation.java MacOSXDisplayPeerInfo.java MacOSXPbufferPeerInfo.java MacOSXPeerInfo.java Log Message: Mac OS X port of the refactoring. Linux and Win32 fixes. --- NEW FILE: MacOSXPbufferPeerInfo.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import java.nio.IntBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: MacOSXPbufferPeerInfo.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class MacOSXPbufferPeerInfo extends MacOSXPeerInfo { public MacOSXPbufferPeerInfo(int width, int height, PixelFormat pixel_format) throws LWJGLException { super(pixel_format, false, false, true, false); nCreate(getHandle(), width, height); } private static native void nCreate(ByteBuffer handle, int width, int height) throws LWJGLException; public void destroy() { nDestroy(getHandle()); } private static native void nDestroy(ByteBuffer handle); protected void doLockAndInitHandle() throws LWJGLException { // NO-OP } protected void doUnlock() throws LWJGLException { // NO-OP } } Index: Win32DisplayPeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Win32DisplayPeerInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Win32DisplayPeerInfo.java 21 Feb 2005 14:46:43 -0000 1.1 +++ Win32DisplayPeerInfo.java 23 Feb 2005 11:11:07 -0000 1.2 @@ -45,11 +45,17 @@ */ final class Win32DisplayPeerInfo extends Win32PeerInfo { public Win32DisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { - createDummyDC(getHandle()); + GLContext.loadOpenGLLibrary(); try { - choosePixelFormat(0, 0, pixel_format, null, true, true, false, true); + createDummyDC(getHandle()); + try { + choosePixelFormat(0, 0, pixel_format, null, true, true, false, true); + } catch (LWJGLException e) { + nDestroy(getHandle()); + throw e; + } } catch (LWJGLException e) { - destroy(); + GLContext.unloadOpenGLLibrary(); throw e; } } @@ -60,10 +66,6 @@ } private static native void nInitDC(ByteBuffer peer_info_handle); - void destroy() { - nDestroy(getHandle()); - } - private static native void nDestroy(ByteBuffer peer_info_handle); protected void doLockAndInitHandle() throws LWJGLException { @@ -75,4 +77,10 @@ protected void doUnlock() throws LWJGLException { // NO-OP } + + public void destroy() { + super.destroy(); + nDestroy(getHandle()); + GLContext.unloadOpenGLLibrary(); + } } Index: ContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ContextImplementation.java 20 Feb 2005 11:24:17 -0000 1.1 +++ ContextImplementation.java 23 Feb 2005 11:11:06 -0000 1.2 @@ -61,6 +61,11 @@ public void releaseCurrentContext() throws LWJGLException; /** + * Update the context. Should be called whenever it's drawable is moved or resized + */ + public void update(ByteBuffer context_handle); + + /** * Query whether the context is current */ public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException; Index: AWTGLCanvas.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- AWTGLCanvas.java 22 Feb 2005 14:10:06 -0000 1.7 +++ AWTGLCanvas.java 23 Feb 2005 11:11:06 -0000 1.8 @@ -39,6 +39,13 @@ import org.lwjgl.LWJGLException; import org.lwjgl.Sys; +import java.awt.Point; +import java.awt.Dimension; +import java.awt.event.ComponentEvent; +import java.awt.event.HierarchyEvent; +import java.awt.event.ComponentListener; +import java.awt.event.HierarchyListener; + /** * $Id$ * <p> @@ -47,8 +54,9 @@ * @version $Revision$ * @author $Author$ */ -public class AWTGLCanvas extends Canvas implements Drawable { +public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener, HierarchyListener { private final static AWTCanvasImplementation implementation; + private boolean update_context; static { Sys.initialize(); @@ -59,7 +67,7 @@ } else if (OS_NAME.startsWith("Windows")) { class_name = "org.lwjgl.opengl.Win32CanvasImplementation"; } else if (OS_NAME.startsWith("Mac")) { - class_name = "org.lwjgl.opengl.DefaultCanvasImplementation"; + class_name = "org.lwjgl.opengl.MacOSXCanvasImplementation"; } else throw new IllegalStateException("The platform " + OS_NAME + " is not supported"); try { @@ -75,14 +83,20 @@ } /** The requested pixel format */ - private final PeerInfo peer_info; + private final PixelFormat pixel_format; /** The drawable to share context with */ private final Drawable drawable; /** Context handle */ + private PeerInfo peer_info; private Context context; + + private synchronized void setUpdate() { + update_context = true; + } + /** * This method should only be called internally. */ @@ -126,8 +140,9 @@ */ public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format, Drawable drawable) throws LWJGLException { super(implementation.findConfiguration(device, pixel_format)); - this.peer_info = implementation.createPeerInfo(this, pixel_format); + addHierarchyListener(this); this.drawable = drawable; + this.pixel_format = pixel_format; } /* (non-Javadoc) @@ -188,6 +203,8 @@ if (context != null) { context.forceDestroy(); context = null; + peer_info.destroy(); + peer_info = null; } } catch (LWJGLException e) { throw new RuntimeException(e); @@ -202,12 +219,19 @@ public final void paint(Graphics g) { try { + if (peer_info == null) + this.peer_info = implementation.createPeerInfo(this, pixel_format); peer_info.lockAndGetHandle(); try { - if (context == null) - context = new Context(peer_info, drawable != null ? drawable.getContext() : null); + if (context == null) { + this.context = new Context(peer_info, drawable != null ? drawable.getContext() : null); + } if (!context.isCurrent()) context.makeCurrent(); + if (update_context) { + context.update(); + update_context = false; + } paintGL(); } finally { peer_info.unlock(); @@ -223,4 +247,47 @@ public void update(Graphics g) { paint(g); } + + public void componentShown(ComponentEvent e) { + } + + public void componentHidden(ComponentEvent e) { + } + + public void componentResized(ComponentEvent e) { + setUpdate(); + } + + public void componentMoved(ComponentEvent e) { + setUpdate(); + } + + public void setLocation(int x, int y) { + super.setLocation(x, y); + setUpdate(); + } + + public void setLocation(Point p) { + super.setLocation(p); + setUpdate(); + } + + public void setSize(Dimension d) { + super.setSize(d); + setUpdate(); + } + + public void setSize(int width, int height) { + super.setSize(width, height); + setUpdate(); + } + + public void setBounds(int x, int y, int width, int height) { + super.setBounds(x, y, width, height); + setUpdate(); + } + + public void hierarchyChanged(HierarchyEvent e) { + setUpdate(); + } } Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Display.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- Display.java 20 Feb 2005 11:24:17 -0000 1.44 +++ Display.java 23 Feb 2005 11:11:06 -0000 1.45 @@ -86,6 +86,7 @@ private static boolean vsync; /** A unique context object, so we can track different contexts between creates() and destroys() */ + private static PeerInfo peer_info; private static Context context; private static boolean window_created = false; @@ -252,6 +253,13 @@ } private static void destroyWindow() { + try { + if (context.isCurrent()) + Context.releaseCurrentContext(); + } catch (LWJGLException e) { + Sys.log("Exception occurred while trying to release context"); + } + if (!window_created) throw new InternalError("Window already created"); // Automatically destroy keyboard, mouse, and controller @@ -583,7 +591,7 @@ if (fullscreen) switchDisplayMode(); try { - PeerInfo peer_info = display_impl.createPeerInfo(pixel_format); + peer_info = display_impl.createPeerInfo(pixel_format); context = new Context(peer_info, shared_drawable != null ? shared_drawable.getContext() : null); try { createWindow(); @@ -659,11 +667,11 @@ private static void destroyContext() { try { context.forceDestroy(); + peer_info.destroy(); } catch (LWJGLException e) { throw new RuntimeException(e); } finally { context = null; - display_impl.destroyPeerInfo(); } } --- NEW FILE: MacOSXAWTGLCanvasPeerInfo.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: MacOSXAWTGLCanvasPeerInfo.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class MacOSXAWTGLCanvasPeerInfo extends MacOSXCanvasPeerInfo { private final AWTGLCanvas canvas; public MacOSXAWTGLCanvasPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException { super(pixel_format); this.canvas = canvas; } protected void doLockAndInitHandle() throws LWJGLException { initHandle(canvas); } } Index: Pbuffer.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- Pbuffer.java 20 Feb 2005 11:24:17 -0000 1.38 +++ Pbuffer.java 23 Feb 2005 11:11:07 -0000 1.39 @@ -247,7 +247,7 @@ return; try { context.forceDestroy(); - Display.getImplementation().destroyPbuffer(peer_info); + peer_info.destroy(); destroyed = true; } catch (LWJGLException e) { Sys.log("Exception occurred while destroying pbuffer: " + e); --- NEW FILE: MacOSXContextImplementation.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.BufferUtils; /** * $Id: MacOSXContextImplementation.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class MacOSXContextImplementation implements ContextImplementation { private static PeerInfo getCurrentPeerInfo() { return Context.getCurrentContext().getPeerInfo(); } public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { return nCreate(peer_handle, shared_context_handle); } finally { peer_info.unlock(); } } private static native ByteBuffer nCreate(ByteBuffer peer_handle, ByteBuffer shared_context_handle) throws LWJGLException; public void swapBuffers() throws LWJGLException { Context current_context = Context.getCurrentContext(); nSwapBuffers(current_context.getHandle()); } private static native void nSwapBuffers(ByteBuffer context_handle) throws LWJGLException; public void update(ByteBuffer context_handle) { System.out.println("context_handle = " + context_handle); nUpdate(context_handle); } private static native void nUpdate(ByteBuffer context_handle); public void releaseCurrentContext() throws LWJGLException { Context current_context = Context.getCurrentContext(); if (current_context != null) clearDrawable(current_context.getHandle()); nReleaseCurrentContext(); } private static native void nReleaseCurrentContext() throws LWJGLException; private static native void clearDrawable(ByteBuffer handle) throws LWJGLException; public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { setView(peer_handle, handle); nMakeCurrent(handle); } finally { peer_info.unlock(); } } private static native void setView(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException; private static native void nMakeCurrent(ByteBuffer context_handle) throws LWJGLException; public boolean isCurrent(ByteBuffer handle) throws LWJGLException { boolean result = nIsCurrent(handle); return result; } private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; public void setVSync(boolean enabled) { nSetVSync(Context.getCurrentContext().getHandle(), enabled); } private static native void nSetVSync(ByteBuffer context_handle, boolean enabled); public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { nDestroy(handle); } private static native void nDestroy(ByteBuffer context_handle) throws LWJGLException; } Index: LinuxPbufferPeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxPbufferPeerInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- LinuxPbufferPeerInfo.java 20 Feb 2005 11:36:15 -0000 1.1 +++ LinuxPbufferPeerInfo.java 23 Feb 2005 11:11:07 -0000 1.2 @@ -45,12 +45,33 @@ */ final class LinuxPbufferPeerInfo extends LinuxPeerInfo { public LinuxPbufferPeerInfo(int width, int height, PixelFormat pixel_format) throws LWJGLException { - nInitHandle(getHandle(), width, height, pixel_format); + LinuxDisplay.lockAWT(); + try { + LinuxDisplay.incDisplay(); + try { + GLContext.loadOpenGLLibrary(); + try { + nInitHandle(getHandle(), width, height, pixel_format); + } catch (LWJGLException e) { + GLContext.unloadOpenGLLibrary(); + throw e; + } + } catch (LWJGLException e) { + LinuxDisplay.decDisplay(); + throw e; + } + } finally { + LinuxDisplay.unlockAWT(); + } } private static native void nInitHandle(ByteBuffer handle, int width, int height, PixelFormat pixel_format) throws LWJGLException; public void destroy() { + LinuxDisplay.lockAWT(); nDestroy(getHandle()); + LinuxDisplay.decDisplay(); + GLContext.unloadOpenGLLibrary(); + LinuxDisplay.unlockAWT(); } private static native void nDestroy(ByteBuffer handle); Index: DisplayImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- DisplayImplementation.java 20 Feb 2005 11:24:17 -0000 1.10 +++ DisplayImplementation.java 23 Feb 2005 11:11:07 -0000 1.11 @@ -108,7 +108,7 @@ */ PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException; - void destroyPeerInfo(); +// void destroyPeerInfo(); /** * Updates the windows internal state. This must be called at least once per video frame @@ -221,11 +221,6 @@ IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException; - /** - * Destroy pbuffer - */ - public void destroyPbuffer(PeerInfo handle); - public void setPbufferAttrib(PeerInfo handle, int attrib, int value); public void bindTexImageToPbuffer(PeerInfo handle, int buffer); Index: PeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/PeerInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PeerInfo.java 22 Feb 2005 13:35:08 -0000 1.2 +++ PeerInfo.java 23 Feb 2005 11:11:07 -0000 1.3 @@ -85,4 +85,7 @@ protected final ByteBuffer getHandle() { return handle; } + + public void destroy() { + } } Index: Win32Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Win32Display.java 21 Feb 2005 14:46:42 -0000 1.12 +++ Win32Display.java 23 Feb 2005 11:11:07 -0000 1.13 @@ -73,21 +73,11 @@ // public native void swapBuffers(); // public native void makeCurrent() throws LWJGLException; public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { - GLContext.loadOpenGLLibrary(); - try { - peer_info = new Win32DisplayPeerInfo(pixel_format); - return peer_info; - } catch (LWJGLException e) { - GLContext.unloadOpenGLLibrary(); - throw e; - } + peer_info = new Win32DisplayPeerInfo(pixel_format); + return peer_info; } // public native void createContext(PixelFormat pixel_format) throws LWJGLException; // public native void destroyContext(); - public void destroyPeerInfo() { - peer_info.destroy(); - GLContext.unloadOpenGLLibrary(); - } public void update() { nUpdate(); if (didMaximize()) { @@ -167,9 +157,6 @@ IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException; */ - public void destroyPbuffer(PeerInfo handle) { - ((Win32PbufferPeerInfo)handle).destroy(); - } // public native void destroyPbuffer(ByteBuffer handle); public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { Index: MacOSXFrame.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- MacOSXFrame.java 22 Jan 2005 00:34:49 -0000 1.10 +++ MacOSXFrame.java 23 Feb 2005 11:11:07 -0000 1.11 @@ -57,10 +57,10 @@ /* States */ private Rectangle bounds; - private boolean should_update; private boolean active; private boolean visible; private boolean minimized; + private boolean should_warp_cursor; MacOSXFrame(DisplayMode mode, java.awt.DisplayMode requested_mode, boolean fullscreen, int x, int y) throws LWJGLException { setResizable(false); @@ -160,8 +160,8 @@ public void windowActivated(WindowEvent e) { synchronized ( this ) { - should_update = true; active = true; + should_warp_cursor = true; } } @@ -190,11 +190,11 @@ return canvas; } - public boolean syncShouldUpdateContext() { + public boolean syncShouldWarpCursor() { boolean result; synchronized ( this ) { - result = canvas.syncShouldUpdateContext() || should_update; - should_update = false; + result = should_warp_cursor; + should_warp_cursor = false; } return result; } Index: MacOSXDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- MacOSXDisplay.java 20 Feb 2005 11:24:17 -0000 1.22 +++ MacOSXDisplay.java 23 Feb 2005 11:11:07 -0000 1.23 @@ -95,7 +95,7 @@ if (frame != null) { if (MacOSXFrame.getDevice().getFullScreenWindow() == frame) MacOSXFrame.getDevice().setFullScreenWindow(null); - setView(null); +// setView(null); if (frame.isDisplayable()) frame.dispose(); frame = null; @@ -193,29 +193,35 @@ return frame.syncIsActive(); } + public MacOSXFrame getFrame() { + return frame; + } + public boolean isDirty() { return frame.getCanvas().syncIsDirty(); } - public native void setView(MacOSXGLCanvas canvas); +// public native void setView(MacOSXGLCanvas canvas); // public native void swapBuffers(); // public native void makeCurrent() throws LWJGLException; public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { - throw new RuntimeException("Not supported yet"); + return new MacOSXDisplayPeerInfo(pixel_format); } // public native void createContext(PixelFormat pixel_format) throws LWJGLException; - public native void destroyPeerInfo(); +// public native void destroyPeerInfo(); // public native void destroyContext(); public void update() { - if (frame.syncShouldUpdateContext()) { - updateContext(); + if (frame.getCanvas().syncShouldUpdateContext()) { + Display.getContext().update(); /* This is necessary to make sure the context won't "forget" about the view size */ GL11.glViewport(0, 0, frame.getCanvas().syncGetWidth(), frame.getCanvas().syncGetHeight()); + } + if (frame.syncShouldWarpCursor()) { warpCursor(); } } @@ -240,7 +246,7 @@ private native void updateContext(); - public native void setVSyncEnabled(boolean sync); +// public native void setVSyncEnabled(boolean sync); public void reshape(int x, int y, int width, int height) { frame.resize(x, y, width, height); @@ -422,7 +428,7 @@ public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { - throw new RuntimeException("Not yet supported"); + return new MacOSXPbufferPeerInfo(width, height, pixel_format); } /* public ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, @@ -438,7 +444,6 @@ IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException; */ // public native void destroyPbuffer(ByteBuffer handle); - public native void destroyPbuffer(PeerInfo handle); public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { throw new UnsupportedOperationException(); --- NEW FILE: MacOSXDisplayPeerInfo.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import java.awt.Canvas; /** * $Id: MacOSXDisplayPeerInfo.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class MacOSXDisplayPeerInfo extends MacOSXCanvasPeerInfo { private boolean locked = false; public MacOSXDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { super(pixel_format); } protected void doLockAndInitHandle() throws LWJGLException { if (locked) throw new RuntimeException("Already locked"); MacOSXFrame frame = ((MacOSXDisplay)Display.getImplementation()).getFrame(); if (frame != null) { Canvas gl_canvas = frame.getCanvas(); initHandle(gl_canvas); locked = true; } } protected void doUnlock() throws LWJGLException { if (locked) { super.doUnlock(); locked = false; } } } --- NEW FILE: MacOSXCanvasImplementation.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.BufferUtils; import java.awt.GraphicsDevice; import java.awt.GraphicsConfiguration; import java.awt.Rectangle; import java.lang.reflect.Method; /** * $Id: MacOSXCanvasImplementation.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class MacOSXCanvasImplementation implements AWTCanvasImplementation { public PeerInfo createPeerInfo(AWTGLCanvas canvas, PixelFormat pixel_format) throws LWJGLException { return new MacOSXAWTGLCanvasPeerInfo(canvas, pixel_format); } /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. * * @return The GraphicsConfiguration corresponding to a visual that matches the pixel format. */ public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { /* * It seems like the best way is to simply return null */ return null; } } Index: Context.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Context.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Context.java 20 Feb 2005 11:24:17 -0000 1.1 +++ Context.java 23 Feb 2005 11:11:06 -0000 1.2 @@ -140,6 +140,15 @@ } /** + * Update the context. Should be called whenever it's drawable is moved or resized + */ + public synchronized void update() { + if (destroyed) + throw new IllegalStateException("Context is destroyed"); + implementation.update(getHandle()); + } + + /** * Swap the buffers on the current context. Only valid for double-buffered contexts */ public static void swapBuffers() throws LWJGLException { @@ -168,6 +177,10 @@ GLContext.useContext(this); } + ByteBuffer getHandle() { + return handle; + } + /** * Query whether the context is current */ Index: LinuxContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- LinuxContextImplementation.java 22 Feb 2005 13:59:32 -0000 1.2 +++ LinuxContextImplementation.java 23 Feb 2005 11:11:07 -0000 1.3 @@ -99,6 +99,9 @@ } private static native void nReleaseCurrentContext(ByteBuffer peer_info_handle) throws LWJGLException; + public void update(ByteBuffer context_handle) { + } + public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { LinuxDisplay.lockAWT(); try { Index: LinuxDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- LinuxDisplay.java 21 Feb 2005 15:56:50 -0000 1.17 +++ LinuxDisplay.java 23 Feb 2005 11:11:07 -0000 1.18 @@ -185,35 +185,10 @@ private static native boolean nIsDirty(); public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { - lockAWT(); - try { - incDisplay(); - try { - GLContext.loadOpenGLLibrary(); - try { - peer_info = new LinuxDisplayPeerInfo(pixel_format); - return peer_info; - } catch (LWJGLException e) { - GLContext.unloadOpenGLLibrary(); - throw e; - } - } catch (LWJGLException e) { - decDisplay(); - throw e; - } - } finally { - unlockAWT(); - } + peer_info = new LinuxDisplayPeerInfo(pixel_format); + return peer_info; } - public void destroyPeerInfo() { - lockAWT(); - peer_info = null; - GLContext.unloadOpenGLLibrary(); - decDisplay(); - unlockAWT(); - } - public void update() { lockAWT(); nUpdate(); @@ -432,33 +407,7 @@ public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs) throws LWJGLException { - lockAWT(); - try { - incDisplay(); - try { - GLContext.loadOpenGLLibrary(); - try { - PeerInfo peer_info = new LinuxPbufferPeerInfo(width, height, pixel_format); - return peer_info; - } catch (LWJGLException e) { - GLContext.unloadOpenGLLibrary(); - throw e; - } - } catch (LWJGLException e) { - decDisplay(); - throw e; - } - } finally { - unlockAWT(); - } - } - - public void destroyPbuffer(PeerInfo handle) { - lockAWT(); - ((LinuxPbufferPeerInfo)handle).destroy(); - decDisplay(); - GLContext.unloadOpenGLLibrary(); - unlockAWT(); + return new LinuxPbufferPeerInfo(width, height, pixel_format); } public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { Index: Win32ContextImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Win32ContextImplementation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Win32ContextImplementation.java 21 Feb 2005 14:46:43 -0000 1.1 +++ Win32ContextImplementation.java 23 Feb 2005 11:11:07 -0000 1.2 @@ -70,6 +70,9 @@ } private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException; + public void update(ByteBuffer context_handle) { + } + public void releaseCurrentContext() throws LWJGLException { nReleaseCurrentContext(); } --- NEW FILE: MacOSXCanvasPeerInfo.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import java.awt.Canvas; /** * $Id: MacOSXCanvasPeerInfo.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ abstract class MacOSXCanvasPeerInfo extends MacOSXPeerInfo { private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); public MacOSXCanvasPeerInfo(PixelFormat pixel_format) throws LWJGLException { super(pixel_format, true, true, false, true); } protected void initHandle(Canvas canvas) throws LWJGLException { nInitHandle(awt_surface.lockAndGetHandle(canvas), getHandle()); } private static native void nInitHandle(ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException; protected void doUnlock() throws LWJGLException { awt_surface.unlock(); } } Index: LinuxDisplayPeerInfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplayPeerInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- LinuxDisplayPeerInfo.java 21 Feb 2005 14:46:42 -0000 1.2 +++ LinuxDisplayPeerInfo.java 23 Feb 2005 11:11:07 -0000 1.3 @@ -47,7 +47,19 @@ public LinuxDisplayPeerInfo(PixelFormat pixel_format) throws LWJGLException { LinuxDisplay.lockAWT(); try { - initDefaultPeerInfo(getHandle(), pixel_format); + LinuxDisplay.incDisplay(); + try { + GLContext.loadOpenGLLibrary(); + try { + initDefaultPeerInfo(getHandle(), pixel_format); + } catch (LWJGLException e) { + GLContext.unloadOpenGLLibrary(); + throw e; + } + } catch (LWJGLException e) { + LinuxDisplay.decDisplay(); + throw e; + } } finally { LinuxDisplay.unlockAWT(); } @@ -67,4 +79,12 @@ protected void doUnlock() throws LWJGLException { // NO-OP } + + public void destroy() { + super.destroy(); + LinuxDisplay.lockAWT(); + GLContext.unloadOpenGLLibrary(); + LinuxDisplay.decDisplay(); + LinuxDisplay.unlockAWT(); + } } Index: MacOSXGLCanvas.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXGLCanvas.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- MacOSXGLCanvas.java 21 Jan 2005 22:07:20 -0000 1.6 +++ MacOSXGLCanvas.java 23 Feb 2005 11:11:07 -0000 1.7 @@ -42,8 +42,10 @@ import java.awt.Point; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; +import java.awt.event.HierarchyEvent; +import java.awt.event.HierarchyListener; -final class MacOSXGLCanvas extends Canvas implements ComponentListener { +final class MacOSXGLCanvas extends Canvas implements ComponentListener, HierarchyListener { private int width; private int height; @@ -68,7 +70,8 @@ /* Input methods are not enabled in fullscreen anyway, so disable always */ enableInputMethods(false); addComponentListener(this); - ((MacOSXDisplay)Display.getImplementation()).setView(this); + addHierarchyListener(this); +// ((MacOSXDisplay)Display.getImplementation()).setView(this); setUpdate(); } @@ -148,4 +151,8 @@ super.setBounds(x, y, width, height); setUpdate(); } + + public void hierarchyChanged(HierarchyEvent e) { + setUpdate(); + } } --- NEW FILE: MacOSXPeerInfo.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import java.nio.IntBuffer; /** * $Id: MacOSXPeerInfo.java,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ abstract class MacOSXPeerInfo extends PeerInfo { public MacOSXPeerInfo(PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { super(createHandle()); choosePixelFormat(pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); } private static native ByteBuffer createHandle(); private void choosePixelFormat(PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException { nChoosePixelFormat(getHandle(), pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); } private static native void nChoosePixelFormat(ByteBuffer peer_info_handle, PixelFormat pixel_format, boolean use_display_bpp, boolean support_window, boolean support_pbuffer, boolean double_buffered) throws LWJGLException; public void destroy() { nDestroy(getHandle()); } private static native void nDestroy(ByteBuffer handle); } |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:11:17
|
Update of /cvsroot/java-game-lib/LWJGL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20041 Modified Files: build.xml Log Message: Mac OS X port of the refactoring. Linux and Win32 fixes. Index: build.xml =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/build.xml,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- build.xml 22 Feb 2005 13:59:31 -0000 1.68 +++ build.xml 23 Feb 2005 11:11:05 -0000 1.69 @@ -576,7 +576,11 @@ <class name="org.lwjgl.opengl.Win32ContextImplementation" /> </javah> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes"> + <class name="org.lwjgl.opengl.MacOSXCanvasPeerInfo" /> + <class name="org.lwjgl.opengl.MacOSXPeerInfo" /> + <class name="org.lwjgl.opengl.MacOSXPbufferPeerInfo" /> <class name="org.lwjgl.opengl.MacOSXDisplay" /> + <class name="org.lwjgl.opengl.MacOSXContextImplementation" /> </javah> <!-- lwjgl --> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}" force="yes"> |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:11:17
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20041/src/native/win32 Modified Files: org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c Log Message: Mac OS X port of the refactoring. Linux and Win32 fixes. Index: org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c 21 Feb 2005 14:46:47 -0000 1.1 +++ org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo.c 23 Feb 2005 11:11:08 -0000 1.2 @@ -47,7 +47,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Win32AWTGLCanvasPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) { - const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); Win32PeerInfo *peer_info = (Win32PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); JAWT_Win32DrawingSurfaceInfo *win32_dsi = (JAWT_Win32DrawingSurfaceInfo *)surface->dsi->platformInfo; |
|
From: Elias N. <eli...@us...> - 2005-02-23 11:11:17
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20041/src/native/macosx Modified Files: org_lwjgl_opengl_Display.m Added Files: context.h context.m org_lwjgl_opengl_MacOSXCanvasPeerInfo.m org_lwjgl_opengl_MacOSXPbufferPeerInfo.m org_lwjgl_opengl_MacOSXPeerInfo.m Removed Files: display.h org_lwjgl_opengl_Pbuffer.m Log Message: Mac OS X port of the refactoring. Linux and Win32 fixes. --- display.h DELETED --- Index: org_lwjgl_opengl_Display.m =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Display.m,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_opengl_Display.m 27 Jan 2005 21:26:45 -0000 1.7 +++ org_lwjgl_opengl_Display.m 23 Feb 2005 11:11:07 -0000 1.8 @@ -33,7 +33,7 @@ /** * $Id$ * - * Mac OS Xspecific display functions. + * Mac OS X specific display functions. * * @author elias_naur <eli...@us...> * @version $Revision$ @@ -44,12 +44,12 @@ #import <jawt_md.h> #import <jni.h> #import <unistd.h> -#import "display.h" +//#import "display.h" #import "common_tools.h" #define WAIT_DELAY 100 -static NSOpenGLContext *gl_context; +/*static NSOpenGLContext *gl_context; NSOpenGLContext *createContext(JNIEnv *env, jobject pixel_format, bool double_buffered, bool use_display_bpp, long drawable_type, NSOpenGLContext *share_context) { int bpp; @@ -173,7 +173,7 @@ ds->Unlock(ds); awt.FreeDrawingSurface(ds); } - +*/ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_restoreGamma(JNIEnv *env, jobject this) { CGDisplayRestoreColorSyncSettings(); } @@ -194,7 +194,7 @@ SetSystemUIMode(kUIModeNormal, 0); } } - +/* JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXDisplay_setVSyncEnabled(JNIEnv *env, jobject this, jboolean vsync) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; long vsync_value = vsync == JNI_TRUE ? 1 : 0; @@ -233,3 +233,4 @@ } [pool release]; } +*/ --- NEW FILE: context.m --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ /** * $Id: context.m,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #import "context.h" #import <Cocoa/Cocoa.h> #import <Carbon/Carbon.h> NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered) { int bpp; jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); if (use_display_bpp) bpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); else bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); attrib_list_t attribs; jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); initAttribList(&attribs); if (!allow_software_acceleration) putAttrib(&attribs, NSOpenGLPFAAccelerated); if (double_buffered) putAttrib(&attribs, NSOpenGLPFADoubleBuffer); putAttrib(&attribs, NSOpenGLPFAColorSize); putAttrib(&attribs, bpp); putAttrib(&attribs, NSOpenGLPFAAlphaSize); putAttrib(&attribs, alpha); putAttrib(&attribs, NSOpenGLPFADepthSize); putAttrib(&attribs, depth); putAttrib(&attribs, NSOpenGLPFAStencilSize); putAttrib(&attribs, stencil); putAttrib(&attribs, NSOpenGLPFAAccumSize); putAttrib(&attribs, accum_bpp + accum_alpha); putAttrib(&attribs, NSOpenGLPFASampleBuffers); putAttrib(&attribs, samples > 0 ? 1 : 0); putAttrib(&attribs, NSOpenGLPFASamples); putAttrib(&attribs, samples); putAttrib(&attribs, NSOpenGLPFAAuxBuffers); putAttrib(&attribs, num_aux_buffers); if (support_window) putAttrib(&attribs, NSOpenGLPFAWindow); if (support_pbuffer) putAttrib(&attribs, NSOpenGLPFAPixelBuffer); if (stereo) putAttrib(&attribs, NSOpenGLPFAStereo); putAttrib(&attribs, 0); NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:(NSOpenGLPixelFormatAttribute *)attribs.attribs]; if (fmt == nil) { throwException(env, "Could not create pixel format"); return NULL; } return fmt; } --- NEW FILE: org_lwjgl_opengl_MacOSXCanvasPeerInfo.m --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ /** * $Id: org_lwjgl_opengl_MacOSXCanvasPeerInfo.m,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <jni.h> #include <jawt.h> #include <jawt_md.h> #include "awt_tools.h" #include "org_lwjgl_opengl_MacOSXCanvasPeerInfo.h" #include "context.h" #include "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXCanvasPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject peer_info_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); AWTSurfaceLock *surface = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); JAWT_MacOSXDrawingSurfaceInfo *macosx_dsi = (JAWT_MacOSXDrawingSurfaceInfo *)surface->dsi->platformInfo; peer_info->nsview = macosx_dsi->cocoaViewRef; peer_info->window = true; [pool release]; } --- NEW FILE: context.h --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ /** * $Id: context.h,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * Base Win32 display * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ #ifndef __LWJGL_CONTEXT_H #define __LWJGL_CONTEXT_H #include <Cocoa/Cocoa.h> #include <OpenGL/gl.h> #include <OpenGL/glext.h> #include "common_tools.h" typedef struct { NSOpenGLPixelFormat *pixel_format; bool window; union { NSView *nsview; NSOpenGLPixelBuffer *pbuffer; }; } MacOSXPeerInfo; NSOpenGLPixelFormat *choosePixelFormat(JNIEnv *env, jobject pixel_format, bool use_display_bpp, bool support_window, bool support_pbuffer, bool double_buffered); #endif --- NEW FILE: org_lwjgl_opengl_MacOSXPeerInfo.m --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ /** * $Id: org_lwjgl_opengl_MacOSXPeerInfo.m,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #import <jni.h> #import <Cocoa/Cocoa.h> #import "org_lwjgl_opengl_MacOSXPeerInfo.h" #import "context.h" #import "common_tools.h" JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_createHandle (JNIEnv *env, jclass clazz) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; jobject handle = newJavaManagedByteBuffer(env, sizeof(MacOSXPeerInfo)); [pool release]; return handle; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nChoosePixelFormat (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject pixel_format, jboolean use_display_bpp, jboolean support_window, jboolean support_pbuffer, jboolean double_buffered) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); NSOpenGLPixelFormat *macosx_pixel_format = choosePixelFormat(env, pixel_format, use_display_bpp, support_window, support_pbuffer, double_buffered); if (pixel_format == nil) { throwException(env, "Could not find pixel format"); return; } peer_info->pixel_format = macosx_pixel_format; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPeerInfo_nDestroy (JNIEnv *env, jclass clazz, jobject peer_info_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); [peer_info->pixel_format release]; [pool release]; } --- NEW FILE: org_lwjgl_opengl_MacOSXPbufferPeerInfo.m --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * 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. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "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 THE COPYRIGHT OWNER 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. */ /** * $Id: org_lwjgl_opengl_MacOSXPbufferPeerInfo.m,v 1.1 2005/02/23 11:11:07 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #import <jni.h> #import <Cocoa/Cocoa.h> #import "org_lwjgl_opengl_MacOSXPbufferPeerInfo.h" #import "context.h" #import "common_tools.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPbufferPeerInfo_nCreate(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint width, jint height) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSOpenGLPixelBuffer *pbuffer = nil; // check if the texture is power of 2 if ( (( width > 0 ) && ( width & ( width-1)) == 0) || (( height > 0 ) && ( height & ( height-1)) == 0) ) { pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:GL_TEXTURE_2D textureInternalFormat:GL_RGBA textureMaxMipMapLevel:0 pixelsWide:width pixelsHigh:height]; } else { pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:GL_TEXTURE_RECTANGLE_EXT textureInternalFormat:GL_RGBA textureMaxMipMapLevel:0 pixelsWide:width pixelsHigh:height]; } MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); peer_info->pbuffer = pbuffer; peer_info->window = false; [pool release]; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_MacOSXPbufferPeerInfo_nDestroy (JNIEnv *env, jclass clazz, jobject peer_info_handle) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; MacOSXPeerInfo *peer_info = (MacOSXPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); [peer_info->pbuffer release]; [pool release]; } --- org_lwjgl_opengl_Pbuffer.m DELETED --- |