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
(5) |
2
(5) |
3
(1) |
4
(1) |
5
(5) |
6
|
|
7
(22) |
8
(2) |
9
(10) |
10
(5) |
11
(5) |
12
(1) |
13
|
|
14
|
15
(2) |
16
|
17
|
18
(2) |
19
|
20
|
|
21
(13) |
22
(4) |
23
(3) |
24
(14) |
25
(6) |
26
(26) |
27
(26) |
|
28
(2) |
29
(13) |
30
(17) |
31
(2) |
|
|
|
|
From: Brian M. <ma...@us...> - 2004-03-21 22:05:24
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2879/java/org/lwjgl/test/input Modified Files: HWCursorTest.java Log Message: Cursor animation support regardless of platform features Index: HWCursorTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- HWCursorTest.java 15 Feb 2004 15:34:56 -0000 1.26 +++ HWCursorTest.java 21 Mar 2004 21:54:55 -0000 1.27 @@ -58,11 +58,12 @@ private DisplayMode mode; /** The native cursor */ - private static Cursor cursor = null; + private static Cursor[] cursor = null; /** The mouse cursor position */ private static int mouse_x; private static int mouse_y; + private static int mouse_btn = 0; /** * Executes the test @@ -89,62 +90,116 @@ glInit(); Keyboard.create(); - initNativeCursor(); + Mouse.create(); + initNativeCursors(); } catch (Exception e) { e.printStackTrace(); } } - private static void initNativeCursor() { - try { - Mouse.create(); - } catch (Exception e) { - e.printStackTrace(); - } + private static void initNativeCursors() throws Exception { if ((Mouse.getNativeCursorCaps() & Mouse.CURSOR_ONE_BIT_TRANSPARENCY) == 0) { System.out.println("No HW cursor support!"); System.exit(0); } - System.out.println("Maximum native cursor size: " + Mouse.getMaxCursorSize() + ", min size: " + Mouse.getMinCursorSize()); + + cursor = new Cursor[3]; + + // center mouse_x = 400; mouse_y = 300; - int num_images = 3; - int image_size = Mouse.getMaxCursorSize()*Mouse.getMaxCursorSize(); - IntBuffer cursor_images = ByteBuffer.allocateDirect(num_images*image_size*4).order(ByteOrder.nativeOrder()).asIntBuffer(); - IntBuffer delays = ByteBuffer.allocateDirect(num_images*4).order(ByteOrder.nativeOrder()).asIntBuffer(); - delays.put(0, 500); - delays.put(1, 500); - delays.put(2, 500); - int color_scale = 255/Mouse.getMaxCursorSize(); - int bit_mask = 0x81000000; - for (int j = 0; j < image_size; j++) { - if (j % 4 == 0) - bit_mask = (~bit_mask) & 0x81000000; - int color = (j*color_scale/Mouse.getMaxCursorSize()) << 16; - cursor_images.put(0*image_size + j, 0x00000020 | color | bit_mask); - } - for (int j = 0; j < image_size; j++) { - if (j % 4 == 0) - bit_mask = (~bit_mask) & 0x81000000; - int color = (j*color_scale/Mouse.getMaxCursorSize()) << 8; - cursor_images.put(1*image_size + j, 0x00000020 | color | bit_mask); + + int cursorImageCount = 1; + int cursorWidth = Mouse.getMaxCursorSize(); + int cursorHeight = cursorWidth; + IntBuffer cursorImages; + IntBuffer cursorDelays; + + + // Create a single cursor + // ================================== + cursorImages = ByteBuffer.allocateDirect(cursorWidth*cursorHeight*cursorImageCount*4).order(ByteOrder.nativeOrder()).asIntBuffer(); + cursorDelays = null; + for(int j=0; j<cursorWidth; j++) { + for(int l=0; l<cursorHeight; l++) { + cursorImages.put(0xffffffff); + } } - for (int j = 0; j < image_size; j++) { - if (j % 4 == 0) - bit_mask = (~bit_mask) & 0x81000000; - int color = (j*color_scale/Mouse.getMaxCursorSize()); - cursor_images.put(2*image_size + j, 0x00000020 | color | bit_mask); + cursorImages.flip(); + cursor[0] = new Cursor(Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize()/2, Mouse.getMaxCursorSize()/2, cursorImageCount, cursorImages, cursorDelays); + // ---------------------------------- + + // Create 3 piece animation + // ================================== + cursorImageCount = 3; + cursorImages = ByteBuffer.allocateDirect(cursorWidth*cursorHeight*cursorImageCount*4).order(ByteOrder.nativeOrder()).asIntBuffer(); + cursorDelays = ByteBuffer.allocateDirect(cursorImageCount*4).order(ByteOrder.nativeOrder()).asIntBuffer(); + for(int i=0; i<cursorImageCount; i++) { + + // make a colored square with a chocolate center + int offColor = 0x00000000; + int onColor = 0xffff0000; + + // change color according to cursor + if(i == 1) { + onColor = 0xff00ff00; + } else if (i == 2) { + onColor = 0xff0000ff; + } + + // calculate size of center + int centerSize = (cursorWidth / 5) * (i + 1); + int centerLeft = cursorWidth / 2 - centerSize / 2; + int centerRight = cursorWidth / 2 + centerSize / 2; + + // go! + for(int j=0; j<cursorWidth; j++) { + for(int l=0; l<cursorHeight; l++) { + if(j >= centerLeft && j < centerRight && l >= centerLeft && l < centerRight) { + cursorImages.put(offColor); + } else { + cursorImages.put(onColor); + } + } + } } - try { - if ((Mouse.getNativeCursorCaps() | Mouse.CURSOR_ANIMATION) == 0) - num_images = 1; - cursor = new Cursor(Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize()/2, Mouse.getMaxCursorSize()/2, num_images, cursor_images, delays); - Mouse.setNativeCursor(cursor); - } catch (Exception e) { - e.printStackTrace(); - System.exit(1); + cursorDelays.put(2000).put(2000).put(2000); + cursorDelays.flip(); + cursorImages.flip(); + + cursor[1] = new Cursor(Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize()/2, Mouse.getMaxCursorSize()/2, cursorImageCount, cursorImages, cursorDelays); + // ---------------------------------- + + + // Create a 20 piece animation + // ================================== + cursorImageCount = 20; + cursorImages = ByteBuffer.allocateDirect(cursorWidth*cursorHeight*cursorImageCount*4).order(ByteOrder.nativeOrder()).asIntBuffer(); + cursorDelays = ByteBuffer.allocateDirect(cursorImageCount*4).order(ByteOrder.nativeOrder()).asIntBuffer(); + cursorDelays.put( + new int[] { + 100, 100, 100, 100, 100, + 100, 100, 100, 100, 100, + 100, 100, 100, 100, 100, + 100, 100, 100, 100, 100 + }); + + float step = 0xffffffff / 20.0f; + for(int i=0; i<cursorImageCount; i++) { + for(int j=0; j<cursorWidth; j++) { + for(int l=0; l<cursorHeight; l++) { + cursorImages.put((int)step); + } + } + step += step; } + cursorImages.flip(); + cursorDelays.flip(); + cursor[2] = new Cursor(Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize(), Mouse.getMaxCursorSize()/2, Mouse.getMaxCursorSize()/2, cursorImageCount, cursorImages, cursorDelays); + // ---------------------------------- + + Mouse.setNativeCursor(cursor[0]); } /** @@ -191,14 +246,14 @@ // draw white quad GL11.glPushMatrix(); { - GL11.glTranslatef(mouse_x, 600 - mouse_y, 0); + GL11.glTranslatef(mouse_x, mouse_y, 0); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glBegin(GL11.GL_QUADS); { - GL11.glVertex2i(-50, -50); - GL11.glVertex2i(50, -50); - GL11.glVertex2i(50, 50); - GL11.glVertex2i(-50, 50); + GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glVertex2i(-50, -50); + GL11.glColor3f(0.0f, 1.0f, 0.0f); GL11.glVertex2i(50, -50); + GL11.glColor3f(0.0f, 0.0f, 1.0f); GL11.glVertex2i(50, 50); + GL11.glColor3f(1.0f, 0.0f, 1.0f); GL11.glVertex2i(-50, 50); } GL11.glEnd(); } @@ -213,9 +268,16 @@ Mouse.poll(); if (Mouse.getDX() != 0 || Mouse.getDY() != 0) { - mouse_x += Mouse.getDX(); - mouse_y += Mouse.getDY(); - System.out.println("mouse_x " + mouse_x + " mouse_y " + mouse_y); + mouse_x += Mouse.getDX() / 2; + mouse_y += Mouse.getDY() / 2; + } + + if(Mouse.isButtonDown(0)) { + mouse_btn = 0; + } else if(Mouse.isButtonDown(1)) { + mouse_btn = 1; + } else if(Mouse.isButtonDown(2)) { + mouse_btn = 2; } //check for fullscreen key @@ -229,7 +291,9 @@ e.printStackTrace(); System.exit(1); } - cursor.destroy(); + for(int i=0; i<cursor.length; i++) { + cursor[i].destroy(); + } Mouse.destroy(); Window.destroy(); @@ -239,7 +303,7 @@ glInit(); Keyboard.create(); - initNativeCursor(); + initNativeCursors(); } catch (Exception e) { e.printStackTrace(); } @@ -255,7 +319,9 @@ e.printStackTrace(); System.exit(1); } - cursor.destroy(); + for(int i=0; i<cursor.length; i++) { + cursor[i].destroy(); + } Mouse.destroy(); Window.destroy(); @@ -265,7 +331,7 @@ glInit(); Keyboard.create(); - initNativeCursor(); + initNativeCursors(); } catch (Exception e) { e.printStackTrace(); } @@ -281,8 +347,8 @@ if (Keyboard.isKeyDown(Keyboard.KEY_N)) { try { - Mouse.setNativeCursor(cursor); - mouse_x = mouse_y = 0; + cursor[mouse_btn].resetAnimation(); + Mouse.setNativeCursor(cursor[mouse_btn]); } catch (Exception e) { e.printStackTrace(); } @@ -300,7 +366,9 @@ e.printStackTrace(); System.exit(1); } - cursor.destroy(); + for(int i=0; i<cursor.length; i++) { + cursor[i].destroy(); + } Mouse.destroy(); Display.resetDisplayMode(); Window.destroy(); |
|
From: Brian M. <ma...@us...> - 2004-03-21 22:05:22
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2879/native/macosx Modified Files: org_lwjgl_input_Cursor.cpp org_lwjgl_opengl_Window.cpp Log Message: Cursor animation support regardless of platform features Index: org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- org_lwjgl_opengl_Window.cpp 5 Mar 2004 22:57:51 -0000 1.34 +++ org_lwjgl_opengl_Window.cpp 21 Mar 2004 21:54:56 -0000 1.35 @@ -131,7 +131,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nSetTitle(JNIEnv * env, jclass clazz, jstring title_obj) { } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_update(JNIEnv *env, jclass clazz) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nUpdate(JNIEnv *env, jclass clazz) { EventRef event; OSStatus err = ReceiveNextEvent(0, NULL, 0, true, &event); if (err == noErr) { Index: org_lwjgl_input_Cursor.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Cursor.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_input_Cursor.cpp 14 Oct 2003 14:29:23 -0000 1.1 +++ org_lwjgl_input_Cursor.cpp 21 Mar 2004 21:54:56 -0000 1.2 @@ -41,7 +41,7 @@ #include "org_lwjgl_input_Cursor.h" -JNIEXPORT jlong JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) { +JNIEXPORT jlong JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset) { } JNIEXPORT void JNICALL Java_org_lwjgl_input_Cursor_nDestroyCursor(JNIEnv *env, jclass clazz, jlong cursor_handle) { |
|
From: Brian M. <ma...@us...> - 2004-03-21 22:05:22
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2879/native/linux Modified Files: org_lwjgl_input_Cursor.cpp org_lwjgl_opengl_Window.cpp Log Message: Cursor animation support regardless of platform features Index: org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- org_lwjgl_opengl_Window.cpp 12 Mar 2004 07:12:34 -0000 1.22 +++ org_lwjgl_opengl_Window.cpp 21 Mar 2004 21:54:56 -0000 1.23 @@ -260,7 +260,7 @@ * Method: update * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_update +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nUpdate (JNIEnv *env, jclass clazz) { handleMessages(); Index: org_lwjgl_input_Cursor.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Cursor.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_input_Cursor.cpp 14 Oct 2003 14:29:23 -0000 1.7 +++ org_lwjgl_input_Cursor.cpp 21 Mar 2004 21:54:56 -0000 1.8 @@ -50,11 +50,8 @@ * Signature: (IIIIIII)I */ JNIEXPORT jlong JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor - (JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) + (JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset) { - const int *delays = NULL; - if (delay_buffer != NULL) - delays = (const int *)env->GetDirectBufferAddress(delay_buffer) + delays_offset; XcursorPixel *pixels = (XcursorPixel *)env->GetDirectBufferAddress(image_buffer) + images_offset; int stride = width*height; XcursorImages *cursor_images = XcursorImagesCreate(num_images); @@ -66,8 +63,6 @@ cursor_image->xhot = x_hotspot; cursor_image->yhot = y_hotspot; cursor_image->pixels = &(pixels[stride*i]); - if (num_images > 1) - cursor_image->delay = delays[i]; cursor_images->images[i] = cursor_image; } Cursor cursor = XcursorImagesLoadCursor(getCurrentDisplay(), cursor_images); |
|
From: Brian M. <ma...@us...> - 2004-03-21 22:05:22
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2879/native/common Modified Files: org_lwjgl_input_Cursor.h org_lwjgl_opengl_Window.h Log Message: Cursor animation support regardless of platform features Index: org_lwjgl_opengl_Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_Window.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- org_lwjgl_opengl_Window.h 23 Feb 2004 23:42:57 -0000 1.12 +++ org_lwjgl_opengl_Window.h 21 Mar 2004 21:54:55 -0000 1.13 @@ -111,7 +111,7 @@ * Method: update * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_update +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nUpdate (JNIEnv *, jclass); /* Index: org_lwjgl_input_Cursor.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_input_Cursor.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_input_Cursor.h 26 Feb 2004 21:54:05 -0000 1.6 +++ org_lwjgl_input_Cursor.h 21 Mar 2004 21:54:55 -0000 1.7 @@ -13,10 +13,10 @@ /* * Class: org_lwjgl_input_Cursor * Method: nCreateCursor - * Signature: (IIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)J + * Signature: (IIIIILjava/nio/IntBuffer;I)J */ JNIEXPORT jlong JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor - (JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint, jobject, jint); + (JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint); /* * Class: org_lwjgl_input_Cursor |
|
From: Brian M. <ma...@us...> - 2004-03-21 22:05:10
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2879/native/win32 Modified Files: org_lwjgl_input_Cursor.cpp org_lwjgl_opengl_Window.cpp Log Message: Cursor animation support regardless of platform features Index: org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- org_lwjgl_opengl_Window.cpp 11 Mar 2004 21:30:48 -0000 1.22 +++ org_lwjgl_opengl_Window.cpp 21 Mar 2004 21:54:57 -0000 1.23 @@ -470,7 +470,7 @@ * Method: update * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_update +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nUpdate (JNIEnv * env, jclass clazz) { handleMessages(env, clazz); Index: org_lwjgl_input_Cursor.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Cursor.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- org_lwjgl_input_Cursor.cpp 14 Oct 2003 14:29:23 -0000 1.8 +++ org_lwjgl_input_Cursor.cpp 21 Mar 2004 21:54:57 -0000 1.9 @@ -50,7 +50,7 @@ * Signature: (IIIIIIIII)I */ JNIEXPORT jlong JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor - (JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) + (JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset) { int *pixels = (int *)env->GetDirectBufferAddress(image_buffer) + images_offset; |
|
From: Brian M. <ma...@us...> - 2004-03-21 22:05:10
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2879/java/org/lwjgl/opengl Modified Files: Window.java Log Message: Cursor animation support regardless of platform features Index: Window.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Window.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- Window.java 7 Mar 2004 16:01:44 -0000 1.28 +++ Window.java 21 Mar 2004 21:54:55 -0000 1.29 @@ -49,6 +49,7 @@ import org.lwjgl.Display; import org.lwjgl.Sys; +import org.lwjgl.input.Mouse; public final class Window { @@ -352,7 +353,15 @@ * Updates the windows internal state. This must be called at least once per video frame * to handle window close requests, moves, paints, etc. */ - public static native void update(); + public static void update() { + nUpdate(); + + // notify Mouse that we've had an update, so that it may update its cursor if needed + if(Mouse.isCreated()) { + Mouse.updateCursor(); + } + } + public static native void nUpdate(); /** * Determines to the best of the platform's ability whether monitor vysnc is enabled on |
|
From: Brian M. <ma...@us...> - 2004-03-21 22:05:09
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2879/java/org/lwjgl/input Modified Files: Cursor.java Mouse.java Log Message: Cursor animation support regardless of platform features Index: Cursor.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Cursor.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Cursor.java 8 Feb 2004 20:35:40 -0000 1.15 +++ Cursor.java 21 Mar 2004 21:54:55 -0000 1.16 @@ -49,92 +49,186 @@ */ public class Cursor { + + /** Lazy initialization */ + private static boolean initialized = false; + + /** First element to display */ + private CursorElement[] cursors = null; + + /** Index into list of cursors */ + private int index = -1; + + /** + * Constructs a new Cursor, with the given parameters. Mouse must have been created before you can create + * Cursor objects. Cursor images are in ARGB format, but only one bit transparancy is guaranteed to be supported. + * So to maximize portability, lwjgl applications should only create cursor images with 0x00 or 0xff as alpha values. + * The constructor will copy the images and delays, so there's no need to keep them around. + * + * @param width cursor image width + * @param height cursor image height + * @param xHotspot the x coordinate of the cursor hotspot + * @param yHotspot the y coordinate of the cursor hotspot + * @param numImages number of cursor images specified. Must be 1 if animations are not supported. + * @param images A buffer containing the images. The origin is at the lower left corner, like OpenGL. + * @param delays An int buffer of animation frame delays, if numImages is greater than 1, else null + * @throws Exception if the cursor could not be created for any reason + */ + public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws Exception { + assert Mouse.isCreated(); + assert width*height*numImages <= images.remaining() : "width*height*numImages > images.remaining()"; + assert delays == null || numImages <= delays.remaining() : "delays != null && numImages > delays.remaining()"; + assert xHotspot < width && xHotspot >= 0 : "xHotspot > width || xHotspot < 0"; + assert yHotspot < height && yHotspot >= 0 : "yHotspot > height || yHotspot < 0"; + + // initialize + if (!initialized) { + initialize(); + } + + // Hmm + yHotspot = height - 1 - yHotspot; + + // create cursor (or cursors if multiple images supplied) + createCursors(width, height, xHotspot, yHotspot, numImages, images, delays); + } + + /** + * Initializes the cursor class + */ + private static void initialize() { + System.loadLibrary(Sys.getLibraryName()); + initialized = true; + } - /** Lazy initialization */ - private static boolean initialized = false; - - /** - * The native handle to the cursor - */ - private final long nativeHandle; - - /** - * Constructs a new Cursor, with the given parameters. Mouse must have been created before you can create - * Cursor objects. Cursor images are in ARGB format, but only one bit transparancy is guaranteed to be supported. - * So to maximize portability, lwjgl applications should only create cursor images with 0x00 or 0xff as alpha values. - * The constructor will copy the images and delays, so there's no need to keep them around. - * - * @param width cursor image width - * @param height cursor image height - * @param xHotspot the x coordinate of the cursor hotspot - * @param yHotspot the y coordinate of the cursor hotspot - * @param numImages number of cursor images specified. Must be 1 if animations are not supported. - * @param images A buffer containing the images. The origin is at the lower left corner, like OpenGL. - * @param delays An int buffer of animation frame delays, if numImages is greater than 1, else null - * @throws Exception if the cursor could not be created for any reason - */ - public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws Exception { - if (!initialized) { - initialize(); - } - yHotspot = height - 1 - yHotspot; - assert Mouse.isCreated(); - assert width*height*numImages <= images.remaining(): "width*height*numImages > images.remaining()"; - assert delays == null || numImages <= delays.remaining(): "delays != null && numImages > delays.remaining()"; - assert xHotspot < width && xHotspot >= 0: "xHotspot > width || xHotspot < 0"; - assert yHotspot < height && yHotspot >= 0: "yHotspot > height || yHotspot < 0"; - IntBuffer images_copy = ByteBuffer.allocateDirect(images.remaining()*4).order(ByteOrder.nativeOrder()).asIntBuffer(); - flipImages(width, height, numImages, images, images_copy); - nativeHandle = nCreateCursor(width, height, xHotspot, yHotspot, numImages, images_copy, 0, delays, delays != null ? delays.position() : 0); - } - - private static void initialize() { - System.loadLibrary(Sys.getLibraryName()); - initialized = true; - } + /** + * Creates the actual cursor, using a platform specific class + */ + private void createCursors(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws Exception { + // create copy and flip images to match ogl + IntBuffer images_copy = ByteBuffer.allocateDirect(images.remaining()*4).order(ByteOrder.nativeOrder()).asIntBuffer(); + flipImages(width, height, numImages, images, images_copy); + + // create our cursor elements + cursors = new CursorElement[numImages]; + for(int i=0; i<numImages; i++) { + cursors[i] = new CursorElement(); + cursors[i].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, 1, images_copy, images_copy.position()); + cursors[i].delay = (delays != null) ? delays.get(i) : 0; + cursors[i].timeout = System.currentTimeMillis(); + + // offset to next image + images_copy.position(width*height*(i+1)); + } + + // set index + index = 0; + } + + + /** + * Flips the images so they're oriented according to opengl + * + * @param width Width of image + * @param height Height of images + * @param numImages How many images to flip + * @param images Source images + * @param images_copy Destination images + */ + private static void flipImages(int width, int height, int numImages, IntBuffer images, IntBuffer images_copy) { + for (int i = 0; i < numImages; i++) { + int start_index = i*width*height; + flipImage(width, height, start_index, images, images_copy); + } + } - private static void flipImages(int width, int height, int numImages, IntBuffer images, IntBuffer images_copy) { - for (int i = 0; i < numImages; i++) { - int start_index = i*width*height; - flipImage(width, height, start_index, images, images_copy); - } - } + /** + * @param width Width of image + * @param height Height of images + * @param start_index index into source buffer to copy to + * @param images Source images + * @param images_copy Destination images + */ + private static void flipImage(int width, int height, int start_index, IntBuffer images, IntBuffer images_copy) { + for (int y = 0; y < height>>1; y++) { + int index_y_1 = y*width + start_index; + int index_y_2 = (height - y - 1)*width + start_index; + for (int x = 0; x < width; x++) { + int index1 = index_y_1 + x; + int index2 = index_y_2 + x; + int temp_pixel = images.get(index1 + images.position()); + images_copy.put(index1, images.get(index2 + images.position())); + images_copy.put(index2, temp_pixel); + } + } + } + + /** + * Gets the native handle associated with the cursor object. + */ + public long getHandle() { + return cursors[index].cursorHandle; + } + + /** + * Destroy the native cursor. Cursor must not be current. + */ + public void destroy() { + for(int i=0; i<cursors.length; i++) { + nDestroyCursor(cursors[i].cursorHandle); + } + } - private static void flipImage(int width, int height, int start_index, IntBuffer images, IntBuffer images_copy) { - for (int y = 0; y < height>>1; y++) { - int index_y_1 = y*width + start_index; - int index_y_2 = (height - y - 1)*width + start_index; - for (int x = 0; x < width; x++) { - int index1 = index_y_1 + x; - int index2 = index_y_2 + x; - int temp_pixel = images.get(index1 + images.position()); - images_copy.put(index1, images.get(index2 + images.position())); - images_copy.put(index2, temp_pixel); - } - } - } + /** + * Sets the timout property to the time it should be changed + */ + protected void setTimeout() { + cursors[index].timeout = System.currentTimeMillis() + cursors[index].delay; + } - /** - * Destroy the native cursor. Cursor must not be current. - */ - public void destroy() { - nDestroyCursor(nativeHandle); - } + /** + * Determines whether this cursor has timed out + * @return true if the this cursor has timed out, false if not + */ + protected boolean hasTimedOut() { + return cursors.length > 1 && cursors[index].timeout < System.currentTimeMillis(); + } - /** - * Gets the native handle associated with the cursor object. - */ - public long getHandle() { - return nativeHandle; - } + /** + * Changes to the next cursor + */ + protected void nextCursor() { + index = ++index % cursors.length; + } - /** - * Native method to create a native cursor - */ - private static native long nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset); + /** + * Resets the index of the cursor animation to the first in the list. + */ + public void resetAnimation() { + index = 0; + } + + /** + * Native method to create a native cursor + */ + private static native long nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset); - /** - * Native method to destroy a native cursor - */ - private static native void nDestroyCursor(long handle); + /** + * Native method to destroy a native cursor + */ + private static native void nDestroyCursor(long cursorHandle); + + /** + * A single cursor element, used when animating + */ + protected class CursorElement { + /** Handle to cursor */ + long cursorHandle; + + /** How long a delay this element should have */ + long delay; + + /** Absolute time this element times out */ + long timeout; + } } Index: Mouse.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- Mouse.java 5 Mar 2004 06:23:54 -0000 1.37 +++ Mouse.java 21 Mar 2004 21:54:55 -0000 1.38 @@ -169,6 +169,7 @@ currentCursor = cursor; if (currentCursor != null) { nSetNativeCursor(currentCursor.getHandle()); + currentCursor.setTimeout(); } else { nSetNativeCursor(0); } @@ -511,4 +512,18 @@ public static boolean hasWheel() { return hasWheel; } + + /** + * Updates the cursor, so that animation can be changed if needed. + * This method is called automatically by the window on its update. + */ + public static void updateCursor() { + if(currentCursor != null && currentCursor.hasTimedOut()) { + currentCursor.nextCursor(); + try { + setNativeCursor(currentCursor); + } catch (Exception e) { + } + } + } } |
|
From: Brian M. <ma...@us...> - 2004-03-21 22:03:13
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2546 Added Files: org_lwjgl_openal_ALC.h org_lwjgl_openal_AL10.h Log Message: missing oal headers --- NEW FILE: org_lwjgl_openal_AL10.h --- /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class org_lwjgl_openal_AL10 */ #ifndef _Included_org_lwjgl_openal_AL10 #define _Included_org_lwjgl_openal_AL10 #ifdef __cplusplus extern "C" { #endif /* Inaccessible static: _00024assertionsDisabled */ #undef org_lwjgl_openal_AL10_AL_INVALID #define org_lwjgl_openal_AL10_AL_INVALID -1L #undef org_lwjgl_openal_AL10_AL_NONE #define org_lwjgl_openal_AL10_AL_NONE 0L #undef org_lwjgl_openal_AL10_AL_FALSE #define org_lwjgl_openal_AL10_AL_FALSE 0L #undef org_lwjgl_openal_AL10_AL_TRUE #define org_lwjgl_openal_AL10_AL_TRUE 1L #undef org_lwjgl_openal_AL10_AL_SOURCE_TYPE #define org_lwjgl_openal_AL10_AL_SOURCE_TYPE 512L #undef org_lwjgl_openal_AL10_AL_SOURCE_ABSOLUTE #define org_lwjgl_openal_AL10_AL_SOURCE_ABSOLUTE 513L #undef org_lwjgl_openal_AL10_AL_SOURCE_RELATIVE #define org_lwjgl_openal_AL10_AL_SOURCE_RELATIVE 514L #undef org_lwjgl_openal_AL10_AL_CONE_INNER_ANGLE #define org_lwjgl_openal_AL10_AL_CONE_INNER_ANGLE 4097L #undef org_lwjgl_openal_AL10_AL_CONE_OUTER_ANGLE #define org_lwjgl_openal_AL10_AL_CONE_OUTER_ANGLE 4098L #undef org_lwjgl_openal_AL10_AL_PITCH #define org_lwjgl_openal_AL10_AL_PITCH 4099L #undef org_lwjgl_openal_AL10_AL_POSITION #define org_lwjgl_openal_AL10_AL_POSITION 4100L #undef org_lwjgl_openal_AL10_AL_DIRECTION #define org_lwjgl_openal_AL10_AL_DIRECTION 4101L #undef org_lwjgl_openal_AL10_AL_VELOCITY #define org_lwjgl_openal_AL10_AL_VELOCITY 4102L #undef org_lwjgl_openal_AL10_AL_LOOPING #define org_lwjgl_openal_AL10_AL_LOOPING 4103L #undef org_lwjgl_openal_AL10_AL_BUFFER #define org_lwjgl_openal_AL10_AL_BUFFER 4105L #undef org_lwjgl_openal_AL10_AL_GAIN #define org_lwjgl_openal_AL10_AL_GAIN 4106L #undef org_lwjgl_openal_AL10_AL_MIN_GAIN #define org_lwjgl_openal_AL10_AL_MIN_GAIN 4109L #undef org_lwjgl_openal_AL10_AL_MAX_GAIN #define org_lwjgl_openal_AL10_AL_MAX_GAIN 4110L #undef org_lwjgl_openal_AL10_AL_ORIENTATION #define org_lwjgl_openal_AL10_AL_ORIENTATION 4111L #undef org_lwjgl_openal_AL10_AL_REFERENCE_DISTANCE #define org_lwjgl_openal_AL10_AL_REFERENCE_DISTANCE 4128L #undef org_lwjgl_openal_AL10_AL_ROLLOFF_FACTOR #define org_lwjgl_openal_AL10_AL_ROLLOFF_FACTOR 4129L #undef org_lwjgl_openal_AL10_AL_CONE_OUTER_GAIN #define org_lwjgl_openal_AL10_AL_CONE_OUTER_GAIN 4130L #undef org_lwjgl_openal_AL10_AL_MAX_DISTANCE #define org_lwjgl_openal_AL10_AL_MAX_DISTANCE 4131L #undef org_lwjgl_openal_AL10_AL_CHANNEL_MASK #define org_lwjgl_openal_AL10_AL_CHANNEL_MASK 12288L #undef org_lwjgl_openal_AL10_AL_SOURCE_STATE #define org_lwjgl_openal_AL10_AL_SOURCE_STATE 4112L #undef org_lwjgl_openal_AL10_AL_INITIAL #define org_lwjgl_openal_AL10_AL_INITIAL 4113L #undef org_lwjgl_openal_AL10_AL_PLAYING #define org_lwjgl_openal_AL10_AL_PLAYING 4114L #undef org_lwjgl_openal_AL10_AL_PAUSED #define org_lwjgl_openal_AL10_AL_PAUSED 4115L #undef org_lwjgl_openal_AL10_AL_STOPPED #define org_lwjgl_openal_AL10_AL_STOPPED 4116L #undef org_lwjgl_openal_AL10_AL_BUFFERS_QUEUED #define org_lwjgl_openal_AL10_AL_BUFFERS_QUEUED 4117L #undef org_lwjgl_openal_AL10_AL_BUFFERS_PROCESSED #define org_lwjgl_openal_AL10_AL_BUFFERS_PROCESSED 4118L #undef org_lwjgl_openal_AL10_AL_FORMAT_MONO8 #define org_lwjgl_openal_AL10_AL_FORMAT_MONO8 4352L #undef org_lwjgl_openal_AL10_AL_FORMAT_MONO16 #define org_lwjgl_openal_AL10_AL_FORMAT_MONO16 4353L #undef org_lwjgl_openal_AL10_AL_FORMAT_STEREO8 #define org_lwjgl_openal_AL10_AL_FORMAT_STEREO8 4354L #undef org_lwjgl_openal_AL10_AL_FORMAT_STEREO16 #define org_lwjgl_openal_AL10_AL_FORMAT_STEREO16 4355L #undef org_lwjgl_openal_AL10_AL_FORMAT_VORBIS_EXT #define org_lwjgl_openal_AL10_AL_FORMAT_VORBIS_EXT 65539L #undef org_lwjgl_openal_AL10_AL_FREQUENCY #define org_lwjgl_openal_AL10_AL_FREQUENCY 8193L #undef org_lwjgl_openal_AL10_AL_BITS #define org_lwjgl_openal_AL10_AL_BITS 8194L #undef org_lwjgl_openal_AL10_AL_CHANNELS #define org_lwjgl_openal_AL10_AL_CHANNELS 8195L #undef org_lwjgl_openal_AL10_AL_SIZE #define org_lwjgl_openal_AL10_AL_SIZE 8196L #undef org_lwjgl_openal_AL10_AL_DATA #define org_lwjgl_openal_AL10_AL_DATA 8197L #undef org_lwjgl_openal_AL10_AL_UNUSED #define org_lwjgl_openal_AL10_AL_UNUSED 8208L #undef org_lwjgl_openal_AL10_AL_PENDING #define org_lwjgl_openal_AL10_AL_PENDING 8209L #undef org_lwjgl_openal_AL10_AL_PROCESSED #define org_lwjgl_openal_AL10_AL_PROCESSED 8210L #undef org_lwjgl_openal_AL10_AL_NO_ERROR #define org_lwjgl_openal_AL10_AL_NO_ERROR 0L #undef org_lwjgl_openal_AL10_AL_INVALID_NAME #define org_lwjgl_openal_AL10_AL_INVALID_NAME 40961L #undef org_lwjgl_openal_AL10_AL_INVALID_ENUM #define org_lwjgl_openal_AL10_AL_INVALID_ENUM 40962L #undef org_lwjgl_openal_AL10_AL_INVALID_VALUE #define org_lwjgl_openal_AL10_AL_INVALID_VALUE 40963L #undef org_lwjgl_openal_AL10_AL_INVALID_OPERATION #define org_lwjgl_openal_AL10_AL_INVALID_OPERATION 40964L #undef org_lwjgl_openal_AL10_AL_OUT_OF_MEMORY #define org_lwjgl_openal_AL10_AL_OUT_OF_MEMORY 40965L #undef org_lwjgl_openal_AL10_AL_VENDOR #define org_lwjgl_openal_AL10_AL_VENDOR 45057L #undef org_lwjgl_openal_AL10_AL_VERSION #define org_lwjgl_openal_AL10_AL_VERSION 45058L #undef org_lwjgl_openal_AL10_AL_RENDERER #define org_lwjgl_openal_AL10_AL_RENDERER 45059L #undef org_lwjgl_openal_AL10_AL_EXTENSIONS #define org_lwjgl_openal_AL10_AL_EXTENSIONS 45060L #undef org_lwjgl_openal_AL10_AL_DOPPLER_FACTOR #define org_lwjgl_openal_AL10_AL_DOPPLER_FACTOR 49152L #undef org_lwjgl_openal_AL10_AL_DOPPLER_VELOCITY #define org_lwjgl_openal_AL10_AL_DOPPLER_VELOCITY 49153L #undef org_lwjgl_openal_AL10_AL_DISTANCE_MODEL #define org_lwjgl_openal_AL10_AL_DISTANCE_MODEL 53248L #undef org_lwjgl_openal_AL10_AL_INVERSE_DISTANCE #define org_lwjgl_openal_AL10_AL_INVERSE_DISTANCE 53249L #undef org_lwjgl_openal_AL10_AL_INVERSE_DISTANCE_CLAMPED #define org_lwjgl_openal_AL10_AL_INVERSE_DISTANCE_CLAMPED 53250L /* Inaccessible static: class_000240 */ /* * Class: org_lwjgl_openal_AL10 * Method: alEnable * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alEnable (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alDisable * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alDisable (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alIsEnabled * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_AL10_alIsEnabled (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alHint * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alHint (JNIEnv *, jclass, jint, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alGetBoolean * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_AL10_alGetBoolean (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alGetInteger * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_AL10_alGetInteger (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alGetFloat * Signature: (I)F */ JNIEXPORT jfloat JNICALL Java_org_lwjgl_openal_AL10_alGetFloat (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalGetIntegerv * Signature: (ILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalGetIntegerv (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalGetFloatv * Signature: (ILjava/nio/FloatBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalGetFloatv (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alGetString * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_AL10_alGetString (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alGetError * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_AL10_alGetError (JNIEnv *, jclass); /* * Class: org_lwjgl_openal_AL10 * Method: alIsExtensionPresent * Signature: (Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_AL10_alIsExtensionPresent (JNIEnv *, jclass, jstring); /* * Class: org_lwjgl_openal_AL10 * Method: alGetEnumValue * Signature: (Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_AL10_alGetEnumValue (JNIEnv *, jclass, jstring); /* * Class: org_lwjgl_openal_AL10 * Method: alListeneri * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alListeneri (JNIEnv *, jclass, jint, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alListenerf * Signature: (IF)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alListenerf (JNIEnv *, jclass, jint, jfloat); /* * Class: org_lwjgl_openal_AL10 * Method: nalListenerfv * Signature: (ILjava/nio/FloatBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalListenerfv (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alListener3f * Signature: (IFFF)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alListener3f (JNIEnv *, jclass, jint, jfloat, jfloat, jfloat); /* * Class: org_lwjgl_openal_AL10 * Method: alGetListeneri * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_AL10_alGetListeneri (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alGetListenerf * Signature: (I)F */ JNIEXPORT jfloat JNICALL Java_org_lwjgl_openal_AL10_alGetListenerf (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalGetListenerfv * Signature: (ILjava/nio/FloatBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalGetListenerfv (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalGenSources * Signature: (ILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalGenSources (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalDeleteSources * Signature: (ILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalDeleteSources (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alIsSource * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_AL10_alIsSource (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alSourcei * Signature: (III)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alSourcei (JNIEnv *, jclass, jint, jint, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alSourcef * Signature: (IIF)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alSourcef (JNIEnv *, jclass, jint, jint, jfloat); /* * Class: org_lwjgl_openal_AL10 * Method: nalSourcefv * Signature: (IILjava/nio/FloatBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalSourcefv (JNIEnv *, jclass, jint, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alSource3f * Signature: (IIFFF)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alSource3f (JNIEnv *, jclass, jint, jint, jfloat, jfloat, jfloat); /* * Class: org_lwjgl_openal_AL10 * Method: alGetSourcei * Signature: (II)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_AL10_alGetSourcei (JNIEnv *, jclass, jint, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alGetSourcef * Signature: (II)F */ JNIEXPORT jfloat JNICALL Java_org_lwjgl_openal_AL10_alGetSourcef (JNIEnv *, jclass, jint, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalGetSourcefv * Signature: (IILjava/nio/FloatBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalGetSourcefv (JNIEnv *, jclass, jint, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalSourcePlayv * Signature: (ILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalSourcePlayv (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalSourcePausev * Signature: (ILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalSourcePausev (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalSourceStopv * Signature: (ILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalSourceStopv (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalSourceRewindv * Signature: (ILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalSourceRewindv (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alSourcePlay * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alSourcePlay (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alSourcePause * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alSourcePause (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alSourceStop * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alSourceStop (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alSourceRewind * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alSourceRewind (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalGenBuffers * Signature: (ILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalGenBuffers (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalDeleteBuffers * Signature: (ILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalDeleteBuffers (JNIEnv *, jclass, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alIsBuffer * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_AL10_alIsBuffer (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalBufferData * Signature: (IILjava/nio/ByteBuffer;III)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalBufferData (JNIEnv *, jclass, jint, jint, jobject, jint, jint, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alGetBufferi * Signature: (II)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_AL10_alGetBufferi (JNIEnv *, jclass, jint, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alGetBufferf * Signature: (II)F */ JNIEXPORT jfloat JNICALL Java_org_lwjgl_openal_AL10_alGetBufferf (JNIEnv *, jclass, jint, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalSourceQueueBuffers * Signature: (IILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalSourceQueueBuffers (JNIEnv *, jclass, jint, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: nalSourceUnqueueBuffers * Signature: (IILjava/nio/IntBuffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_nalSourceUnqueueBuffers (JNIEnv *, jclass, jint, jint, jobject, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alDistanceModel * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alDistanceModel (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_AL10 * Method: alDopplerFactor * Signature: (F)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alDopplerFactor (JNIEnv *, jclass, jfloat); /* * Class: org_lwjgl_openal_AL10 * Method: alDopplerVelocity * Signature: (F)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL10_alDopplerVelocity (JNIEnv *, jclass, jfloat); #ifdef __cplusplus } #endif #endif --- NEW FILE: org_lwjgl_openal_ALC.h --- /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class org_lwjgl_openal_ALC */ #ifndef _Included_org_lwjgl_openal_ALC #define _Included_org_lwjgl_openal_ALC #ifdef __cplusplus extern "C" { #endif /* Inaccessible static: created */ #undef org_lwjgl_openal_ALC_ALC_INVALID #define org_lwjgl_openal_ALC_ALC_INVALID -1L #undef org_lwjgl_openal_ALC_ALC_FALSE #define org_lwjgl_openal_ALC_ALC_FALSE 0L #undef org_lwjgl_openal_ALC_ALC_TRUE #define org_lwjgl_openal_ALC_ALC_TRUE 1L #undef org_lwjgl_openal_ALC_ALC_NO_ERROR #define org_lwjgl_openal_ALC_ALC_NO_ERROR 0L #undef org_lwjgl_openal_ALC_ALC_MAJOR_VERSION #define org_lwjgl_openal_ALC_ALC_MAJOR_VERSION 4096L #undef org_lwjgl_openal_ALC_ALC_MINOR_VERSION #define org_lwjgl_openal_ALC_ALC_MINOR_VERSION 4097L #undef org_lwjgl_openal_ALC_ALC_ATTRIBUTES_SIZE #define org_lwjgl_openal_ALC_ALC_ATTRIBUTES_SIZE 4098L #undef org_lwjgl_openal_ALC_ALC_ALL_ATTRIBUTES #define org_lwjgl_openal_ALC_ALC_ALL_ATTRIBUTES 4099L #undef org_lwjgl_openal_ALC_ALC_DEFAULT_DEVICE_SPECIFIER #define org_lwjgl_openal_ALC_ALC_DEFAULT_DEVICE_SPECIFIER 4100L #undef org_lwjgl_openal_ALC_ALC_DEVICE_SPECIFIER #define org_lwjgl_openal_ALC_ALC_DEVICE_SPECIFIER 4101L #undef org_lwjgl_openal_ALC_ALC_EXTENSIONS #define org_lwjgl_openal_ALC_ALC_EXTENSIONS 4102L #undef org_lwjgl_openal_ALC_ALC_FREQUENCY #define org_lwjgl_openal_ALC_ALC_FREQUENCY 4103L #undef org_lwjgl_openal_ALC_ALC_REFRESH #define org_lwjgl_openal_ALC_ALC_REFRESH 4104L #undef org_lwjgl_openal_ALC_ALC_SYNC #define org_lwjgl_openal_ALC_ALC_SYNC 4105L #undef org_lwjgl_openal_ALC_ALC_INVALID_DEVICE #define org_lwjgl_openal_ALC_ALC_INVALID_DEVICE 40961L #undef org_lwjgl_openal_ALC_ALC_INVALID_CONTEXT #define org_lwjgl_openal_ALC_ALC_INVALID_CONTEXT 40962L #undef org_lwjgl_openal_ALC_ALC_INVALID_ENUM #define org_lwjgl_openal_ALC_ALC_INVALID_ENUM 40963L #undef org_lwjgl_openal_ALC_ALC_INVALID_VALUE #define org_lwjgl_openal_ALC_ALC_INVALID_VALUE 40964L #undef org_lwjgl_openal_ALC_ALC_OUT_OF_MEMORY #define org_lwjgl_openal_ALC_ALC_OUT_OF_MEMORY 40965L /* * Class: org_lwjgl_openal_ALC * Method: nalcGetString * Signature: (II)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_nalcGetString (JNIEnv *, jclass, jint, jint); /* * Class: org_lwjgl_openal_ALC * Method: nalcGetIntegerv * Signature: (IIILjava/nio/Buffer;I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nalcGetIntegerv (JNIEnv *, jclass, jint, jint, jint, jobject, jint); /* * Class: org_lwjgl_openal_ALC * Method: alcOpenDevice * Signature: (Ljava/lang/String;)Lorg/lwjgl/openal/ALCdevice; */ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_alcOpenDevice (JNIEnv *, jclass, jstring); /* * Class: org_lwjgl_openal_ALC * Method: alcCloseDevice * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_alcCloseDevice (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_ALC * Method: alcCreateContext * Signature: (ILjava/nio/IntBuffer;)Lorg/lwjgl/openal/ALCcontext; */ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_alcCreateContext (JNIEnv *, jclass, jint, jobject); /* * Class: org_lwjgl_openal_ALC * Method: alcMakeContextCurrent * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_alcMakeContextCurrent (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_ALC * Method: nalcProcessContext * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nalcProcessContext (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_ALC * Method: alcGetCurrentContext * Signature: ()Lorg/lwjgl/openal/ALCcontext; */ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_alcGetCurrentContext (JNIEnv *, jclass); /* * Class: org_lwjgl_openal_ALC * Method: alcGetContextsDevice * Signature: (I)Lorg/lwjgl/openal/ALCdevice; */ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_alcGetContextsDevice (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_ALC * Method: alcSuspendContext * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_alcSuspendContext (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_ALC * Method: alcDestroyContext * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_alcDestroyContext (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_ALC * Method: nalcGetError * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_nalcGetError (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_openal_ALC * Method: nalcIsExtensionPresent * Signature: (ILjava/lang/String;)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_nalcIsExtensionPresent (JNIEnv *, jclass, jint, jstring); /* * Class: org_lwjgl_openal_ALC * Method: nalcGetEnumValue * Signature: (ILjava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_nalcGetEnumValue (JNIEnv *, jclass, jint, jstring); #ifdef __cplusplus } #endif #endif |
|
From: Erik D. <ed...@us...> - 2004-03-21 16:01:13
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22615/src/java/org/lwjgl/opengl/glu Modified Files: Project.java Log Message: replaced buffers with arrays Index: Project.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/Project.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Project.java 21 Mar 2004 08:52:46 -0000 1.7 +++ Project.java 21 Mar 2004 15:51:06 -0000 1.8 @@ -4,27 +4,26 @@ import org.lwjgl.opengl.GL11; import java.nio.FloatBuffer; -import java.nio.IntBuffer; /** * Project.java * <p/> * <p/> * Created 11-jan-2004 - * + * * @author Erik Duijs */ public class Project extends Util { - private static final float[] IDENTITY_MATRIX = new float[] { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - }; + private static final float[] IDENTITY_MATRIX = + new float[] { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f }; private static final FloatBuffer matrix = BufferUtils.createFloatBuffer(16); - private static final FloatBuffer finalMatrix = BufferUtils.createFloatBuffer(16); + private static final float[][] finalMatrix = new float[4][4]; private static final float[][] tempMatrix = new float[4][4]; private static final float[] in = new float[4]; @@ -43,88 +42,101 @@ m.position(oldPos); } + private static void __gluMakeIdentityf(float[][] m) { + for (int i = 0; i < 16; i++) { + m[i>>2][i%4] = IDENTITY_MATRIX[i]; + } + } + /** * Method __gluMultMatrixVecf - * + * * @param finalMatrix * @param in * @param out */ - private static void __gluMultMatrixVecf(FloatBuffer finalMatrix, float[] in, float[] out) { - for ( int i = 0; i < 4; i++ ) { - out[i] = in[0] * finalMatrix.get((0 * 4) + i) - + in[1] * finalMatrix.get((1 * 4) + i) - + in[2] * finalMatrix.get((2 * 4) + i) - + in[3] * finalMatrix.get((3 * 4) + i); + private static void __gluMultMatrixVecf(float[][] finalMatrix, float[] in, float[] out) { + for (int i = 0; i < 4; i++) { + out[i] = + in[0] * finalMatrix[0][i] + + in[1] * finalMatrix[1][i] + + in[2] * finalMatrix[2][1] + + in[3] * finalMatrix[3][i]; + } } /** * @param src * @param inverse - * + * * @return */ - private static boolean __gluInvertMatrixf(FloatBuffer src, FloatBuffer inverse) { + private static boolean __gluInvertMatrixf(float[][] src, float[][] inverse) { int i, j, k, swap; float t; float[][] temp = Project.tempMatrix; - for ( i = 0; i < 4; i++ ) { - for ( j = 0; j < 4; j++ ) { - temp[i][j] = src.get((i << 2) + j); + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + temp[i][j] = src[i][j]; } } __gluMakeIdentityf(inverse); - for ( i = 0; i < 4; i++ ) { + for (i = 0; i < 4; i++) { /* - ** Look for largest element in column + * * Look for largest element in column */ swap = i; - for ( j = i + 1; j < 4; j++ ) { - /*if (fabs(temp[j][i]) > fabs(temp[i][i])) { - swap = j; - }*/ - if ( Math.abs(temp[j][i]) > Math.abs(temp[i][i]) ) { + for (j = i + 1; j < 4; j++) { + /* + * if (fabs(temp[j][i]) > fabs(temp[i][i])) { swap = j; + */ + if (Math.abs(temp[j][i]) > Math.abs(temp[i][i])) { swap = j; } } - if ( swap != i ) { + if (swap != i) { /* - ** Swap rows. + * * Swap rows. */ - for ( k = 0; k < 4; k++ ) { + for (k = 0; k < 4; k++) { t = temp[i][k]; temp[i][k] = temp[swap][k]; temp[swap][k] = t; - t = inverse.get((i << 2) + k); - inverse.put((i << 2) + k, inverse.get((swap << 2) + k)); - inverse.put((swap << 2) + k, t); + t = inverse[i][k]; + inverse[i][k] = inverse[swap][k]; + //inverse.put((i << 2) + k, inverse.get((swap << 2) + k)); + inverse[swap][k] = t; + //inverse.put((swap << 2) + k, t); } } - if ( temp[i][i] == 0 ) { + if (temp[i][i] == 0) { /* - ** No non-zero pivot. The matrix is singular, which shouldn't - ** happen. This means the user gave us a bad matrix. + * * No non-zero pivot. The matrix is singular, which shouldn't * + * happen. This means the user gave us a bad matrix. */ return false; } t = temp[i][i]; - for ( k = 0; k < 4; k++ ) { + for (k = 0; k < 4; k++) { temp[i][k] /= t; - inverse.put((i << 2) + k, inverse.get((i << 2) + k) / t); + inverse[i][k] = inverse[i][k] / t; } - for ( j = 0; j < 4; j++ ) { - if ( j != i ) { + for (j = 0; j < 4; j++) { + if (j != i) { t = temp[j][i]; - for ( k = 0; k < 4; k++ ) { + for (k = 0; k < 4; k++) { temp[j][k] -= temp[i][k] * t; - inverse.put((j << 2) + k, inverse.get((j << 2) + k) - inverse.get((i << 2) + k) * t); + inverse[j][k] = inverse[j][k] - inverse[i][k] * t; + /*inverse.put( + (j << 2) + k, + inverse.get((j << 2) + k) - inverse.get((i << 2) + k) * t);*/ } } } @@ -137,21 +149,18 @@ * @param b * @param r */ - private static void __gluMultMatricesf(FloatBuffer a, FloatBuffer b, FloatBuffer r) { - for ( int i = 0; i < 4; i++ ) { - for ( int j = 0; j < 4; j++ ) { - r.put((i << 2) + j, - a.get((i << 2) + 0) * b.get((0 * 4) + j) + - a.get((i << 2) + 1) * b.get((1 * 4) + j) + - a.get((i << 2) + 2) * b.get((2 * 4) + j) + - a.get((i << 2) + 3) * b.get((3 * 4) + j)); + private static void __gluMultMatricesf(float[][] a, float[][] b, float[][] r) { + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + r[i][j] = + a[i][0] * b[0][j] + a[i][1] * b[1][j] + a[i][2] * b[2][j] + a[i][3] * b[3][j]; } } } /** * Method gluPerspective. - * + * * @param fovy * @param aspect * @param zNear @@ -162,19 +171,19 @@ float radians = fovy / 2 * GLU.PI / 180; deltaZ = zFar - zNear; - sine = (float)Math.sin(radians); + sine = (float) Math.sin(radians); - if ( (deltaZ == 0) || (sine == 0) || (aspect == 0) ) { + if ((deltaZ == 0) || (sine == 0) || (aspect == 0)) { return; } - cotangent = (float)Math.cos(radians) / sine; + cotangent = (float) Math.cos(radians) / sine; __gluMakeIdentityf(matrix); matrix.put(0 * 4 + 0, cotangent / aspect); matrix.put(1 * 4 + 1, cotangent); - matrix.put(2 * 4 + 2, -(zFar + zNear) / deltaZ); + matrix.put(2 * 4 + 2, - (zFar + zNear) / deltaZ); matrix.put(2 * 4 + 3, -1); matrix.put(3 * 4 + 2, -2 * zNear * zFar / deltaZ); matrix.put(3 * 4 + 3, 0); @@ -184,7 +193,7 @@ /** * Method gluLookAt - * + * * @param eyex * @param eyey * @param eyez @@ -195,9 +204,16 @@ * @param upy * @param upz */ - public static void gluLookAt(float eyex, float eyey, float eyez, - float centerx, float centery, float centerz, - float upx, float upy, float upz) { + public static void gluLookAt( + float eyex, + float eyey, + float eyez, + float centerx, + float centery, + float centerz, + float upx, + float upy, + float upz) { float[] forward = Project.forward; float[] side = Project.side; float[] up = Project.up; @@ -238,7 +254,7 @@ /** * Method gluProject - * + * * @param objx * @param objy * @param objz @@ -246,14 +262,18 @@ * @param projMatrix * @param viewport * @param win_pos - * + * * @return */ - public static boolean gluProject(float objx, float objy, float objz, - FloatBuffer modelMatrix, - FloatBuffer projMatrix, - IntBuffer viewport, - FloatBuffer win_pos) { + public static boolean gluProject( + float objx, + float objy, + float objz, + float[][] modelMatrix, + float[][] projMatrix, + int[] viewport, + float[] win_pos) { + float[] in = Project.in; float[] out = Project.out; @@ -265,7 +285,7 @@ __gluMultMatrixVecf(modelMatrix, in, out); __gluMultMatrixVecf(projMatrix, out, in); - if ( in[3] == 0.0 ) + if (in[3] == 0.0) return false; in[3] = (1.0f / in[3]) * 0.5f; @@ -275,19 +295,17 @@ in[1] = in[1] * in[3] + 0.5f; in[2] = in[2] * in[3] + 0.5f; - int pos = win_pos.position(); - // Map x,y to viewport - win_pos.put(pos++, in[0] * viewport.get(2) + viewport.get(0)); - win_pos.put(pos++, in[1] * viewport.get(3) + viewport.get(1)); - win_pos.put(pos, in[2]); + win_pos[0] = in[0] * viewport[2] + viewport[0]; + win_pos[1] = in[1] * viewport[3] + viewport[1]; + win_pos[2] = in[2]; return true; } /** * Method gluUnproject - * + * * @param winx * @param winy * @param winz @@ -295,20 +313,23 @@ * @param projMatrix * @param viewport * @param obj_pos - * + * * @return */ - public static boolean gluUnProject(float winx, float winy, float winz, - FloatBuffer modelMatrix, - FloatBuffer projMatrix, - IntBuffer viewport, - FloatBuffer obj_pos) { + public static boolean gluUnProject( + float winx, + float winy, + float winz, + float[][] modelMatrix, + float[][] projMatrix, + int[] viewport, + float[] obj_pos) { float[] in = Project.in; float[] out = Project.out; __gluMultMatricesf(modelMatrix, projMatrix, finalMatrix); - if ( !__gluInvertMatrixf(finalMatrix, finalMatrix) ) + if (!__gluInvertMatrixf(finalMatrix, finalMatrix)) return false; in[0] = winx; @@ -317,8 +338,8 @@ in[3] = 1.0f; // Map x and y from window coordinates - in[0] = (in[0] - viewport.get(0)) / viewport.get(2); - in[1] = (in[1] - viewport.get(1)) / viewport.get(3); + in[0] = (in[0] - viewport[0]) / viewport[2]; + in[1] = (in[1] - viewport[1]) / viewport[3]; // Map to range -1 to 1 in[0] = in[0] * 2 - 1; @@ -327,38 +348,42 @@ __gluMultMatrixVecf(finalMatrix, in, out); - if ( out[3] == 0.0 ) + if (out[3] == 0.0) return false; out[3] = 1.0f / out[3]; - int pos = obj_pos.position(); - - obj_pos.put(pos++, out[0] * out[3]); - obj_pos.put(pos++, out[1] * out[3]); - obj_pos.put(pos, out[2] * out[3]); + obj_pos[0] = out[0] * out[3]; + obj_pos[1] = out[1] * out[3]; + obj_pos[2] = out[2] * out[3]; return true; } /** * Method gluPickMatrix - * + * * @param x * @param y * @param deltaX * @param deltaY * @param viewport */ - public static void gluPickMatrix(float x, float y, float deltaX, float deltaY, IntBuffer viewport) { - if ( deltaX <= 0 || deltaY <= 0 ) { + public static void gluPickMatrix( + float x, + float y, + float deltaX, + float deltaY, + int[] viewport) { + if (deltaX <= 0 || deltaY <= 0) { return; } /* Translate and scale the picked region to the entire window */ - GL11.glTranslatef((viewport.get(2) - 2 * (x - viewport.get(0))) / deltaX, - (viewport.get(3) - 2 * (y - viewport.get(1))) / deltaY, - 0); - GL11.glScalef(viewport.get(2) / deltaX, viewport.get(3) / deltaY, 1.0f); + GL11.glTranslatef( + (viewport[2] - 2 * (x - viewport[0])) / deltaX, + (viewport[3] - 2 * (y - viewport[1])) / deltaY, + 0); + GL11.glScalef(viewport[2] / deltaX, viewport[3] / deltaY, 1.0f); } -} +} \ No newline at end of file |
|
From: Erik D. <ed...@us...> - 2004-03-21 15:58:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21981/src/java/org/lwjgl/opengl/glu Modified Files: GLU.java Log Message: replaced buffers with arrays Index: GLU.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/GLU.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- GLU.java 21 Mar 2004 08:52:46 -0000 1.8 +++ GLU.java 21 Mar 2004 15:48:21 -0000 1.9 @@ -1,8 +1,6 @@ package org.lwjgl.opengl.glu; import java.nio.ByteBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -264,10 +262,10 @@ * @return */ public static boolean gluProject(float objx, float objy, float objz, - FloatBuffer modelMatrix, - FloatBuffer projMatrix, - IntBuffer viewport, - FloatBuffer win_pos) + float[][] modelMatrix, + float[][] projMatrix, + int[] viewport, + float[] win_pos) { return Project.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, win_pos); } @@ -284,10 +282,10 @@ * @return */ public static boolean gluUnProject(float winx, float winy, float winz, - FloatBuffer modelMatrix, - FloatBuffer projMatrix, - IntBuffer viewport, - FloatBuffer obj_pos) + float[][] modelMatrix, + float[][] projMatrix, + int[] viewport, + float[] obj_pos) { return Project.gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, obj_pos); } @@ -305,7 +303,7 @@ float y, float width, float height, - IntBuffer viewport) { + int[] viewport) { Project.gluPickMatrix(x, y, width, height, viewport); } |
|
From: Elias N. <eli...@us...> - 2004-03-21 09:02:51
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10999/src/java/org/lwjgl/opengl/glu Modified Files: Cylinder.java Disk.java GLU.java MipMap.java PartialDisk.java PixelStoreState.java Project.java Quadric.java Registry.java Sphere.java Removed Files: GLUConstants.java Log Message: Folded GLUConstants into GLU Index: Sphere.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/Sphere.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Sphere.java 29 Feb 2004 23:42:51 -0000 1.3 +++ Sphere.java 21 Mar 2004 08:52:46 -0000 1.4 @@ -10,7 +10,7 @@ * Created 23-dec-2003 * @author Erik Duijs */ -public class Sphere extends Quadric implements GLUConstants { +public class Sphere extends Quadric { /** * Constructor @@ -44,18 +44,18 @@ boolean normals; float nsign; - normals = super.normals != GLU_NONE; + normals = super.normals != GLU.GLU_NONE; - if (super.orientation == GLU_INSIDE) { + if (super.orientation == GLU.GLU_INSIDE) { nsign = -1.0f; } else { nsign = 1.0f; } - drho = PI / stacks; - dtheta = 2.0f * PI / slices; + drho = GLU.PI / stacks; + dtheta = 2.0f * GLU.PI / slices; - if (super.drawStyle == GLU_FILL) { + if (super.drawStyle == GLU.GLU_FILL) { if (super.textureFlag) { // draw +Z end as a triangle fan GL11.glBegin(GL11.GL_TRIANGLE_FAN); @@ -119,7 +119,7 @@ GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glNormal3f(0.0f, 0.0f, -1.0f); GL11.glVertex3f(0.0f, 0.0f, -radius * nsign); - rho = PI - drho; + rho = GLU.PI - drho; s = 1.0f; for (j = slices; j >= 0; j--) { theta = (j == slices) ? 0.0f : j * dtheta; @@ -134,8 +134,8 @@ GL11.glEnd(); } } else if ( - super.drawStyle == GLU_LINE - || super.drawStyle == GLU_SILHOUETTE) { + super.drawStyle == GLU.GLU_LINE + || super.drawStyle == GLU.GLU_SILHOUETTE) { // draw stack lines for (i = 1; i < stacks; @@ -168,7 +168,7 @@ } GL11.glEnd(); } - } else if (super.drawStyle == GLU_POINT) { + } else if (super.drawStyle == GLU.GLU_POINT) { // top and bottom-most points GL11.glBegin(GL11.GL_POINTS); if (normals) @@ -195,4 +195,4 @@ } } -} \ No newline at end of file +} Index: PixelStoreState.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/PixelStoreState.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- PixelStoreState.java 29 Feb 2004 23:42:51 -0000 1.3 +++ PixelStoreState.java 21 Mar 2004 08:52:46 -0000 1.4 @@ -9,7 +9,7 @@ * Created 11-jan-2004 * @author Erik Duijs */ -class PixelStoreState extends Util implements GLUConstants { +class PixelStoreState extends Util { public int unpackRowLength = glGetIntegerv(GL11.GL_UNPACK_ROW_LENGTH); public int unpackAlignment = glGetIntegerv(GL11.GL_UNPACK_ALIGNMENT); Index: PartialDisk.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/PartialDisk.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PartialDisk.java 21 Jan 2004 17:27:49 -0000 1.2 +++ PartialDisk.java 21 Mar 2004 08:52:46 -0000 1.3 @@ -10,7 +10,7 @@ * * @author Erik Duijs */ -public class PartialDisk extends Quadric implements GLUConstants { +public class PartialDisk extends Quadric { private static final int CACHE_SIZE = 240; @@ -36,7 +36,7 @@ * * With respect to orientation, the +z side of the partial disk is * considered to be outside (see gluQuadricOrientation). This means that if - * the orientation is set to GLU_OUTSIDE, then any normals generated point + * the orientation is set to GLU.GLU_OUTSIDE, then any normals generated point * along the +z axis. Otherwise, they point along the -z axis. * * If texturing is turned on (with gluQuadricTexture), texture coordinates @@ -72,7 +72,7 @@ || outerRadius <= 0.0f || innerRadius < 0.0f || innerRadius > outerRadius) { - //gluQuadricError(qobj, GLU_INVALID_VALUE); + //gluQuadricError(qobj, GLU.GLU_INVALID_VALUE); System.err.println("PartialDisk: GLU_INVALID_VALUE"); return; } @@ -97,9 +97,9 @@ /* Cache is the vertex locations cache */ - angleOffset = startAngle / 180.0f * PI; + angleOffset = startAngle / 180.0f * GLU.PI; for (i = 0; i <= slices; i++) { - angle = angleOffset + ((PI * sweepAngle) / 180.0f) * i / slices; + angle = angleOffset + ((GLU.PI * sweepAngle) / 180.0f) * i / slices; sinCache[i] = sin(angle); cosCache[i] = cos(angle); } @@ -110,21 +110,21 @@ } switch (super.normals) { - case GLU_FLAT : - case GLU_SMOOTH : - if (super.orientation == GLU_OUTSIDE) { + case GLU.GLU_FLAT : + case GLU.GLU_SMOOTH : + if (super.orientation == GLU.GLU_OUTSIDE) { GL11.glNormal3f(0.0f, 0.0f, 1.0f); } else { GL11.glNormal3f(0.0f, 0.0f, -1.0f); } break; default : - case GLU_NONE : + case GLU.GLU_NONE : break; } switch (super.drawStyle) { - case GLU_FILL : + case GLU.GLU_FILL : if (innerRadius == .0f) { finish = loops - 1; /* Triangle strip for inner polygons */ @@ -138,7 +138,7 @@ texLow = radiusLow / outerRadius / 2; } - if (super.orientation == GLU_OUTSIDE) { + if (super.orientation == GLU.GLU_OUTSIDE) { for (i = slices; i >= 0; i--) { if (super.textureFlag) { GL11.glTexCoord2f( @@ -171,7 +171,7 @@ GL11.glBegin(GL11.GL_QUAD_STRIP); for (i = 0; i <= slices; i++) { - if (super.orientation == GLU_OUTSIDE) { + if (super.orientation == GLU.GLU_OUTSIDE) { if (super.textureFlag) { GL11.glTexCoord2f( texLow * sinCache[i] + 0.5f, @@ -210,7 +210,7 @@ GL11.glEnd(); } break; - case GLU_POINT : + case GLU.GLU_POINT : GL11.glBegin(GL11.GL_POINTS); for (i = 0; i < slices2; i++) { sintemp = sinCache[i]; @@ -230,7 +230,7 @@ } GL11.glEnd(); break; - case GLU_LINE : + case GLU.GLU_LINE : if (innerRadius == outerRadius) { GL11.glBegin(GL11.GL_LINE_STRIP); @@ -280,7 +280,7 @@ GL11.glEnd(); } break; - case GLU_SILHOUETTE : + case GLU.GLU_SILHOUETTE : if (sweepAngle < 360.0f) { for (i = 0; i <= slices; i += slices) { sintemp = sinCache[i]; Index: MipMap.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/MipMap.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- MipMap.java 29 Feb 2004 23:42:51 -0000 1.3 +++ MipMap.java 21 Mar 2004 08:52:46 -0000 1.4 @@ -11,7 +11,7 @@ * Created 11-jan-2004 * @author Erik Duijs */ -public class MipMap extends Util implements GLUConstants { +public class MipMap extends Util { /** * Method gluBuild2DMipmaps @@ -41,7 +41,7 @@ int neww, newh, level, bpp; boolean done; - if (width < 1 || height < 1) return GLU_INVALID_VALUE; + if (width < 1 || height < 1) return GLU.GLU_INVALID_VALUE; maxSize = glGetIntegerv(GL11.GL_MAX_TEXTURE_SIZE); @@ -56,7 +56,7 @@ bpp = bytesPerPixel(format, type); if (bpp == 0) { - return GLU_INVALID_ENUM; + return GLU.GLU_INVALID_ENUM; } // Get current glPixelStore state @@ -152,7 +152,7 @@ components = compPerPix(format); if (components == -1) { - return GLU_INVALID_ENUM; + return GLU.GLU_INVALID_ENUM; } // temp image data @@ -206,7 +206,7 @@ break; default : - return GLU_INVALID_ENUM; + return GLU.GLU_INVALID_ENUM; } // Do scaling @@ -279,9 +279,9 @@ break; default : - return GLU_INVALID_ENUM; + return GLU.GLU_INVALID_ENUM; } return 0; } -} \ No newline at end of file +} Index: Quadric.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/Quadric.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Quadric.java 28 Jan 2004 19:44:26 -0000 1.3 +++ Quadric.java 21 Mar 2004 08:52:46 -0000 1.4 @@ -9,7 +9,7 @@ * Created 22-dec-2003 * @author Erik Duijs */ -public class Quadric implements GLUConstants { +public class Quadric { protected int drawStyle; protected int orientation; @@ -22,10 +22,10 @@ public Quadric() { super(); - drawStyle = GLUConstants.GLU_FILL; - orientation = GLUConstants.GLU_OUTSIDE; + drawStyle = GLU.GLU_FILL; + orientation = GLU.GLU_OUTSIDE; textureFlag = false; - normals = GLUConstants.GLU_SMOOTH; + normals = GLU.GLU_SMOOTH; } /** Index: Disk.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/Disk.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Disk.java 21 Jan 2004 10:06:47 -0000 1.2 +++ Disk.java 21 Mar 2004 08:52:46 -0000 1.3 @@ -9,7 +9,7 @@ * Created 23-dec-2003 * @author Erik Duijs */ -public class Disk extends Quadric implements GLUConstants { +public class Disk extends Quadric { /** * Constructor for Disk. @@ -41,8 +41,8 @@ float da, dr; /* Normal vectors */ - if (super.normals != GLU_NONE) { - if (super.orientation == GLU_OUTSIDE) { + if (super.normals != GLU.GLU_NONE) { + if (super.orientation == GLU.GLU_OUTSIDE) { GL11.glNormal3f(0.0f, 0.0f, +1.0f); } else { @@ -50,11 +50,11 @@ } } - da = 2.0f * PI / slices; + da = 2.0f * GLU.PI / slices; dr = (outerRadius - innerRadius) / loops; switch (super.drawStyle) { - case GLU_FILL: + case GLU.GLU_FILL: { /* texture of a gluDisk is a cut out of the texture unit square * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] @@ -66,7 +66,7 @@ int l; for (l = 0; l < loops; l++) { float r2 = r1 + dr; - if (super.orientation == GLU_OUTSIDE) { + if (super.orientation == GLU.GLU_OUTSIDE) { int s; GL11.glBegin(GL11.GL_QUAD_STRIP); for (s = 0; s <= slices; s++) { @@ -106,7 +106,7 @@ } break; } - case GLU_LINE: + case GLU.GLU_LINE: { int l, s; /* draw loops */ @@ -133,7 +133,7 @@ } break; } - case GLU_POINT: + case GLU.GLU_POINT: { int s; GL11.glBegin(GL11.GL_POINTS); @@ -150,12 +150,12 @@ GL11.glEnd(); break; } - case GLU_SILHOUETTE: + case GLU.GLU_SILHOUETTE: { if (innerRadius != 0.0) { float a; GL11.glBegin(GL11.GL_LINE_LOOP); - for (a = 0.0f; a < 2.0 * PI; a += da) { + for (a = 0.0f; a < 2.0 * GLU.PI; a += da) { float x = innerRadius * sin(a); float y = innerRadius * cos(a); GL11.glVertex2f(x, y); @@ -165,7 +165,7 @@ { float a; GL11.glBegin(GL11.GL_LINE_LOOP); - for (a = 0; a < 2.0f * PI; a += da) { + for (a = 0; a < 2.0f * GLU.PI; a += da) { float x = outerRadius * sin(a); float y = outerRadius * cos(a); GL11.glVertex2f(x, y); --- GLUConstants.java DELETED --- Index: GLU.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/GLU.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- GLU.java 21 Mar 2004 08:13:07 -0000 1.7 +++ GLU.java 21 Mar 2004 08:52:46 -0000 1.8 @@ -14,7 +14,185 @@ * Created 23-dec-2003 * @author Erik Duijs */ -public class GLU implements GLUConstants { +public class GLU { + static final float PI = (float)Math.PI; + + /* Errors: (return value 0 = no error) */ + public static final int GLU_INVALID_ENUM = 100900; + public static final int GLU_INVALID_VALUE = 100901; + public static final int GLU_OUT_OF_MEMORY = 100902; + public static final int GLU_INCOMPATIBLE_GL_VERSION = 100903; + + /* StringName */ + public static final int GLU_VERSION = 100800; + public static final int GLU_EXTENSIONS = 100801; + + /* Boolean */ + public static final boolean GLU_TRUE = true; + public static final boolean GLU_FALSE = false; + + + /**** Quadric constants ****/ + + /* QuadricNormal */ + public static final int GLU_SMOOTH = 100000; + public static final int GLU_FLAT = 100001; + public static final int GLU_NONE = 100002; + + /* QuadricDrawStyle */ + public static final int GLU_POINT = 100010; + public static final int GLU_LINE = 100011; + public static final int GLU_FILL = 100012; + public static final int GLU_SILHOUETTE = 100013; + + /* QuadricOrientation */ + public static final int GLU_OUTSIDE = 100020; + public static final int GLU_INSIDE = 100021; + + /* Callback types: */ + /* ERROR = 100103 */ + + + /**** Tesselation constants ****/ + + public static final double TESS_MAX_COORD = 1.0e150; + + /* TessProperty */ + public static final int GLU_TESS_WINDING_RULE = 100140; + public static final int GLU_TESS_BOUNDARY_ONLY = 100141; + public static final int GLU_TESS_TOLERANCE = 100142; + + /* TessWinding */ + public static final int GLU_TESS_WINDING_ODD = 100130; + public static final int GLU_TESS_WINDING_NONZERO = 100131; + public static final int GLU_TESS_WINDING_POSITIVE = 100132; + public static final int GLU_TESS_WINDING_NEGATIVE = 100133; + public static final int GLU_TESS_WINDING_ABS_GEQ_TWO = 100134; + + /* TessCallback */ + public static final int GLU_TESS_BEGIN = 100100; /* void (CALLBACK*)(GLenum type) */ + public static final int GLU_TESS_VERTEX = 100101; /* void (CALLBACK*)(void *data) */ + public static final int GLU_TESS_END = 100102; /* void (CALLBACK*)(void) */ + public static final int GLU_TESS_ERROR = 100103; /* void (CALLBACK*)(GLenum errno) */ + public static final int GLU_TESS_EDGE_FLAG = 100104; /* void (CALLBACK*)(GLboolean boundaryEdge) */ + public static final int GLU_TESS_COMBINE = 100105; /* void (CALLBACK*)(GLdouble coords[3], + void *data[4], + GLfloat weight[4], + void **dataOut) */ + public static final int GLU_TESS_BEGIN_DATA = 100106; /* void (CALLBACK*)(GLenum type, + void *polygon_data) */ + public static final int GLU_TESS_VERTEX_DATA = 100107; /* void (CALLBACK*)(void *data, + void *polygon_data) */ + public static final int GLU_TESS_END_DATA = 100108; /* void (CALLBACK*)(void *polygon_data) */ + public static final int GLU_TESS_ERROR_DATA = 100109; /* void (CALLBACK*)(GLenum errno, + void *polygon_data) */ + public static final int GLU_TESS_EDGE_FLAG_DATA = 100110; /* void (CALLBACK*)(GLboolean boundaryEdge, + void *polygon_data) */ + public static final int GLU_TESS_COMBINE_DATA = 100111; /* void (CALLBACK*)(GLdouble coords[3], + void *data[4], + GLfloat weight[4], + void **dataOut, + void *polygon_data) */ + + /* TessError */ + public static final int GLU_TESS_ERROR1 = 100151; + public static final int GLU_TESS_ERROR2 = 100152; + public static final int GLU_TESS_ERROR3 = 100153; + public static final int GLU_TESS_ERROR4 = 100154; + public static final int GLU_TESS_ERROR5 = 100155; + public static final int GLU_TESS_ERROR6 = 100156; + public static final int GLU_TESS_ERROR7 = 100157; + public static final int GLU_TESS_ERROR8 = 100158; + + public static final int GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1; + public static final int GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2; + public static final int GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3; + public static final int GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4; + public static final int GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5; + public static final int GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6; + + /**** NURBS constants ****/ + + /* NurbsProperty */ + public static final int GLU_AUTO_LOAD_MATRIX = 100200; + public static final int GLU_CULLING = 100201; + public static final int GLU_SAMPLING_TOLERANCE = 100203; + public static final int GLU_DISPLAY_MODE = 100204; + public static final int GLU_PARAMETRIC_TOLERANCE = 100202; + public static final int GLU_SAMPLING_METHOD = 100205; + public static final int GLU_U_STEP = 100206; + public static final int GLU_V_STEP = 100207; + + /* NurbsSampling */ + public static final int GLU_PATH_LENGTH = 100215; + public static final int GLU_PARAMETRIC_ERROR = 100216; + public static final int GLU_DOMAIN_DISTANCE = 100217; + + + /* NurbsTrim */ + public static final int GLU_MAP1_TRIM_2 = 100210; + public static final int GLU_MAP1_TRIM_3 = 100211; + + /* NurbsDisplay */ + /* FILL = 100012 */ + public static final int GLU_OUTLINE_POLYGON = 100240; + public static final int GLU_OUTLINE_PATCH = 100241; + + /* NurbsCallback */ + /* ERROR = 100103 */ + + /* NurbsErrors */ + public static final int GLU_NURBS_ERROR1 = 100251; + public static final int GLU_NURBS_ERROR2 = 100252; + public static final int GLU_NURBS_ERROR3 = 100253; + public static final int GLU_NURBS_ERROR4 = 100254; + public static final int GLU_NURBS_ERROR5 = 100255; + public static final int GLU_NURBS_ERROR6 = 100256; + public static final int GLU_NURBS_ERROR7 = 100257; + public static final int GLU_NURBS_ERROR8 = 100258; + public static final int GLU_NURBS_ERROR9 = 100259; + public static final int GLU_NURBS_ERROR10 = 100260; + public static final int GLU_NURBS_ERROR11 = 100261; + public static final int GLU_NURBS_ERROR12 = 100262; + public static final int GLU_NURBS_ERROR13 = 100263; + public static final int GLU_NURBS_ERROR14 = 100264; + public static final int GLU_NURBS_ERROR15 = 100265; + public static final int GLU_NURBS_ERROR16 = 100266; + public static final int GLU_NURBS_ERROR17 = 100267; + public static final int GLU_NURBS_ERROR18 = 100268; + public static final int GLU_NURBS_ERROR19 = 100269; + public static final int GLU_NURBS_ERROR20 = 100270; + public static final int GLU_NURBS_ERROR21 = 100271; + public static final int GLU_NURBS_ERROR22 = 100272; + public static final int GLU_NURBS_ERROR23 = 100273; + public static final int GLU_NURBS_ERROR24 = 100274; + public static final int GLU_NURBS_ERROR25 = 100275; + public static final int GLU_NURBS_ERROR26 = 100276; + public static final int GLU_NURBS_ERROR27 = 100277; + public static final int GLU_NURBS_ERROR28 = 100278; + public static final int GLU_NURBS_ERROR29 = 100279; + public static final int GLU_NURBS_ERROR30 = 100280; + public static final int GLU_NURBS_ERROR31 = 100281; + public static final int GLU_NURBS_ERROR32 = 100282; + public static final int GLU_NURBS_ERROR33 = 100283; + public static final int GLU_NURBS_ERROR34 = 100284; + public static final int GLU_NURBS_ERROR35 = 100285; + public static final int GLU_NURBS_ERROR36 = 100286; + public static final int GLU_NURBS_ERROR37 = 100287; + + /* Contours types -- obsolete! */ + public static final int GLU_CW = 100120; + public static final int GLU_CCW = 100121; + public static final int GLU_INTERIOR = 100122; + public static final int GLU_EXTERIOR = 100123; + public static final int GLU_UNKNOWN = 100124; + + /* Names without "TESS_" prefix */ + public static final int GLU_BEGIN = GLU_TESS_BEGIN; + public static final int GLU_VERTEX = GLU_TESS_VERTEX; + public static final int GLU_END = GLU_TESS_END; + public static final int GLU_ERROR = GLU_TESS_ERROR; + public static final int GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG; /** * Method gluLookAt Index: Project.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/Project.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Project.java 4 Mar 2004 00:36:39 -0000 1.6 +++ Project.java 21 Mar 2004 08:52:46 -0000 1.7 @@ -14,7 +14,7 @@ * * @author Erik Duijs */ -public class Project extends Util implements GLUConstants { +public class Project extends Util { private static final float[] IDENTITY_MATRIX = new float[] { 1.0f, 0.0f, 0.0f, 0.0f, @@ -159,7 +159,7 @@ */ public static void gluPerspective(float fovy, float aspect, float zNear, float zFar) { float sine, cotangent, deltaZ; - float radians = fovy / 2 * PI / 180; + float radians = fovy / 2 * GLU.PI / 180; deltaZ = zFar - zNear; sine = (float)Math.sin(radians); Index: Registry.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/Registry.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Registry.java 29 Feb 2004 23:42:51 -0000 1.2 +++ Registry.java 21 Mar 2004 08:52:46 -0000 1.3 @@ -7,7 +7,7 @@ * Created 11-jan-2004 * @author Erik Duijs */ -public class Registry extends Util implements GLUConstants { +public class Registry extends Util { private static final String versionString = "1.3"; private static final String extensionString = @@ -20,9 +20,9 @@ */ public static String gluGetString(int name) { - if (name == GLU_VERSION) { + if (name == GLU.GLU_VERSION) { return versionString; - } else if (name == GLU_EXTENSIONS) { + } else if (name == GLU.GLU_EXTENSIONS) { return extensionString; } return null; Index: Cylinder.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/Cylinder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Cylinder.java 21 Jan 2004 10:06:47 -0000 1.2 +++ Cylinder.java 21 Mar 2004 08:52:46 -0000 1.3 @@ -9,7 +9,7 @@ * Created 23-dec-2003 * @author Erik Duijs */ -public class Cylinder extends Quadric implements GLUConstants { +public class Cylinder extends Quadric { /** * Constructor for Cylinder. @@ -49,19 +49,19 @@ float x, y, z, nz, nsign; int i, j; - if (super.orientation == GLU_INSIDE) { + if (super.orientation == GLU.GLU_INSIDE) { nsign = -1.0f; } else { nsign = 1.0f; } - da = 2.0f * PI / slices; + da = 2.0f * GLU.PI / slices; dr = (topRadius - baseRadius) / stacks; dz = height / stacks; nz = (baseRadius - topRadius) / height; // Z component of normal vectors - if (super.drawStyle == GLU_POINT) { + if (super.drawStyle == GLU.GLU_POINT) { GL11.glBegin(GL11.GL_POINTS); for (i = 0; i < slices; i++) { x = cos((i * da)); @@ -77,9 +77,9 @@ } } GL11.glEnd(); - } else if (super.drawStyle == GLU_LINE || super.drawStyle == GLU_SILHOUETTE) { + } else if (super.drawStyle == GLU.GLU_LINE || super.drawStyle == GLU.GLU_SILHOUETTE) { // Draw rings - if (super.drawStyle == GLU_LINE) { + if (super.drawStyle == GLU.GLU_LINE) { z = 0.0f; r = baseRadius; for (j = 0; j <= stacks; j++) { @@ -125,7 +125,7 @@ GL11.glVertex3f((x * topRadius), (y * topRadius), (height)); } GL11.glEnd(); - } else if (super.drawStyle == GLU_FILL) { + } else if (super.drawStyle == GLU.GLU_FILL) { float ds = 1.0f / slices; float dt = 1.0f / stacks; float t = 0.0f; |
|
From: Elias N. <eli...@us...> - 2004-03-21 08:23:38
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4831/src/java/org/lwjgl/opengl Modified Files: GL12.java OpenGLException.java Log Message: Added gluErrorString Index: GL12.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL12.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- GL12.java 18 Feb 2004 23:54:45 -0000 1.7 +++ GL12.java 21 Mar 2004 08:13:07 -0000 1.8 @@ -49,6 +49,10 @@ */ public final class GL12 { + /* Error codes */ + public static final int GL_TABLE_TOO_LARGE = 0x8031; + + /* Enums */ public static final int GL_PACK_SKIP_IMAGES = 0x806B; public static final int GL_PACK_IMAGE_HEIGHT = 0x806C; public static final int GL_UNPACK_SKIP_IMAGES = 0x806D; Index: OpenGLException.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/OpenGLException.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- OpenGLException.java 5 Feb 2004 17:14:50 -0000 1.6 +++ OpenGLException.java 21 Mar 2004 08:13:07 -0000 1.7 @@ -32,6 +32,8 @@ package org.lwjgl.opengl; +import org.lwjgl.opengl.glu.GLU; + /** * $Id$ * @@ -47,7 +49,12 @@ * Constructor for OpenGLException. */ public OpenGLException(int gl_error_code) { - super("GL error code: " + gl_error_code); + this(createErrorMessage(gl_error_code)); + } + + private final static String createErrorMessage(int gl_error_code) { + String error_string = GLU.gluErrorString(gl_error_code); + return error_string + " (" + gl_error_code + ")"; } /** |
|
From: Elias N. <eli...@us...> - 2004-03-21 08:23:28
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4831/src/java/org/lwjgl/opengl/glu Modified Files: GLU.java Log Message: Added gluErrorString Index: GLU.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/glu/GLU.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- GLU.java 29 Feb 2004 23:42:51 -0000 1.6 +++ GLU.java 21 Mar 2004 08:13:07 -0000 1.7 @@ -5,6 +5,7 @@ import java.nio.IntBuffer; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; /** * GLU.java @@ -200,4 +201,32 @@ return MipMap.gluScaleImage(format, widthIn, heightIn, typeIn, dataIn, widthOut, heightOut, typeOut, dataOut); } + public static String gluErrorString(int error_code) { + switch (error_code) { + case GL11.GL_NO_ERROR: + return "No error"; + case GL11.GL_INVALID_ENUM: + return "Invalid enum"; + case GL11.GL_INVALID_VALUE: + return "Invalid value"; + case GL11.GL_INVALID_OPERATION: + return "Invalid operation"; + case GL11.GL_STACK_OVERFLOW: + return "Stack overflow"; + case GL11.GL_STACK_UNDERFLOW: + return "Stack underflow"; + case GL11.GL_OUT_OF_MEMORY: + return "Out of memory"; + case GL12.GL_TABLE_TOO_LARGE: + return "Table too large"; + case GLU.GLU_INVALID_ENUM: + return "Invalid enum (glu)"; + case GLU.GLU_INVALID_VALUE: + return "Invalid value (glu)"; + case GLU.GLU_OUT_OF_MEMORY: + return "Out of memory (glu)"; + default: + return null; + } + } } |