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
(8) |
2
(34) |
|
3
(15) |
4
(17) |
5
(7) |
6
(2) |
7
(4) |
8
|
9
|
|
10
(1) |
11
(8) |
12
(5) |
13
(7) |
14
|
15
|
16
(1) |
|
17
(70) |
18
|
19
(5) |
20
(1) |
21
|
22
|
23
(7) |
|
24
(3) |
25
(3) |
26
(1) |
27
|
28
(1) |
29
(4) |
30
(3) |
|
31
|
|
|
|
|
|
|
|
From: Elias N. <eli...@us...> - 2003-08-04 23:01:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv8437/src/java/org/lwjgl Modified Files: Sys.java Log Message: Implemented safe VBO indices (phew) Index: Sys.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- Sys.java 3 Aug 2003 11:02:57 -0000 1.25 +++ Sys.java 4 Aug 2003 23:00:47 -0000 1.26 @@ -129,25 +129,6 @@ } /** - * Create a buffer representing an integer index. Use it with functions that in C can take - * both a pointer and an integer argument, like the ARB_vertex_buffer_object extension specifies - * gl*Pointer to do (among others). - * - * Example: - * - * ByteBuffer b = Sys.createIndexBuffer(0); - * gl.glVertexPointer(3, GL.GL_INT, 0, b); - * - * is equivalent to the C call: - * - * glVertexPointer(3, GL.GL_INT, 0, 0); - * - * @param index The index to represent - * @return a ByteBuffer representing the index - */ - public static native ByteBuffer createIndexBuffer(int index); - - /** * Obtains the number of ticks that the hires timer does in a second. * * @return timer resolution in ticks per second or 0 if no timer is present. |
|
From: Elias N. <eli...@us...> - 2003-08-04 23:00:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv8437/src/native/common Modified Files: extgl.h org_lwjgl_Sys.h org_lwjgl_opengl_CoreGL11.cpp org_lwjgl_opengl_CoreGL11.h org_lwjgl_opengl_CoreGL12.cpp org_lwjgl_opengl_CoreGL12.h org_lwjgl_opengl_CoreGL14.cpp org_lwjgl_opengl_CoreGL14.h org_lwjgl_opengl_GL.cpp org_lwjgl_opengl_GL.h Log Message: Implemented safe VBO indices (phew) Index: extgl.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extgl.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- extgl.h 3 Apr 2003 11:32:28 -0000 1.11 +++ extgl.h 4 Aug 2003 23:00:48 -0000 1.12 @@ -2625,7 +2625,7 @@ typedef void (APIENTRY * glSecondaryColor3uivPROC) (const GLuint *v); typedef void (APIENTRY * glSecondaryColor3usPROC) (GLushort red, GLushort green, GLushort blue); typedef void (APIENTRY * glSecondaryColor3usvPROC) (const GLushort *v); -typedef void (APIENTRY * glSecondaryColorPointerPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); +typedef void (APIENTRY * glSecondaryColorPointerPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRY * glBlendFuncSeparatePROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); typedef void (APIENTRY * glWindowPos2dPROC) (GLdouble x, GLdouble y); typedef void (APIENTRY * glWindowPos2fPROC) (GLfloat x, GLfloat y); @@ -4078,7 +4078,7 @@ typedef void (APIENTRY * glWeightubvARBPROC) (GLint size, GLubyte *weights); typedef void (APIENTRY * glWeightusvARBPROC) (GLint size, GLushort *weights); typedef void (APIENTRY * glWeightuivARBPROC) (GLint size, GLuint *weights); -typedef void (APIENTRY * glWeightPointerARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); +typedef void (APIENTRY * glWeightPointerARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRY * glVertexBlendARBPROC) (GLint count); extern glWeightbvARBPROC glWeightbvARB; Index: org_lwjgl_Sys.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_Sys.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_Sys.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- org_lwjgl_Sys.h 2 Aug 2003 15:21:55 -0000 1.10 +++ org_lwjgl_Sys.h 4 Aug 2003 23:00:49 -0000 1.11 @@ -22,14 +22,6 @@ /* Inaccessible static: class_00024org_00024lwjgl_00024Sys */ /* * Class: org_lwjgl_Sys - * Method: createIndexBuffer - * Signature: (I)Ljava/nio/ByteBuffer; - */ -JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_createIndexBuffer - (JNIEnv *, jclass, jint); - -/* - * Class: org_lwjgl_Sys * Method: getTimerResolution * Signature: ()J */ Index: org_lwjgl_opengl_CoreGL11.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL11.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL11.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_opengl_CoreGL11.cpp 2 Aug 2003 16:18:04 -0000 1.6 +++ org_lwjgl_opengl_CoreGL11.cpp 4 Aug 2003 23:00:49 -0000 1.7 @@ -54,6 +54,10 @@ return env->NewDirectByteBuffer(p, size); } +static inline const void *offsetToPointer(jint offset) { + return (const char *)NULL + offset; +} + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glAccum @@ -277,7 +281,7 @@ /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glColorPointer + * Method: nglColorPointer */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglColorPointer(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jobject buffer, jint buffer_offset) { @@ -288,6 +292,16 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglColorPointerVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglColorPointerVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint buffer_offset) +{ + glColorPointer((GLint) p0, (GLint) p1, (GLint) p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glColorMaterial */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glColorMaterial(JNIEnv * env, jclass clazz, jint p0, jint p1) @@ -493,9 +507,9 @@ /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glEdgeFlagPointer + * Method: nglEdgeFlagPointer */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglEdgeFlagPointer(JNIEnv * env, jclass clazz, jint p0, jobject buffer, int offset) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglEdgeFlagPointer(JNIEnv * env, jclass clazz, jint p0, jobject buffer, jint offset) { const GLbyte *address = offset + (const GLbyte *)env->GetDirectBufferAddress(buffer); glEdgeFlagPointer((GLint) p0, (const void *)address); @@ -504,6 +518,16 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglEdgeFlagPointerVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglEdgeFlagPointerVBO(JNIEnv * env, jclass clazz, jint p0, jint buffer_offset) +{ + glEdgeFlagPointer((GLint) p0, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glEdgeFlag */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glEdgeFlag(JNIEnv * env, jclass clazz, jboolean p0) @@ -524,7 +548,7 @@ /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glDrawElements + * Method: nglDrawElements */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglDrawElements(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jobject buffer, jint offset) { @@ -535,6 +559,16 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglDrawElementsVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglDrawElementsVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint buffer_offset) +{ + glDrawElements((GLint) p0, (GLint) p1, (GLint) p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glDrawBuffer */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glDrawBuffer(JNIEnv * env, jclass clazz, jint p0) @@ -888,7 +922,7 @@ /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glInterleavedArrays + * Method: nglInterleavedArrays */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglInterleavedArrays(JNIEnv * env, jclass clazz, jint p0, jint p1, jobject buffer, jint offset) { @@ -899,6 +933,16 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglInterleavedArraysVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglInterleavedArraysVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint buffer_offset) +{ + glInterleavedArrays((GLint) p0, (GLint) p1, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glInitNames */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glInitNames(JNIEnv * env, jclass clazz) @@ -1452,7 +1496,7 @@ /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glNormalPointer + * Method: nglNormalPointer */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglNormalPointer(JNIEnv * env, jclass clazz, jint p0, jint p1, jobject buffer, jint offset) { @@ -1463,6 +1507,16 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglNormalPointerVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglNormalPointerVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint buffer_offset) +{ + glNormalPointer((GLint) p0, (GLint) p1, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glNormal3b */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glNormal3b(JNIEnv * env, jclass clazz, jbyte p0, jbyte p1, jbyte p2) @@ -1735,9 +1789,9 @@ /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glPushClientAttrib + * Method: nglPushClientAttrib */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPushClientAttrib(JNIEnv * env, jclass clazz, jint p0) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglPushClientAttrib(JNIEnv * env, jclass clazz, jint p0) { glPushClientAttrib((GLint) p0); CHECK_GL_ERROR @@ -1745,9 +1799,9 @@ /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glPopClientAttrib + * Method: nglPopClientAttrib */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPopClientAttrib(JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglPopClientAttrib(JNIEnv * env, jclass clazz) { glPopClientAttrib(); CHECK_GL_ERROR @@ -1785,7 +1839,7 @@ /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glVertexPointer + * Method: nglVertexPointer */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglVertexPointer(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jobject buffer, jint offset) { @@ -1794,6 +1848,15 @@ CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglVertexPointerVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglVertexPointerVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint buffer_offset) +{ + glVertexPointer((GLint) p0, (GLint) p1, (GLint) p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} /* * Class: org_lwjgl_opengl_CoreGL11 @@ -2017,12 +2080,22 @@ /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glTexCoordPointer + * Method: nglTexCoordPointer */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexCoordPointer(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jobject buffer, jint offset) { const void *address = (const void *)(offset + (GLbyte *)env->GetDirectBufferAddress(buffer)); glTexCoordPointer((GLint) p0, (GLint) p1, (GLint) p2, address); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglTexCoordPointerVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexCoordPointerVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint buffer_offset) +{ + glTexCoordPointer((GLint) p0, (GLint) p1, (GLint) p2, offsetToPointer(buffer_offset)); CHECK_GL_ERROR } Index: org_lwjgl_opengl_CoreGL11.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL11.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL11.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_opengl_CoreGL11.h 2 Aug 2003 16:18:04 -0000 1.7 +++ org_lwjgl_opengl_CoreGL11.h 4 Aug 2003 23:00:49 -0000 1.8 @@ -7,6 +7,8 @@ #ifdef __cplusplus extern "C" { #endif +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL11 */ /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glAccum @@ -193,6 +195,14 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglColorPointerVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglColorPointerVBO + (JNIEnv *, jclass, jint, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glColorMaterial * Signature: (II)V */ @@ -369,6 +379,14 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglEdgeFlagPointerVBO + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglEdgeFlagPointerVBO + (JNIEnv *, jclass, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glEdgeFlag * Signature: (Z)V */ @@ -393,6 +411,14 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglDrawElementsVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglDrawElementsVBO + (JNIEnv *, jclass, jint, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glDrawBuffer * Signature: (I)V */ @@ -665,6 +691,14 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglInterleavedArraysVBO + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglInterleavedArraysVBO + (JNIEnv *, jclass, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glInitNames * Signature: ()V */ @@ -1089,6 +1123,14 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglNormalPointerVBO + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglNormalPointerVBO + (JNIEnv *, jclass, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glNormal3b * Signature: (BBB)V */ @@ -1297,18 +1339,18 @@ /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glPushClientAttrib + * Method: nglPushClientAttrib * Signature: (I)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPushClientAttrib +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglPushClientAttrib (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glPopClientAttrib + * Method: nglPopClientAttrib * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPopClientAttrib +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglPopClientAttrib (JNIEnv *, jclass); /* @@ -1345,6 +1387,14 @@ /* * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglVertexPointerVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglVertexPointerVBO + (JNIEnv *, jclass, jint, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL11 * Method: glVertex2f * Signature: (FF)V */ @@ -1518,6 +1568,14 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexCoordPointer (JNIEnv *, jclass, jint, jint, jint, jobject, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglTexCoordPointerVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexCoordPointerVBO + (JNIEnv *, jclass, jint, jint, jint, jint); /* * Class: org_lwjgl_opengl_CoreGL11 Index: org_lwjgl_opengl_CoreGL12.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL12.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL12.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_opengl_CoreGL12.cpp 2 Aug 2003 10:55:32 -0000 1.2 +++ org_lwjgl_opengl_CoreGL12.cpp 4 Aug 2003 23:00:49 -0000 1.3 @@ -47,6 +47,10 @@ #include "checkGLerror.h" #include "extgl.h" +static inline const void *offsetToPointer(jint offset) { + return (const char *)NULL + offset; +} + /* * Class: org_lwjgl_opengl_CoreGL12 * Method: glColorTable @@ -518,7 +522,7 @@ /* * Class: org_lwjgl_opengl_CoreGL12 - * Method: glDrawRangeElements + * Method: nglDrawRangeElements * Signature: (IIIIII)V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglDrawRangeElements @@ -527,6 +531,19 @@ CHECK_EXISTS(glDrawRangeElements) const void *address = (const void *)(offset + (const GLbyte *)env->GetDirectBufferAddress(buffer)); glDrawRangeElements(mode, start, end, count, type, address); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL12 + * Method: nglDrawRangeElementsVBO + * Signature: (IIIIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglDrawRangeElementsVBO + (JNIEnv *env, jclass clazz, jint mode, jint start, jint end, jint count, jint type, jint buffer_offset) +{ + CHECK_EXISTS(glDrawRangeElements) + glDrawRangeElements(mode, start, end, count, type, offsetToPointer(buffer_offset)); CHECK_GL_ERROR } Index: org_lwjgl_opengl_CoreGL12.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL12.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL12.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- org_lwjgl_opengl_CoreGL12.h 2 Aug 2003 10:55:32 -0000 1.4 +++ org_lwjgl_opengl_CoreGL12.h 4 Aug 2003 23:00:49 -0000 1.5 @@ -7,6 +7,10 @@ #ifdef __cplusplus extern "C" { #endif +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL11 */ +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL12 */ /* * Class: org_lwjgl_opengl_CoreGL12 * Method: nglColorTable @@ -286,6 +290,14 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglDrawRangeElements (JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL12 + * Method: nglDrawRangeElementsVBO + * Signature: (IIIIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglDrawRangeElementsVBO + (JNIEnv *, jclass, jint, jint, jint, jint, jint, jint); /* * Class: org_lwjgl_opengl_CoreGL12 Index: org_lwjgl_opengl_CoreGL14.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL14.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL14.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_opengl_CoreGL14.cpp 2 Aug 2003 10:55:32 -0000 1.2 +++ org_lwjgl_opengl_CoreGL14.cpp 4 Aug 2003 23:00:49 -0000 1.3 @@ -47,6 +47,10 @@ #include "checkGLerror.h" #include "extgl.h" +static inline const void *offsetToPointer(jint offset) { + return (const char *)NULL + offset; +} + /* * Class: org_lwjgl_opengl_CoreGL14 * Method: glFogCoordf @@ -61,7 +65,7 @@ /* * Class: org_lwjgl_opengl_CoreGL14 - * Method: glFogCoordPointer + * Method: nglFogCoordPointer * Signature: (IILjava/nio/Buffer;)V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglFogCoordPointer @@ -74,6 +78,18 @@ /* * Class: org_lwjgl_opengl_CoreGL14 + * Method: nglFogCoordPointerVBO + * Signature: (IILjava/nio/Buffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglFogCoordPointerVBO + (JNIEnv *env, jclass clazz, jint p1, jint p2, jint buffer_offset) { + CHECK_EXISTS(glFogCoordPointer) + glFogCoordPointer(p1, p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL14 * Method: glMultiDrawArrays * Signature: (IIII)V */ @@ -163,14 +179,26 @@ /* * Class: org_lwjgl_opengl_CoreGL14 - * Method: glSecondaryColorPointer + * Method: nglSecondaryColorPointer * Signature: (IIILjava/nio/Buffer;)V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglSecondaryColorPointer (JNIEnv *env, jclass clazz, jint p1, jint p2, jint p3, jobject buffer, jint offset) { CHECK_EXISTS(glSecondaryColorPointer) - GLvoid *address = (GLvoid *)(offset + (GLbyte *)env->GetDirectBufferAddress(buffer)); + const GLvoid *address = (const GLvoid *)(offset + (GLbyte *)env->GetDirectBufferAddress(buffer)); glSecondaryColorPointer(p1, p2, p3, address); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_CoreGL14 + * Method: nglSecondaryColorPointerVBO + * Signature: (IIILjava/nio/Buffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglSecondaryColorPointerVBO + (JNIEnv *env, jclass clazz, jint p1, jint p2, jint p3, jint buffer_offset) { + CHECK_EXISTS(glSecondaryColorPointer) + glSecondaryColorPointer(p1, p2, p3, offsetToPointer(buffer_offset)); CHECK_GL_ERROR } Index: org_lwjgl_opengl_CoreGL14.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL14.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_CoreGL14.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_opengl_CoreGL14.h 2 Aug 2003 15:21:55 -0000 1.7 +++ org_lwjgl_opengl_CoreGL14.h 4 Aug 2003 23:00:49 -0000 1.8 @@ -8,6 +8,10 @@ extern "C" { #endif /* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL11 */ +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL12 */ +/* Inaccessible static: _00024assertionsDisabled */ /* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL14 */ /* * Class: org_lwjgl_opengl_CoreGL14 @@ -27,6 +31,14 @@ /* * Class: org_lwjgl_opengl_CoreGL14 + * Method: nglFogCoordPointerVBO + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglFogCoordPointerVBO + (JNIEnv *, jclass, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL14 * Method: nglMultiDrawArrays * Signature: (ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;II)V */ @@ -80,6 +92,14 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglSecondaryColorPointer (JNIEnv *, jclass, jint, jint, jint, jobject, jint); + +/* + * Class: org_lwjgl_opengl_CoreGL14 + * Method: nglSecondaryColorPointerVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglSecondaryColorPointerVBO + (JNIEnv *, jclass, jint, jint, jint, jint); /* * Class: org_lwjgl_opengl_CoreGL14 Index: org_lwjgl_opengl_GL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_GL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_GL.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- org_lwjgl_opengl_GL.cpp 4 Aug 2003 10:09:39 -0000 1.16 +++ org_lwjgl_opengl_GL.cpp 4 Aug 2003 23:00:49 -0000 1.17 @@ -65,6 +65,10 @@ return env->NewDirectByteBuffer(p, size); } +static inline const void *offsetToPointer(jint offset) { + return (const char *)NULL + offset; +} + /* * Class: org_lwjgl_opengl_GL * Method: glActiveStencilFaceEXT @@ -2713,6 +2717,17 @@ /* * Class: org_lwjgl_opengl_GL + * Method: nglVertexAttribPointerARBVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglVertexAttribPointerARBVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jboolean p3, jint p4, jint buffer_offset) +{ + CHECK_EXISTS(glVertexAttribPointerARB) + glVertexAttribPointerARB((GLuint) p0, (GLint) p1, (GLuint) p2, (GLboolean) p3, (GLint) p4, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_GL * Method: nglVertexAttribPointerNV */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglVertexAttribPointerNV(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint p3, jobject buffer, jint buffer_offset) @@ -3023,6 +3038,17 @@ /* * Class: org_lwjgl_opengl_GL + * Method: nglWeightPointerARBVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglWeightPointerARBVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint buffer_offset) +{ + CHECK_EXISTS(glWeightPointerARB) + glWeightPointerARB((GLint) p0, (GLuint) p1, (GLint) p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + +/* + * Class: org_lwjgl_opengl_GL * Method: nglWeightsvARB */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglWeightsvARB(JNIEnv * env, jclass clazz, jint p0, jobject buffer, jint buffer_offset) @@ -3544,10 +3570,10 @@ /* * Class: org_lwjgl_opengl_GL - * Method: glBindBufferARB + * Method: nglBindBufferARB * Signature: (II)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_glBindBufferARB(JNIEnv *env, jclass clazz, jint target, jint buffer) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglBindBufferARB(JNIEnv *env, jclass clazz, jint target, jint buffer) { CHECK_EXISTS(glBindBufferARB) glBindBufferARB((GLenum) target, (GLuint) buffer); Index: org_lwjgl_opengl_GL.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_GL.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_GL.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- org_lwjgl_opengl_GL.h 3 Aug 2003 22:10:03 -0000 1.12 +++ org_lwjgl_opengl_GL.h 4 Aug 2003 23:00:49 -0000 1.13 @@ -8,9 +8,13 @@ extern "C" { #endif /* Inaccessible static: _00024assertionsDisabled */ -/* Inaccessible static: class_000240 */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL11 */ /* Inaccessible static: _00024assertionsDisabled */ -/* Inaccessible static: class_000240 */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL12 */ +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL14 */ +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024GL */ /* * Class: org_lwjgl_opengl_GL * Method: glActiveStencilFaceEXT @@ -1861,6 +1865,14 @@ /* * Class: org_lwjgl_opengl_GL + * Method: nglVertexAttribPointerARBVBO + * Signature: (IIIZII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglVertexAttribPointerARBVBO + (JNIEnv *, jclass, jint, jint, jint, jboolean, jint, jint); + +/* + * Class: org_lwjgl_opengl_GL * Method: nglVertexAttribPointerNV * Signature: (IIIILjava/nio/Buffer;I)V */ @@ -2085,6 +2097,14 @@ /* * Class: org_lwjgl_opengl_GL + * Method: nglWeightPointerARBVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglWeightPointerARBVBO + (JNIEnv *, jclass, jint, jint, jint, jint); + +/* + * Class: org_lwjgl_opengl_GL * Method: nglWeightsvARB * Signature: (ILjava/nio/ShortBuffer;I)V */ @@ -2261,10 +2281,10 @@ /* * Class: org_lwjgl_opengl_GL - * Method: glBindBufferARB + * Method: nglBindBufferARB * Signature: (II)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_glBindBufferARB +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglBindBufferARB (JNIEnv *, jclass, jint, jint); /* |
|
From: Elias N. <eli...@us...> - 2003-08-04 23:00:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv8437/src/native/win32 Modified Files: org_lwjgl_Sys.cpp Log Message: Implemented safe VBO indices (phew) Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Sys.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- org_lwjgl_Sys.cpp 3 Aug 2003 16:19:09 -0000 1.13 +++ org_lwjgl_Sys.cpp 4 Aug 2003 23:00:49 -0000 1.14 @@ -51,18 +51,6 @@ /* * Class: org_lwjgl_Sys - * Method: createIndexBuffer - * Signature: (I)Ljava/nio/ByteBuffer; - */ -JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_createIndexBuffer - (JNIEnv *env, jclass clazz, jint index) -{ - void *p = (char *)NULL + index; - return env->NewDirectByteBuffer(p, 0); -} - -/* - * Class: org_lwjgl_Sys * Method: getTimerResolution * Signature: ()J */ |
|
From: Elias N. <eli...@us...> - 2003-08-04 23:00:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv8437/src/native/linux Modified Files: org_lwjgl_Sys.cpp Log Message: Implemented safe VBO indices (phew) Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Sys.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- org_lwjgl_Sys.cpp 3 Aug 2003 16:19:09 -0000 1.13 +++ org_lwjgl_Sys.cpp 4 Aug 2003 23:00:49 -0000 1.14 @@ -49,17 +49,6 @@ long int hires_timer; // Hires timer current time /* - * Class: org_lwjgl_Sys - * Method: createIndexBuffer - * Signature: (I)Ljava/nio/ByteBuffer; - */ -JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_createIndexBuffer - (JNIEnv *env, jclass clazz, jint index) -{ - void *p = (char *)NULL + index; - return env->NewDirectByteBuffer(p, 0); -} - /* * Class: org_lwjgl_Sys * Method: getTimerResolution |
|
From: Elias N. <eli...@us...> - 2003-08-04 23:00:50
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv8437/src/java/org/lwjgl/test/opengl Modified Files: VBOTest.java Added Files: VBOIndexTest.java Log Message: Implemented safe VBO indices (phew) --- NEW FILE: VBOIndexTest.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java /* * Copyright (c) 2002 Lightweight Java Game Library 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 'Light Weight Java Game Library' 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: VBOIndexTest.java,v 1.1 2003/08/04 23:00:48 elias_naur Exp $ * * Simple java test program. * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ package org.lwjgl.test.opengl; import org.lwjgl.*; import org.lwjgl.opengl.*; import org.lwjgl.input.*; import java.nio.*; public final class VBOIndexTest { static { try { //find first display mode that allows us 640*480*16 int mode = -1; DisplayMode[] modes = Display.getAvailableDisplayModes(); for (int i = 0; i < modes.length; i++) { if (modes[i].width == 640 && modes[i].height == 480 && modes[i].bpp >= 16) { mode = i; break; } } if (mode != -1) { //select above found displaymode System.out.println("Setting display mode to "+modes[mode]); Display.setDisplayMode(modes[mode]); System.out.println("Created display."); } } catch (Exception e) { System.err.println("Failed to create display due to " + e); } } static { try { Window.create("LWJGL Game Example", 16, 0, 0,0); System.out.println("Created OpenGL."); } catch (Exception e) { System.err.println("Failed to create OpenGL due to "+e); System.exit(1); } } /** Is the game finished? */ private static boolean finished; /** A rotating square! */ private static float angle; private static int buffer_id; private static int indices_buffer_id; private static FloatBuffer vertices; private static ByteBuffer mapped_buffer = null; private static FloatBuffer mapped_float_buffer = null; private static IntBuffer indices; private static ByteBuffer mapped_indices_buffer = null; private static IntBuffer mapped_indices_int_buffer = null; public static void main(String[] arguments) { try { init(); while (!finished) { Window.tick(); if (Window.isMinimized()) Thread.sleep(200); else if (Window.isCloseRequested()) System.exit(0); Keyboard.poll(); mainLoop(); render(); Window.paint(); } } catch (Throwable t) { t.printStackTrace(); } finally { cleanup(); } } /** * All calculations are done in here */ private static void mainLoop() { angle += 1f; if (angle > 360.0f) angle = 0.0f; Mouse.poll(); if (Mouse.dx != 0 || Mouse.dy != 0 || Mouse.dwheel != 0) System.out.println("Mouse moved " + Mouse.dx + " " + Mouse.dy + " " + Mouse.dwheel); for (int i = 0; i < Mouse.buttonCount; i++) if (Mouse.isButtonDown(i)) System.out.println("Button " + i + " down"); /* Keyboard.poll(); if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) finished = true;*/ Keyboard.read(); for (int i = 0; i < Keyboard.getNumKeyboardEvents(); i++) { Keyboard.next(); if (Keyboard.key == Keyboard.KEY_ESCAPE && Keyboard.state) finished = true; if (Keyboard.key == Keyboard.KEY_T && Keyboard.state) System.out.println("Current time: " + Sys.getTime()); } } /** * All rendering is done in here */ private static void render() { GL.glClear(GL.GL_COLOR_BUFFER_BIT); GL.glPushMatrix(); GL.glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f); GL.glRotatef(angle, 0, 0, 1.0f); ByteBuffer new_mapped_buffer = GL.glMapBufferARB(GL.GL_ARRAY_BUFFER_ARB, GL.GL_WRITE_ONLY_ARB, 2*4*4, mapped_buffer); if (new_mapped_buffer != mapped_buffer) mapped_float_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer(); mapped_buffer = new_mapped_buffer; new_mapped_buffer = GL.glMapBufferARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, GL.GL_WRITE_ONLY_ARB, 4*4, mapped_indices_buffer); if (new_mapped_buffer != mapped_indices_buffer) mapped_indices_int_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer(); mapped_float_buffer.rewind(); vertices.rewind(); mapped_float_buffer.put(vertices); mapped_indices_int_buffer.rewind(); indices.rewind(); mapped_indices_int_buffer.put(indices); if (GL.glUnmapBufferARB(GL.GL_ARRAY_BUFFER_ARB) && GL.glUnmapBufferARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB)) { GL.glDrawElements(GL.GL_QUADS, 4, GL.GL_UNSIGNED_INT, 0); } GL.glPopMatrix(); } /** * Initialize */ private static void init() throws Exception { Keyboard.create(); Keyboard.enableBuffer(); Mouse.create(); Sys.setTime(0); Sys.setProcessPriority(Sys.HIGH_PRIORITY); System.out.println("Timer resolution: " + Sys.getTimerResolution()); // Go into orthographic projection mode. GLCaps.determineAvailableExtensions(); GL.glMatrixMode(GL.GL_PROJECTION); GL.glLoadIdentity(); GLU.gluOrtho2D(0, Display.getWidth(), 0, Display.getHeight()); GL.glMatrixMode(GL.GL_MODELVIEW); GL.glLoadIdentity(); GL.glViewport(0, 0, Display.getWidth(), Display.getHeight()); if (!GLCaps.GL_ARB_vertex_buffer_object) { System.out.println("ARB VBO not supported!"); System.exit(1); } IntBuffer int_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer(); GL.glGenBuffersARB(int_buffer); buffer_id = int_buffer.get(0); indices_buffer_id = int_buffer.get(1); GL.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, buffer_id); GL.glBindBufferARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, indices_buffer_id); vertices = ByteBuffer.allocateDirect(2*4*4).order(ByteOrder.nativeOrder()).asFloatBuffer(); vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50); vertices.rewind(); indices = ByteBuffer.allocateDirect(4*4).order(ByteOrder.nativeOrder()).asIntBuffer(); indices.put(0).put(1).put(2).put(3); indices.rewind(); GL.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, 2*4*4, (ByteBuffer)null, GL.GL_STREAM_DRAW_ARB); GL.glBufferDataARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, 4*4, (ByteBuffer)null, GL.GL_STREAM_DRAW_ARB); GL.glEnableClientState(GL.GL_VERTEX_ARRAY); GL.glVertexPointer(2, GL.GL_FLOAT, 0, 0); GL.glGetInteger(GL.GL_MAX_TEXTURE_UNITS_ARB, int_buffer); System.out.println("Number of texture units: " + int_buffer.get(0)); // Fix the refresh rate to the display frequency. // gl.wglSwapIntervalEXT(1); } /** * Cleanup */ private static void cleanup() { IntBuffer int_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer(); int_buffer.put(0, buffer_id); int_buffer.put(1, indices_buffer_id); GL.glDeleteBuffersARB(int_buffer); Keyboard.destroy(); Mouse.destroy(); Window.destroy(); try { Display.resetDisplayMode(); } catch (Exception e) { e.printStackTrace(); } } } Index: VBOTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- VBOTest.java 4 Aug 2003 10:09:39 -0000 1.6 +++ VBOTest.java 4 Aug 2003 23:00:48 -0000 1.7 @@ -191,9 +191,8 @@ vertices = ByteBuffer.allocateDirect(2*4*4).order(ByteOrder.nativeOrder()).asFloatBuffer(); vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50); GL.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, 2*4*4, (ByteBuffer)null, GL.GL_STREAM_DRAW_ARB); - ByteBuffer index_buffer = Sys.createIndexBuffer(0); GL.glEnableClientState(GL.GL_VERTEX_ARRAY); - GL.glVertexPointer(2, 0, index_buffer.asFloatBuffer()); + GL.glVertexPointer(2, GL.GL_FLOAT, 0, 0); GL.glGetInteger(GL.GL_MAX_TEXTURE_UNITS_ARB, int_buffer); System.out.println("Number of texture units: " + int_buffer.get(0)); // Fix the refresh rate to the display frequency. |
|
From: Elias N. <eli...@us...> - 2003-08-04 23:00:50
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv8437/src/java/org/lwjgl/opengl Modified Files: CoreGL11.java CoreGL12.java CoreGL14.java GL.java Pbuffer.java Util.java Window.java Added Files: StateStack.java VBOTracker.java Log Message: Implemented safe VBO indices (phew) --- NEW FILE: StateStack.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/StateStack.java /* * Copyright (c) 2002 Lightweight Java Game Library 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 'Light Weight Java Game Library' 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; public class StateStack { /** Only int state is tracked */ private final int[] state_stack; private int stack_pos; public int getState() { return state_stack[stack_pos]; } public void setState(int new_state) { state_stack[stack_pos] = new_state; } public void pushState() { stack_pos++; state_stack[stack_pos] = state_stack[stack_pos - 1]; } public int popState() { int result = state_stack[stack_pos]; stack_pos--; return result; } public StateStack(int stack_size, int initial_value) { state_stack = new int[stack_size]; stack_pos = 0; state_stack[stack_pos] = initial_value; } } --- NEW FILE: VBOTracker.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/VBOTracker.java /* * Copyright (c) 2002 Lightweight Java Game Library 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 'Light Weight Java Game Library' 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; public class VBOTracker { private static VBOTracker default_tracker = new VBOTracker(); private static VBOTracker current_tracker = default_tracker; private final StateStack vbo_array_stack; private final StateStack vbo_element_stack; private final StateStack attrib_stack; public static void setCurrent(VBOTracker tracker) { current_tracker = tracker; } public static void releaseCurrent() { current_tracker = default_tracker; } public VBOTracker() { int stack_size = Util.getGLInteger(CoreGL11Constants.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH); vbo_array_stack = new StateStack(stack_size, 0); vbo_element_stack = new StateStack(stack_size, 0); attrib_stack = new StateStack(stack_size, 0); } public static StateStack getVBOArrayStack() { return current_tracker.vbo_array_stack; } public static StateStack getVBOElementStack() { return current_tracker.vbo_element_stack; } public static StateStack getClientAttribStack() { return current_tracker.attrib_stack; } } Index: CoreGL11.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/CoreGL11.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/CoreGL11.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- CoreGL11.java 2 Aug 2003 17:11:33 -0000 1.12 +++ CoreGL11.java 4 Aug 2003 23:00:47 -0000 1.13 @@ -87,12 +87,19 @@ public static native void glCopyTexImage1D(int target, int level, int internalFormat, int x, int y, int width, int border); public static native void glCopyPixels(int x, int y, int width, int height, int type); public static void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglColorPointer(size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, stride, pointer, pointer.position()); } public static void glColorPointer(int size, int stride, FloatBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglColorPointer(size, GL_FLOAT, stride, pointer, pointer.position() << 2); } private static native void nglColorPointer(int size, int type, int stride, Buffer pointer, int pointer_offset); + public static void glColorPointer(int size, int type, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglColorPointerVBO(size, type, stride, buffer_offset); + } + private static native void nglColorPointerVBO(int size, int type, int stride, int buffer_offset); public static native void glColorMaterial(int face, int mode); public static native void glColorMask(boolean red, boolean green, boolean blue, boolean alpha); public static native void glColor3b(byte red, byte green, byte blue); @@ -118,9 +125,15 @@ public static native void glEnable(int cap); public static native void glDisable(int cap); public static void glEdgeFlagPointer(int stride, ByteBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglEdgeFlagPointer(stride, pointer, pointer.position()); } private static native void nglEdgeFlagPointer(int stride, Buffer pointer, int pointer_offset); + public static void glEdgeFlagPointer(int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglEdgeFlagPointerVBO(stride, buffer_offset); + } + private static native void nglEdgeFlagPointerVBO(int stride, int buffer_offset); public static native void glEdgeFlag(boolean flag); public static void glDrawPixels(int width, int height, int format, int type, ByteBuffer pixels) { nglDrawPixels(width, height, format, type, pixels, pixels.position()); @@ -133,15 +146,23 @@ } private static native void nglDrawPixels(int width, int height, int format, int type, Buffer pixels, int pixels_offset); public static void glDrawElements(int mode, ByteBuffer indices) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_BYTE, indices, indices.position()); } public static void glDrawElements(int mode, ShortBuffer indices) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_SHORT, indices, indices.position() << 1); } public static void glDrawElements(int mode, IntBuffer indices) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_INT, indices, indices.position() << 2); } private static native void nglDrawElements(int mode, int count, int type, Buffer indices, int indices_offset); + public static void glDrawElements(int mode, int count, int type, int buffer_offset) { + assert VBOTracker.getVBOElementStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglDrawElementsVBO(mode, count, type, buffer_offset); + } + private static native void nglDrawElementsVBO(int mode, int count, int type, int buffer_offset); public static native void glDrawBuffer(int mode); public static native void glDrawArrays(int mode, int first, int count); public static native void glDepthRange(double zNear, double zFar); @@ -237,18 +258,27 @@ public static native ByteBuffer glGetPointerv(int pname, int size); public static native boolean glIsEnabled(int cap); public static void glInterleavedArrays(int format, int stride, ByteBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglInterleavedArrays(format, stride, pointer, pointer.position()); } public static void glInterleavedArrays(int format, int stride, ShortBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglInterleavedArrays(format, stride, pointer, pointer.position() << 1); } public static void glInterleavedArrays(int format, int stride, IntBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglInterleavedArrays(format, stride, pointer, pointer.position() << 2); } public static void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglInterleavedArrays(format, stride, pointer, pointer.position() << 2); } private static native void nglInterleavedArrays(int format, int stride, Buffer pointer, int pointer_offset); + public static void glInterleavedArrays(int format, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglInterleavedArraysVBO(format, stride, buffer_offset); + } + private static native void nglInterleavedArraysVBO(int format, int stride, int buffer_offset); public static native void glInitNames(); public static native void glHint(int target, int mode); public static void glGetTexParameter(int target, int pname, FloatBuffer params) { @@ -377,15 +407,23 @@ public static native void glPassThrough(float token); public static native void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar); public static void glNormalPointer(int stride, ByteBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglNormalPointer(GL_BYTE, stride, pointer, pointer.position()); } public static void glNormalPointer(int stride, IntBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglNormalPointer(GL_INT, stride, pointer, pointer.position() << 2); } public static void glNormalPointer(int stride, FloatBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglNormalPointer(GL_FLOAT, stride, pointer, pointer.position() << 2); } private static native void nglNormalPointer(int type, int stride, Buffer pointer, int pointer_offset); + public static void glNormalPointer(int type, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglNormalPointerVBO(type, stride, buffer_offset); + } + private static native void nglNormalPointerVBO(int type, int stride, int buffer_offset); public static native void glNormal3b(byte nx, byte ny, byte nz); public static native void glNormal3f(float nx, float ny, float nz); public static native void glNormal3i(int nx, int ny, int nz); @@ -427,18 +465,41 @@ public static native void glPopName(); public static native void glPushMatrix(); public static native void glPopMatrix(); - public static native void glPushClientAttrib(int mask); - public static native void glPopClientAttrib(); + public static void glPushClientAttrib(int mask) { + VBOTracker.getClientAttribStack().pushState(); + VBOTracker.getClientAttribStack().setState(mask); + if ((mask & GL_CLIENT_VERTEX_ARRAY_BIT) != 0) { + VBOTracker.getVBOArrayStack().pushState(); + VBOTracker.getVBOElementStack().pushState(); + } + nglPushClientAttrib(mask); + } + private static native void nglPushClientAttrib(int mask); + public static void glPopClientAttrib() { + if ((VBOTracker.getClientAttribStack().popState() & GL_CLIENT_VERTEX_ARRAY_BIT) != 0) { + VBOTracker.getVBOArrayStack().popState(); + VBOTracker.getVBOElementStack().popState(); + } + nglPopClientAttrib(); + } + private static native void nglPopClientAttrib(); public static native void glPushAttrib(int mask); public static native void glPopAttrib(); public static native void glStencilFunc(int func, int ref, int mask); public static void glVertexPointer(int size, int stride, FloatBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexPointer(size, GL_FLOAT, stride, pointer, pointer.position() << 2); } public static void glVertexPointer(int size, int stride, IntBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexPointer(size, GL_INT, stride, pointer, pointer.position() << 2); } private static native void nglVertexPointer(int size, int type, int stride, Buffer pointer, int pointer_offset); + public static void glVertexPointer(int size, int type, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglVertexPointerVBO(size, type, stride, buffer_offset); + } + private static native void nglVertexPointerVBO(int size, int type, int stride, int buffer_offset); public static native void glVertex2f(float x, float y); public static native void glVertex2i(int x, int y); public static native void glVertex3f(float x, float y, float z); @@ -509,9 +570,15 @@ } private static native void nglTexEnviv(int target, int pname, IntBuffer params, int params_offset); public static void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglTexCoordPointer(size, GL_FLOAT, stride, pointer, pointer.position() << 2); } private static native void nglTexCoordPointer(int size, int type, int stride, Buffer pointer, int pointer_offset); + public static void glTexCoordPointer(int size, int type, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglTexCoordPointerVBO(size, type, stride, buffer_offset); + } + private static native void nglTexCoordPointerVBO(int size, int type, int stride, int buffer_offset); public static native void glTexCoord1f(float s); public static native void glTexCoord2f(float s, float t); public static native void glTexCoord3f(float s, float t, float r); Index: CoreGL12.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/CoreGL12.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/CoreGL12.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- CoreGL12.java 2 Aug 2003 17:09:56 -0000 1.9 +++ CoreGL12.java 4 Aug 2003 23:00:47 -0000 1.10 @@ -191,15 +191,23 @@ } private static native void nglGetSeparableFilter(int target, int format, int type, Buffer row, int row_offset, Buffer column, int column_offset, Buffer span, int span_offset); public static void glDrawRangeElements(int mode, int start, int end, ByteBuffer indices) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglDrawRangeElements(mode, start, end, indices.remaining(), GL_UNSIGNED_BYTE, indices, indices.position()); } public static void glDrawRangeElements(int mode, int start, int end, ShortBuffer indices) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglDrawRangeElements(mode, start, end, indices.remaining(), GL_UNSIGNED_SHORT, indices, indices.position() << 1); } public static void glDrawRangeElements(int mode, int start, int end, IntBuffer indices) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglDrawRangeElements(mode, start, end, indices.remaining(), GL_UNSIGNED_INT, indices, indices.position() << 2); } private static native void nglDrawRangeElements(int mode, int start, int end, int count, int type, Buffer indices, int indices_offset); + public static void glDrawRangeElements(int mode, int start, int end, int count, int type, int buffer_offset) { + assert VBOTracker.getVBOElementStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglDrawRangeElementsVBO(mode, start, end, count, type, buffer_offset); + } + private static native void nglDrawRangeElementsVBO(int mode, int start, int end, int count, int type, int buffer_offset); public static void glTexImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, ByteBuffer pixels) { nglTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels, pixels.position()); } Index: CoreGL14.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/CoreGL14.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/CoreGL14.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- CoreGL14.java 2 Aug 2003 17:09:56 -0000 1.11 +++ CoreGL14.java 4 Aug 2003 23:00:47 -0000 1.12 @@ -46,11 +46,17 @@ * @version $Revision$ */ public abstract class CoreGL14 extends CoreGL13 implements CoreGL14Constants { - public static native void glFogCoordf (float coord); - public static void glFogCoordPointer (int stride, FloatBuffer data) { + public static native void glFogCoordf(float coord); + public static void glFogCoordPointer(int stride, FloatBuffer data) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglFogCoordPointer(GL_FLOAT, stride, data, data.position() << 2); } - private static native void nglFogCoordPointer (int type, int stride, Buffer data, int data_offset); + private static native void nglFogCoordPointer(int type, int stride, Buffer data, int data_offset); + public static void glFogCoordPointer(int type, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglFogCoordPointerVBO(type, stride, buffer_offset); + } + private static native void nglFogCoordPointerVBO(int type, int stride, int buffer_offset); public static void glMultiDrawArrays(int mode, IntBuffer piFirst, IntBuffer piCount) { assert piFirst.remaining() == piCount.remaining(): "piFirst.remaining() != piCount.remaining()"; nglMultiDrawArrays(mode, piFirst, piFirst.position(), piCount, piCount.position(), piFirst.remaining()); @@ -65,13 +71,20 @@ public static native void glSecondaryColor3b (byte red, byte green, byte blue); public static native void glSecondaryColor3f (float red, float green, float blue); public static native void glSecondaryColor3ub (byte red, byte green, byte blue); - public static void glSecondaryColorPointer (int size, boolean unsigned, int stride, ByteBuffer data) { + public static void glSecondaryColorPointer(int size, boolean unsigned, int stride, ByteBuffer data) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglSecondaryColorPointer(size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, stride, data, data.position()); } - public static void glSecondaryColorPointer (int size, int stride, FloatBuffer data) { + public static void glSecondaryColorPointer(int size, int stride, FloatBuffer data) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglSecondaryColorPointer(size, GL_FLOAT, stride, data, data.position() << 2); } private static native void nglSecondaryColorPointer (int size, int type, int stride, Buffer data, int data_offset); + public static void glSecondaryColorPointer(int size, int type, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglSecondaryColorPointerVBO(size, type, stride, buffer_offset); + } + private static native void nglSecondaryColorPointerVBO(int size, int type, int stride, int buffer_offset); public static native void glBlendFuncSeparate (int sfactorRGB, int dfactorRGB, int sfactorAlpha, int dfactorAlpha); public static native void glWindowPos2f (float x, float y); public static native void glWindowPos2i (int x, int y); Index: GL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- GL.java 3 Aug 2003 22:04:45 -0000 1.37 +++ GL.java 4 Aug 2003 23:00:47 -0000 1.38 @@ -1149,19 +1149,27 @@ private static native void nglVertexAttrib4usvARB(int index, ShortBuffer psV, int psV_offset); public static void glVertexAttribPointerARB(int index, int size, boolean unsigned, boolean normalized, int stride, ByteBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexAttribPointerARB(index, size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, normalized, stride, pPointer, pPointer.position()); } public static void glVertexAttribPointerARB(int index, int size, boolean unsigned, boolean normalized, int stride, ShortBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexAttribPointerARB(index, size, unsigned ? GL_UNSIGNED_SHORT : GL_SHORT, normalized, stride, pPointer, pPointer.position()<<1); } public static void glVertexAttribPointerARB(int index, int size, boolean normalized, int stride, FloatBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexAttribPointerARB(index, size, GL_FLOAT, normalized, stride, pPointer, pPointer.position()<<2); } public static void glVertexAttribPointerARB(int index, int size, boolean unsigned, boolean normalized, int stride, IntBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexAttribPointerARB(index, size, unsigned ? GL_UNSIGNED_INT : GL_INT, normalized, stride, pPointer, pPointer.position()<<2); } private static native void nglVertexAttribPointerARB(int index, int size, int type, boolean normalized, int stride, Buffer pPointer, int pPointer_offset); - + public static void glVertexAttribPointerARB(int index, int size, int type, boolean normalized, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglVertexAttribPointerARBVBO(index, size, type, normalized, stride, buffer_offset); + } + private static native void nglVertexAttribPointerARBVBO(int index, int size, int type, boolean normalized, int stride, int buffer_offset); public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, ByteBuffer pPointer) { nglVertexAttribPointerNV(index, size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, stride, pPointer, pPointer.position()); } @@ -1283,18 +1291,27 @@ private static native void nglWeightivARB(int size, IntBuffer piWeights, int piWeights_offset); public static void glWeightPointerARB(int size, boolean unsigned, int stride, ByteBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglWeightPointerARB(size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, stride, pPointer, pPointer.position()); } public static void glWeightPointerARB(int size, boolean unsigned, int stride, ShortBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglWeightPointerARB(size, unsigned ? GL_UNSIGNED_SHORT : GL_SHORT, stride, pPointer, pPointer.position()<<1); } public static void glWeightPointerARB(int size, int stride, FloatBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglWeightPointerARB(size, GL_FLOAT, stride, pPointer, pPointer.position()<<2); } public static void glWeightPointerARB(int size, boolean unsigned, int stride, IntBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglWeightPointerARB(size, unsigned ? GL_UNSIGNED_INT : GL_INT, stride, pPointer, pPointer.position()<<2); } private static native void nglWeightPointerARB(int size, int type, int stride, Buffer pPointer, int pPointer_offset); + public static void glWeightPointerARB(int size, int type, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglWeightPointerARBVBO(size, type, stride, buffer_offset); + } + private static native void nglWeightPointerARBVBO(int size, int type, int stride, int buffer_offset); public static void glWeightARB(ShortBuffer psWeights) { nglWeightsvARB(psWeights.remaining(), psWeights, psWeights.position()); @@ -1444,8 +1461,27 @@ int outZ, int outW); - public static native void glBindBufferARB(int target, int buffer); + public static void glBindBufferARB(int target, int buffer) { + switch (target) { + case GL_ELEMENT_ARRAY_BUFFER_ARB: + VBOTracker.getVBOElementStack().setState(buffer); + break; + case GL_ARRAY_BUFFER_ARB: + VBOTracker.getVBOArrayStack().setState(buffer); + break; + default: assert false: "Unsupported VBO target " + target; + } + nglBindBufferARB(target, buffer); + } + private static native void nglBindBufferARB(int target, int buffer); public static void glDeleteBuffersARB(IntBuffer buffers) { + for (int i = buffers.position(); i < buffers.limit(); i++) { + int buffer_handle = buffers.get(i); + if (VBOTracker.getVBOElementStack().getState() == buffer_handle) + VBOTracker.getVBOElementStack().setState(0); + if (VBOTracker.getVBOArrayStack().getState() == buffer_handle) + VBOTracker.getVBOArrayStack().setState(0); + } nglDeleteBuffersARB(buffers.remaining(), buffers, buffers.position()); } private static native void nglDeleteBuffersARB(int n, IntBuffer buffers, int buffers_offset); Index: Pbuffer.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Pbuffer.java 1 Jun 2003 11:01:15 -0000 1.2 +++ Pbuffer.java 4 Aug 2003 23:00:47 -0000 1.3 @@ -50,15 +50,18 @@ public class Pbuffer { public final static int PBUFFER_SUPPORTED = 1; - static { - System.loadLibrary(Sys.getLibraryName()); - } + /** Current Pbuffer */ + private static Pbuffer currentBuffer = null; /** Handle to the native GL rendering context */ - protected final int handle; + private final int handle; - /** Current Pbuffer */ - private static Pbuffer currentBuffer = null; + /** Tracks VBO state */ + private final VBOTracker vbo_tracker; + + static { + System.loadLibrary(Sys.getLibraryName()); + } /** * Construct an instance of a Pbuffer. If this fails then an Exception will be thrown. @@ -81,6 +84,7 @@ */ public Pbuffer(int width, int height, int bpp, int alpha, int depth, int stencil) throws Exception { handle = nCreate(width, height, bpp, alpha, depth, stencil); + vbo_tracker = new VBOTracker(); } /** @@ -88,6 +92,7 @@ */ public static void releaseContext() { currentBuffer = null; + VBOTracker.releaseCurrent(); nReleaseContext(); } @@ -119,6 +124,7 @@ */ public void makeCurrent() { currentBuffer = this; + VBOTracker.setCurrent(vbo_tracker); nMakeCurrent(handle); } @@ -150,7 +156,8 @@ * Destroys the Pbuffer. The buffer must not be current. */ public void destroy() { - assert currentBuffer != this : "Pbuffers must not be current when releasing it"; + if (currentBuffer == this) + releaseContext(); nDestroy(handle); } Index: Util.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Util.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Util.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Util.java 1 Aug 2003 20:57:30 -0000 1.1 +++ Util.java 4 Aug 2003 23:00:47 -0000 1.2 @@ -40,6 +40,7 @@ * @version $Revision$ */ abstract class Util { + private final static IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); /** * A helper function which is used to get the byte offset in an arbitrary buffer * based on its position @@ -54,5 +55,10 @@ return buffer.position() << 3; else return buffer.position(); + } + + static int getGLInteger(int enum) { + CoreGL11.glGetInteger(enum, int_buffer); + return int_buffer.get(0); } } Index: Window.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Window.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Window.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Window.java 4 Aug 2003 10:09:39 -0000 1.1 +++ Window.java 4 Aug 2003 23:00:47 -0000 1.2 @@ -66,6 +66,9 @@ /** Fullscreen */ private static boolean fullscreen; + /** Tracks VBO state for the window context */ + private static VBOTracker vbo_tracker; + /** * Construct a Window. Some OSs may not support non-fullscreen windows; in * which case the window will be fullscreen regardless. @@ -232,8 +235,7 @@ Window.title = title; Window.width = Display.getWidth(); Window.height = Display.getHeight(); - nCreate(title, x, y, width, height, fullscreen, color, alpha, depth, stencil); - created = true; + createWindow(); } /** @@ -268,8 +270,7 @@ Window.stencil = stencil; Window.fullscreen = false; Window.title = title; - nCreate(title, x, y, width, height, fullscreen, color, alpha, depth, stencil); - created = true; + createWindow(); } /** @@ -288,6 +289,11 @@ int depth, int stencil) throws Exception; + + private static void createWindow() throws Exception { + nCreate(title, x, y, width, height, fullscreen, color, alpha, depth, stencil); + created = true; + } /** * Destroy the window. |
|
From: Elias N. <eli...@us...> - 2003-08-04 10:11:55
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv2494/src/native/linux Modified Files: Window.h Log Message: Index: Window.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/Window.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Window.h 4 Aug 2003 10:09:40 -0000 1.4 +++ Window.h 4 Aug 2003 10:11:53 -0000 1.5 @@ -121,7 +121,7 @@ extern int convertToBPE(int bpp); /* - * Return the context to the OpenGL window + * Make the window context current */ void makeCurrent(void); |
|
From: Elias N. <eli...@us...> - 2003-08-04 10:09:43
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv2108/src/native/win32 Added Files: org_lwjgl_opengl_Window.cpp Removed Files: org_lwjgl_Window.cpp Log Message: --- NEW FILE: org_lwjgl_opengl_Window.cpp --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Window.cpp /* * Copyright (c) 2002 Light Weight Java Game Library 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 'Light Weight Java Game Library' 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_Window.cpp,v 1.1 2003/08/04 10:09:40 elias_naur Exp $ * * Base Win32 window * * @author cix_foo <ci...@us...> * @version $Revision: 1.1 $ */ #define _PRIVATE_WINDOW_H_ #include "Window.h" #include "org_lwjgl_opengl_Window.h" bool oneShotInitialised = false; // Registers the LWJGL window class HWND hwnd = NULL; // Handle to the window HDC hdc = NULL; // Device context HGLRC hglrc = NULL; // OpenGL context LPDIRECTINPUT lpdi = NULL; // DirectInput bool isFullScreen = false; // Whether we're fullscreen or not bool isMinimized = false; // Whether we're minimized or not /*JNIEnv * environment = NULL; // Cached environment jclass window; // Cached Java Window class*/ extern HINSTANCE dll_handle; // Handle to the LWJGL dll RECT clientSize; static bool closerequested; static bool minimized; static bool focused; static bool dirty; //CAS: commented these out as no longer used //extern void tempRestoreDisplayMode(); //extern void tempResetDisplayMode(); #define WINDOWCLASSNAME "LWJGL" /* * Utility function to throw an Exception */ void throwException(JNIEnv * env, const char * err) { jclass cls = env->FindClass("java/lang/Exception"); env->ThrowNew(cls, err); env->DeleteLocalRef(cls); } /* * Utility function to throw a RuntimeException */ void throwRuntimeException(JNIEnv * env, const char * err) { jclass cls = env->FindClass("java/lang/RuntimeException"); env->ThrowNew(cls, err); env->DeleteLocalRef(cls); } /* * Find an appropriate pixel format */ static int findPixelFormat(JNIEnv *env, unsigned int flags, int bpp, int alpha, int depth, int stencil) { 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 0, // no accumulation buffer 0, 0, 0, 0, // accum bits ignored (BYTE)depth, (BYTE)stencil, 0, // No auxiliary buffer 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 int iPixelFormat = ChoosePixelFormat(hdc, &pfd); if (iPixelFormat == 0) { throwException(env, "Failed to choose pixel format"); return -1; } #ifdef _DEBUG printf("Pixel format is %d\n", iPixelFormat); #endif // make that the pixel format of the device context if (SetPixelFormat(hdc, iPixelFormat, &pfd) == FALSE) { printf("Failed to set pixel format\n"); throwException(env, "Failed to choose pixel format"); return -1; } // 3. Check the chosen format matches or exceeds our specifications PIXELFORMATDESCRIPTOR desc; if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { throwException(env, "Could not describe pixel format"); return -1; } if (desc.cColorBits < bpp) { throwException(env, "This application requires a greater colour depth"); return -1; } if (desc.cAlphaBits < alpha) { throwException(env, "This application requires a greater alpha depth"); return -1; } if (desc.cStencilBits < stencil) { throwException(env, "This application requires a greater stencil depth"); return -1; } if (desc.cDepthBits < depth) { throwException(env, "This application requires a greater depth buffer depth"); return -1; } if ((desc.dwFlags & PFD_GENERIC_FORMAT) != 0 || (desc.dwFlags & PFD_GENERIC_ACCELERATED) != 0) { throwException(env, "Mode not supported by hardware"); return -1; } if ((desc.dwFlags & flags) != flags) { throwException(env, "Capabilities not supported"); return -1; } // 4. Initialise other things now if (extgl_Open() != 0) { throwException(env, "Failed to open extgl"); return -1; } return iPixelFormat; } /* * Create DirectInput. * Returns true for success, or false for failure */ static bool createDirectInput() { // Create input HRESULT ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION ) { printf("Failed to create directinput"); switch (ret) { case DIERR_INVALIDPARAM : printf(" - Invalid parameter\n"); break; case DIERR_OLDDIRECTINPUTVERSION : printf(" - Old Version\n"); break; case DIERR_OUTOFMEMORY : printf(" - Out Of Memory\n"); break; default: printf(" - Unknown failure\n"); } return false; } else { return true; } } /* * Close the window */ static void closeWindow() { // Release DirectInput if (lpdi != NULL) { #ifdef _DEBUG printf("Destroying directinput\n"); #endif lpdi->Release(); lpdi = NULL; } // Release device context if (hdc != NULL && hwnd != NULL) { #ifdef _DEBUG printf("Releasing DC\n"); #endif ReleaseDC(hwnd, hdc); } // Close the window if (hwnd != NULL) { #ifdef _DEBUG printf("Destroy window\n"); #endif // Vape the window DestroyWindow(hwnd); #ifdef _DEBUG printf("Destroyed window\n"); #endif hwnd = NULL; } } /* * Called when the application is alt-tabbed to or from */ static void appActivate(bool active) { // if (!active) { // tempResetDisplayMode(); // } if (active) { SetForegroundWindow(hwnd); ShowWindow(hwnd, SW_RESTORE); } else if (isFullScreen) { ShowWindow(hwnd, SW_MINIMIZE); } // if (active) { // tempRestoreDisplayMode(); // } } /* * WindowProc for the GL window. */ LRESULT CALLBACK lwjglWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { // disable screen saver and monitor power down messages which wreak havoc case WM_SYSCOMMAND: { switch (wParam) { case SC_SCREENSAVE: case SC_MONITORPOWER: return 0L; case SC_MINIMIZE: minimized = true; appActivate(false); break; case SC_RESTORE: minimized = false; appActivate(true); break; case SC_CLOSE: closerequested = true; //don't continue processing this command since this //would shutdown the window, which the application might not want to return 0L; } } break; case WM_ACTIVATE: { switch(LOWORD(wParam)) { case WA_ACTIVE: case WA_CLICKACTIVE: minimized = false; isMinimized = false; break; case WA_INACTIVE: minimized = true; isMinimized = true; break; } appActivate(!isMinimized); } break; case WM_QUIT: { closerequested = true; return 0L; } case WM_PAINT: { dirty = true; } } // default action return DefWindowProc(hWnd, msg, wParam, lParam); } /* * Register the LWJGL window class. * Returns true for success, or false for failure */ static bool registerWindow() { if (!oneShotInitialised) { WNDCLASS windowClass; windowClass.style = CS_GLOBALCLASS | 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 = (HBRUSH)GetStockObject(BLACK_BRUSH); windowClass.lpszMenuName = NULL; windowClass.lpszClassName = WINDOWCLASSNAME; if (RegisterClass(&windowClass) == 0) { printf("Failed to register window class\n"); return false; } #ifdef _DEBUG printf("Window registered\n"); #endif oneShotInitialised = true; } return true; } /* * Handle native Win32 messages */ static void handleMessages(JNIEnv * env, jclass clazz) { /* * Now's our chance to deal with Windows messages that are * otherwise just piling up and causing everything not to * work properly */ MSG msg; while (PeekMessage( &msg, // message information hwnd, // handle to window 0, // first message 0, // last message PM_REMOVE // removal options )) { TranslateMessage(&msg); DispatchMessage(&msg); }; } /* * Create a window with the specified title, position, size, and * fullscreen attribute. The window will have DirectInput associated * with it. * * Returns true for success, or false for failure */ static bool createWindow(const char * title, int x, int y, int width, int height, bool fullscreen) { // 1. Register window class if necessary if (!registerWindow()) return false; // 2. Create the window int exstyle, windowflags; if (fullscreen) { exstyle = WS_EX_APPWINDOW | WS_EX_TOPMOST; windowflags = WS_POPUP | WS_VISIBLE; } else { exstyle = WS_EX_APPWINDOW; windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_VISIBLE | WS_MINIMIZEBOX | WS_SYSMENU; } // If we're not a fullscreen window, adjust the height to account for the // height of the title bar: clientSize.bottom = height; clientSize.left = 0; clientSize.right = width; clientSize.top = 0; AdjustWindowRectEx( &clientSize, // client-rectangle structure windowflags, // window styles FALSE, // menu-present option exstyle // extended window style ); // Create the window now, using that class: hwnd = CreateWindowEx ( exstyle, WINDOWCLASSNAME, title, windowflags, x, y, clientSize.right - clientSize.left, clientSize.bottom - clientSize.top, NULL, NULL, dll_handle, NULL); if (hwnd == NULL) { printf("Failed to create window\n"); return false; } #ifdef _DEBUG printf("Created window\n"); #endif // ShowWindow(hwnd, SW_SHOWNORMAL); ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); SetForegroundWindow(hwnd); SetFocus(hwnd); hdc = GetWindowDC(hwnd); // Success! Now you need to initialize a GL object, which creates a GL rendering context; // and then to issue commands to it, you need to call gl::makeCurrent(). // 3. Hide the mouse if necessary isFullScreen = fullscreen == JNI_TRUE; // 4. Create DirectInput if (!createDirectInput()) { // Close the window closeWindow(); return false; } return true; } /* * Class: org_lwjgl_Window * Method: nSetTitle * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nSetTitle (JNIEnv * env, jclass clazz, jstring title_obj) { const char * title = env->GetStringUTFChars(title_obj, NULL); SetWindowText(hwnd, title); env->ReleaseStringUTFChars(title_obj, title); } /* * Class: org_lwjgl_Window * Method: tick * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_tick (JNIEnv * env, jclass clazz) { handleMessages(env, clazz); } /* * Class: org_lwjgl_Window * Method: minimize * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_minimize (JNIEnv * env, jclass clazz) { if (isMinimized) return; ShowWindow(hwnd, SW_MINIMIZE); } /* * Class: org_lwjgl_Window * Method: minimize * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_restore (JNIEnv * env, jclass clazz) { if (!isMinimized) return; ShowWindow(hwnd, SW_RESTORE); } /* * Class: org_lwjgl_Window * Method: swapBuffers * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers (JNIEnv * env, jclass clazz) { dirty = false; wglSwapLayerBuffers(hdc, WGL_SWAP_MAIN_PLANE); } /* * Class: org_lwjgl_Window * Method: nCreate * Signature: (Ljava/lang/String;IIIIZIIII)V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate (JNIEnv * env, jclass clazz, jstring title, jint x, jint y, jint width, jint height, jboolean fullscreen, jint bpp, jint alpha, jint depth, jint stencil) { closerequested = false; minimized = false; focused = true; dirty = true; // 1. Create a window const char * titleString = env->GetStringUTFChars(title, NULL); if (!createWindow(titleString, x, y, width, height, fullscreen == JNI_TRUE ? true : false)) { env->ReleaseStringUTFChars((jstring) title, titleString); closeWindow(); throwException(env, "Failed to create the window."); return; } env->ReleaseStringUTFChars(title, titleString); // 2. Choose a pixel format and set it unsigned int flags = PFD_DRAW_TO_WINDOW | // support window PFD_SUPPORT_OPENGL | // support OpenGL PFD_DOUBLEBUFFER; // double buffered int iPixelFormat = findPixelFormat(env, flags, bpp, alpha, depth, stencil); if (iPixelFormat == -1) { closeWindow(); return; } // Create a rendering context hglrc = wglCreateContext(hdc); if (hglrc == NULL) { throwException(env, "Failed to create OpenGL rendering context"); closeWindow(); return; } // Automatically make it the current context wglMakeCurrent(hdc, hglrc); // Initialise GL extensions if (extgl_Initialize() != 0) { closeWindow(); throwException(env, "Failed to initialize GL extensions"); return; } } /* * Class: org_lwjgl_Window * Method: doDestroy * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nDestroy (JNIEnv * env, jclass clazz) { wglMakeCurrent(NULL, NULL); // Delete the rendering context if (hglrc != NULL) { #ifdef _DEBUG printf("Delete GL context\n"); #endif wglDeleteContext(hglrc); hglrc = NULL; } closeWindow(); extgl_Close(); } /* * Class: org_lwjgl_opengl_Window * Method: nIsDirty * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsDirty (JNIEnv *env, jclass clazz) { return dirty; } /* * Class: org_lwjgl_opengl_Window * Method: nIsMinimized * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsMinimized (JNIEnv *env, jclass clazz) { return minimized; } /* * Class: org_lwjgl_opengl_Window * Method: nIsCloseRequested * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsCloseRequested (JNIEnv *, jclass) { bool saved = closerequested; closerequested = false; return saved; } /* * Class: org_lwjgl_opengl_Window * Method: nIsFocused * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsFocused (JNIEnv *env, jclass clazz) { return focused; } --- org_lwjgl_Window.cpp DELETED --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp |
|
From: Elias N. <eli...@us...> - 2003-08-04 10:09:43
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv2108/src/native/common Modified Files: org_lwjgl_opengl_GL.cpp Added Files: org_lwjgl_opengl_Window.h Removed Files: org_lwjgl_Window.h Log Message: --- NEW FILE: org_lwjgl_opengl_Window.h --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_Window.h /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class org_lwjgl_opengl_Window */ #ifndef _Included_org_lwjgl_opengl_Window #define _Included_org_lwjgl_opengl_Window #ifdef __cplusplus extern "C" { #endif /* Inaccessible static: _00024assertionsDisabled */ /* Inaccessible static: created */ /* Inaccessible static: x */ /* Inaccessible static: y */ /* Inaccessible static: width */ /* Inaccessible static: height */ /* Inaccessible static: title */ /* Inaccessible static: color */ /* Inaccessible static: alpha */ /* Inaccessible static: depth */ /* Inaccessible static: stencil */ /* Inaccessible static: fullscreen */ /* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024Window */ /* * Class: org_lwjgl_opengl_Window * Method: nSetTitle * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nSetTitle (JNIEnv *, jclass, jstring); /* * Class: org_lwjgl_opengl_Window * Method: nIsCloseRequested * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsCloseRequested (JNIEnv *, jclass); /* * Class: org_lwjgl_opengl_Window * Method: nIsMinimized * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsMinimized (JNIEnv *, jclass); /* * Class: org_lwjgl_opengl_Window * Method: nIsFocused * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsFocused (JNIEnv *, jclass); /* * Class: org_lwjgl_opengl_Window * Method: minimize * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_minimize (JNIEnv *, jclass); /* * Class: org_lwjgl_opengl_Window * Method: restore * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_restore (JNIEnv *, jclass); /* * Class: org_lwjgl_opengl_Window * Method: nIsDirty * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsDirty (JNIEnv *, jclass); /* * Class: org_lwjgl_opengl_Window * Method: swapBuffers * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers (JNIEnv *, jclass); /* * Class: org_lwjgl_opengl_Window * Method: nCreate * Signature: (Ljava/lang/String;IIIIZIIII)V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate (JNIEnv *, jclass, jstring, jint, jint, jint, jint, jboolean, jint, jint, jint, jint); /* * Class: org_lwjgl_opengl_Window * Method: nDestroy * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nDestroy (JNIEnv *, jclass); /* * Class: org_lwjgl_opengl_Window * Method: tick * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_tick (JNIEnv *, jclass); #ifdef __cplusplus } #endif #endif Index: org_lwjgl_opengl_GL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_GL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_GL.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- org_lwjgl_opengl_GL.cpp 3 Aug 2003 22:27:28 -0000 1.15 +++ org_lwjgl_opengl_GL.cpp 4 Aug 2003 10:09:39 -0000 1.16 @@ -47,7 +47,9 @@ #include "extgl.h" #include "checkGLerror.h" +#ifdef _WIN32 extern HDC hdc; +#endif static inline void * safeGetBufferAddress(JNIEnv *env, jobject buffer) { if (buffer == NULL) --- org_lwjgl_Window.h DELETED --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_Window.h |
|
From: Elias N. <eli...@us...> - 2003-08-04 10:09:43
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv2108/src/native/linux Modified Files: Makefile.am Window.h Added Files: org_lwjgl_opengl_Window.cpp Removed Files: org_lwjgl_Window.cpp org_lwjgl_opengl_GLWindow.cpp Log Message: --- NEW FILE: org_lwjgl_opengl_Window.cpp --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp /* * Copyright (c) 2002 Light Weight Java Game Library 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 'Light Weight Java Game Library' 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_Window.cpp,v 1.1 2003/08/04 10:09:40 elias_naur Exp $ * * Linux specific window functions. * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <jni.h> #include "extgl.h" #include "Window.h" #include "org_lwjgl_opengl_Window.h" #define USEGLX13 true static GLXContext context = NULL; // OpenGL rendering context static GLXWindow glx_window; static Atom delete_atom; static Display *current_disp; static Window current_win; static int current_screen; static bool current_fullscreen; static int current_height; static int current_width; static bool input_released; static bool dirty; static bool minimized; static bool focused; static bool closerequested; static void waitMapped(Display *disp, Window win) { XEvent event; do { XMaskEvent(disp, StructureNotifyMask, &event); } while ((event.type != MapNotify) || (event.xmap.event != win)); } static void acquireInput(void) { if (input_released) { acquireKeyboard(); acquirePointer(); input_released = false; } } static void doReleaseInput(void) { releaseKeyboard(); releasePointer(); input_released = true; } void updateInput(void) { if (!input_released) { doReleaseInput(); acquireInput(); } } bool releaseInput(void) { if (current_fullscreen || input_released) return false; doReleaseInput(); return true; } bool isFullscreen(void) { return current_fullscreen; } static void handleMessages() { XEvent event; while (XPending(current_disp) > 0) { XNextEvent(current_disp, &event); switch (event.type) { case ClientMessage: if ((event.xclient.format == 32) && ((Atom)event.xclient.data.l[0] == delete_atom)) closerequested = true; break; case FocusOut: releaseInput(); focused = false; break; case FocusIn: acquireInput(); focused = true; break; case MapNotify: dirty = true; minimized = false; break; case UnmapNotify: minimized = true; break; case Expose: // XSetInputFocus(current_disp, current_win, RevertToParent, CurrentTime); dirty = true; break; case ButtonPress: handleButtonPress(&(event.xbutton)); break; case ButtonRelease: handleButtonRelease(&(event.xbutton)); break; case MotionNotify: handlePointerMotion(&(event.xmotion)); break; case KeyPress: case KeyRelease: handleKeyEvent(&(event.xkey)); break; } } } static void setWindowTitle(const char *title) { XStoreName(current_disp, current_win, title); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nSetTitle (JNIEnv * env, jclass clazz, jstring title_obj) { const char * title = env->GetStringUTFChars(title_obj, NULL); setWindowTitle(title); env->ReleaseStringUTFChars(title_obj, title); } static void createWindow(JNIEnv* env, Display *disp, int screen, XVisualInfo *vis_info, jstring title, int x, int y, int width, int height, bool fullscreen) { dirty = true; focused = true; minimized = false; closerequested = false; Window root_win; Window win; XSetWindowAttributes attribs; Colormap cmap; int attribmask; current_disp = disp; current_screen = screen; input_released = false; current_fullscreen = fullscreen; current_width = width; current_height = height; root_win = RootWindow(disp, screen); cmap = XCreateColormap(disp, root_win, vis_info->visual, AllocNone); attribs.colormap = cmap; attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask| StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; attribs.background_pixel = 0xFF000000; attribmask = CWColormap | CWBackPixel | CWEventMask; if (fullscreen) { attribmask |= CWOverrideRedirect; attribs.override_redirect = True; } win = XCreateWindow(disp, root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); XFreeColormap(disp, cmap); #ifdef _DEBUG printf("Created window\n"); #endif current_win = win; Java_org_lwjgl_opengl_Window_nSetTitle(env, NULL, title); XSizeHints * size_hints = XAllocSizeHints(); size_hints->flags = PMinSize | PMaxSize; size_hints->min_width = width; size_hints->max_width = width; size_hints->min_height = height; size_hints->max_height = height; XSetWMNormalHints(disp, win, size_hints); XFree(size_hints); delete_atom = XInternAtom(disp, "WM_DELETE_WINDOW", False); XSetWMProtocols(disp, win, &delete_atom, 1); XMapRaised(disp, win); waitMapped(disp, win); XClearWindow(disp, win); XSetInputFocus(current_disp, current_win, RevertToParent, CurrentTime); XSync(disp, True); } static void destroyWindow() { XDestroyWindow(current_disp, current_win); current_disp = NULL; } Display *getCurrentDisplay(void) { return current_disp; } int getCurrentScreen(void) { return current_screen; } Window getCurrentWindow(void) { return current_win; } int getWindowWidth(void) { return current_width; } int getWindowHeight(void) { return current_height; } /* * Class: org_lwjgl_Window * Method: tick * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_tick (JNIEnv *env, jclass clazz) { handleMessages(); } /* * Utility function to throw an Exception */ void throwException(JNIEnv * env, const char * err) { jclass cls = env->FindClass("java/lang/Exception"); env->ThrowNew(cls, err); env->DeleteLocalRef(cls); } /* * Utility function to throw a RuntimeException */ void throwRuntimeException(JNIEnv * env, const char * err) { jclass cls = env->FindClass("java/lang/RuntimeException"); env->ThrowNew(cls, err); env->DeleteLocalRef(cls); } void makeCurrent(void) { if (USEGLX13 && extgl_Extensions.glx.GLX13) glXMakeContextCurrent(getCurrentDisplay(), glx_window, glx_window, context); else glXMakeCurrent(getCurrentDisplay(), getCurrentWindow(), context); } static void releaseContext(void) { if (USEGLX13 && extgl_Extensions.glx.GLX13) glXMakeContextCurrent(getCurrentDisplay(), None, None, NULL); else glXMakeCurrent(getCurrentDisplay(), None, NULL); } int convertToBPE(int bpp) { int bpe = 4; switch (bpp) { case 32: case 24: bpe = 8; break; case 16: /* Fall through */ default: break; } return bpe; } GLXContext getCurrentContext(void) { return context; } static GLXFBConfig *chooseVisualGLX13(Display *disp, int screen, int bpp, int depth, int alpha, int stencil) { int bpe = convertToBPE(bpp); int attriblist[] = {GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_DOUBLEBUFFER, True, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_DEPTH_SIZE, depth, GLX_RED_SIZE, bpe, GLX_GREEN_SIZE, bpe, GLX_BLUE_SIZE, bpe, GLX_ALPHA_SIZE, alpha, GLX_STENCIL_SIZE, stencil, None}; int num_formats = 0; GLXFBConfig* configs = glXChooseFBConfig(disp, screen, attriblist, &num_formats); if (num_formats > 0) return configs; else { if (configs != NULL) XFree(configs); return NULL; } } static XVisualInfo *chooseVisual(Display *disp, int screen, int bpp, int depth, int alpha, int stencil) { int bpe = convertToBPE(bpp); int attriblist[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, depth, GLX_RED_SIZE, bpe, GLX_GREEN_SIZE, bpe, GLX_BLUE_SIZE, bpe, GLX_ALPHA_SIZE, alpha, GLX_STENCIL_SIZE, stencil, None}; return glXChooseVisual(disp, screen, attriblist); } static void dumpVisualInfo(Display *disp, XVisualInfo *vis_info) { int alpha, depth, stencil, r, g, b; glXGetConfig(disp, vis_info, GLX_RED_SIZE, &r); glXGetConfig(disp, vis_info, GLX_GREEN_SIZE, &g); glXGetConfig(disp, vis_info, GLX_BLUE_SIZE, &b); glXGetConfig(disp, vis_info, GLX_ALPHA_SIZE, &alpha); glXGetConfig(disp, vis_info, GLX_DEPTH_SIZE, &depth); glXGetConfig(disp, vis_info, GLX_STENCIL_SIZE, &stencil); printf("Pixel format chosen sizes: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d\n", r, g, b, alpha, depth, stencil); } static void destroy(void) { releaseContext(); if (USEGLX13 && extgl_Extensions.glx.GLX13) glXDestroyWindow(getCurrentDisplay(), glx_window); glXDestroyContext(getCurrentDisplay(), context); context = NULL; Display *disp = getCurrentDisplay(); destroyWindow(); XCloseDisplay(disp); extgl_Close(); } static bool initWindowGLX13(JNIEnv *env, Display *disp, int screen, jstring title, int x, int y, int width, int height, int bpp, int depth, int alpha, int stencil, bool fscreen) { GLXFBConfig *configs = chooseVisualGLX13(disp, screen, bpp, depth, alpha, stencil); if (configs == NULL) { throwException(env, "Could not find a matching pixel format"); return false; } context = glXCreateNewContext(disp, configs[0], GLX_RGBA_TYPE, NULL, True); if (context == NULL) { XFree(configs); throwException(env, "Could not create a GLX context"); return false; } if (glXIsDirect(disp, context) == False) { glXDestroyContext(disp, context); XFree(configs); throwException(env, "Could not create a GLX context"); return false; } XVisualInfo * vis_info = glXGetVisualFromFBConfig(disp, configs[0]); if (vis_info == NULL) { glXDestroyContext(disp, context); XFree(configs); throwException(env, "Could not create visual info from FB config"); return false; } #ifdef _DEBUG dumpVisualInfo(disp, vis_info); #endif createWindow(env, disp, screen, vis_info, title, x, y, width, height, fscreen); glx_window = glXCreateWindow(disp, configs[0], getCurrentWindow(), NULL); makeCurrent(); XFree(configs); XFree(vis_info); return true; } static bool initWindowGLX(JNIEnv *env, Display *disp, int screen, jstring title, int x, int y, int width, int height, int bpp, int depth, int alpha, int stencil, bool fscreen) { XVisualInfo *vis_info = chooseVisual(disp, screen, bpp, depth, alpha, stencil); if (vis_info == NULL) { throwException(env, "Could not find a matching pixel format"); return false; } #ifdef _DEBUG dumpVisualInfo(disp, vis_info); #endif context = glXCreateContext(disp, vis_info, NULL, True); if (context == NULL) { XFree(vis_info); throwException(env, "Could not create a GLX context"); return false; } if (glXIsDirect(disp, context) == False) { glXDestroyContext(disp, context); XFree(vis_info); throwException(env, "Could not create a direct GLX context"); return false; } createWindow(env, disp, screen, vis_info, title, x, y, width, height, fscreen); makeCurrent(); XFree(vis_info); return true; } /* * Class: org_lwjgl_opengl_GLWindow * Method: nCreate * Signature: (IIII)Z */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate (JNIEnv * env, jclass clazz, jstring title, jint x, jint y, jint width, jint height, jboolean fullscreen, jint bpp, jint alpha, jint depth, jint stencil) { int screen; Display *disp; bool fscreen = false; if (fullscreen == JNI_TRUE) fscreen = true; if (extgl_Open() != 0) { throwException(env, "Could not load gl libs"); return; } disp = XOpenDisplay(NULL); if (disp == NULL) { throwException(env, "Could not open X display"); return; } screen = XDefaultScreen(disp); if (extgl_InitGLX(disp, screen) != 0) { XCloseDisplay(disp); extgl_Close(); throwException(env, "Could not init GLX"); return; } bool create_success; if (USEGLX13 && extgl_Extensions.glx.GLX13) { create_success = initWindowGLX13(env, disp, screen, title, x, y, width, height, bpp, depth, alpha, stencil, fscreen); } else { create_success = initWindowGLX(env, disp, screen, title, x, y, width, height, bpp, depth, alpha, stencil, fscreen); } if (!create_success) { XCloseDisplay(disp); extgl_Close(); return; } if (extgl_Initialize() != 0) { destroy(); throwException(env, "Could not init gl function pointers"); return; } #ifdef _DEBUG const GLubyte * extensions = glGetString(GL_EXTENSIONS); printf("Supported extensions: %s\n", extensions); #endif } /* * Class: org_lwjgl_opengl_GLWindow * Method: nDestroy * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nDestroy (JNIEnv *env, jclass clazz) { destroy(); } /* * Class: org_lwjgl_opengl_GLWindow * Method: swapBuffers * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers(JNIEnv * env, jclass clazz) { dirty = false; if (USEGLX13 && extgl_Extensions.glx.GLX13) glXSwapBuffers(getCurrentDisplay(), glx_window); else glXSwapBuffers(getCurrentDisplay(), getCurrentWindow()); } /* * Class: org_lwjgl_opengl_Window * Method: minimize * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_minimize (JNIEnv *env, jclass clazz) { } /* * Class: org_lwjgl_opengl_Window * Method: restore * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_restore (JNIEnv *env, jclass clazz) { } /* * Class: org_lwjgl_opengl_Window * Method: nIsDirty * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsDirty (JNIEnv *env, jclass clazz) { return dirty; } /* * Class: org_lwjgl_opengl_Window * Method: nIsMinimized * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsMinimized (JNIEnv *env, jclass clazz) { return minimized; } /* * Class: org_lwjgl_opengl_Window * Method: nIsCloseRequested * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsCloseRequested (JNIEnv *, jclass) { bool saved = closerequested; closerequested = false; return saved; } /* * Class: org_lwjgl_opengl_Window * Method: nIsFocused * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsFocused (JNIEnv *env, jclass clazz) { return focused; } Index: Makefile.am CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/Makefile.am =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.am 28 Jul 2003 10:09:58 -0000 1.7 +++ Makefile.am 4 Aug 2003 10:09:40 -0000 1.8 @@ -10,9 +10,8 @@ org_lwjgl_input_Keyboard.cpp \ org_lwjgl_input_Mouse.cpp \ org_lwjgl_input_Cursor.cpp \ - org_lwjgl_opengl_GLWindow.cpp \ + org_lwjgl_opengl_Window.cpp \ org_lwjgl_opengl_GLCaps.cpp \ org_lwjgl_opengl_Pbuffer.cpp \ - org_lwjgl_Window.cpp \ extxcursor.cpp Index: Window.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/Window.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Window.h 20 May 2003 12:20:12 -0000 1.3 +++ Window.h 4 Aug 2003 10:09:40 -0000 1.4 @@ -71,16 +71,6 @@ extern void acquirePointer(void); /* - * destroy the window - */ - extern void destroyWindow(void); - - /* - * create a new X window with the specified visual - */ - extern void createWindow(JNIEnv *env, Display *disp, int screen, XVisualInfo *vis_info, jstring title, int x, int y, int width, int height, bool fullscreen); - - /* * get the current window width */ extern int getWindowWidth(void); --- org_lwjgl_Window.cpp DELETED --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Window.cpp --- org_lwjgl_opengl_GLWindow.cpp DELETED --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_GLWindow.cpp |
|
From: Elias N. <eli...@us...> - 2003-08-04 10:09:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/native In directory sc8-pr-cvs1:/tmp/cvs-serv2108/src/native Modified Files: configure.in Log Message: Index: configure.in CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/configure.in =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/configure.in,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- configure.in 3 Aug 2003 16:19:09 -0000 1.20 +++ configure.in 4 Aug 2003 10:09:39 -0000 1.21 @@ -51,8 +51,8 @@ else AC_MSG_RESULT($JAVA_HOME) JAVA_HOME="$JAVA_HOME" - CPPFLAGS="$CPPFLAGS -fno-rtti -fno-exceptions -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" - CFLAGS="$CFLAGS -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" + CPPFLAGS="$CPPFLAGS -D_DEBUG -fno-rtti -fno-exceptions -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" + CFLAGS="$CFLAGS -D_DEBUG -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" fi dnl Checks for libraries. |
|
From: Elias N. <eli...@us...> - 2003-08-04 10:09:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv2108/src/java/org/lwjgl/test/opengl Modified Files: FullScreenWindowedTest.java Game.java Grass.java PbufferTest.java VBOTest.java Log Message: Index: FullScreenWindowedTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- FullScreenWindowedTest.java 2 Aug 2003 20:52:48 -0000 1.11 +++ FullScreenWindowedTest.java 4 Aug 2003 10:09:39 -0000 1.12 @@ -49,9 +49,6 @@ /** Intended deiplay mode */ private DisplayMode mode; - /** GL instance */ - private GLWindow gl; - /** GLU instance */ private GLU glu; @@ -96,8 +93,7 @@ mode = findDisplayMode(800, 600, 16); // start of in windowed mode - gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); - gl.create(); + Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); glInit(); @@ -202,11 +198,10 @@ try { Keyboard.destroy(); - gl.destroy(); + Window.destroy(); Display.setDisplayMode(mode); - gl = new GLWindow("Test", mode.bpp, 0, 0, 0); - gl.create(); + Window.create("Test", mode.bpp, 0, 0, 0); glInit(); @@ -220,11 +215,10 @@ if (Keyboard.isKeyDown(Keyboard.KEY_W)) { try { Keyboard.destroy(); - gl.destroy(); + Window.destroy(); Display.resetDisplayMode(); - gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); - gl.create(); + Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); glInit(); @@ -282,7 +276,7 @@ */ private void cleanup() { Keyboard.destroy(); - gl.destroy(); + Window.destroy(); } /** Index: Game.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Game.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Game.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Game.java 2 Aug 2003 20:52:48 -0000 1.17 +++ Game.java 4 Aug 2003 10:09:39 -0000 1.18 @@ -72,10 +72,9 @@ } } - public static final GLWindow gl = new GLWindow("LWJGL Game Example", 16, 0, 0,0); static { try { - gl.create(); + Window.create("LWJGL Game Example", 16, 0, 0,0); System.out.println("Created OpenGL."); } catch (Exception e) { System.err.println("Failed to create OpenGL due to "+e); @@ -184,7 +183,7 @@ GL.glGetInteger(GL.GL_MAX_TEXTURE_UNITS_ARB, num_tex_units_buf.asIntBuffer()); System.out.println("Number of texture units: " + num_tex_units_buf.getInt()); // Fix the refresh rate to the display frequency. -// gl.wglSwapIntervalEXT(1); +// GL.wglSwapIntervalEXT(1); } /** @@ -193,7 +192,7 @@ private static void cleanup() { Keyboard.destroy(); Mouse.destroy(); - gl.destroy(); + Window.destroy(); try { Display.resetDisplayMode(); } catch (Exception e) { Index: Grass.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Grass.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Grass.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Grass.java 2 Aug 2003 20:52:48 -0000 1.18 +++ Grass.java 4 Aug 2003 10:09:39 -0000 1.19 @@ -88,11 +88,9 @@ } } - public static final GLWindow gl = new GLWindow("LWJGL Grass", 50, 50, 640, 480, 16, 0, 0,0); - static { try { - gl.create(); + Window.create("LWJGL Grass", 50, 50, 640, 480, 16, 0, 0,0); Keyboard.create(); Keyboard.enableBuffer(); Mouse.create(); @@ -149,7 +147,7 @@ GL.GL_VERTEX_PROGRAM_NV, program_handle, program_buf); - /*gl.getIntegerv(GL.PROGRAM_ERROR_POSITION_NV, Sys.getDirectBufferAddress(int_buf)); + /*GL.glGetInteger(GL.PROGRAM_ERROR_POSITION_NV, int_buf); System.out.println("error position: " + int_buf.get(0));*/ genMesh(); @@ -205,7 +203,7 @@ } Mouse.destroy(); Keyboard.destroy(); - gl.destroy(); + Window.destroy(); } private static float myrand() { @@ -433,27 +431,6 @@ } - /* private static void ptrDraw() - { - glRotatef((aslod.angle * 180.0f) / 3.1415f, 0, 1, 0); - glTranslatef(0, 4.5, -7.5); - glRotatef(-90, 0, 1, 0); - glRotatef(-45, 0, 0, 1); - - glMaterialfv(GL.FRONT, GL.AMBIENT, vec4f(.1f,.1f,0,1).v); - glMaterialfv(GL.FRONT, GL.DIFFUSE, vec4f(.6f,.6f,.1f,1).v); - glMaterialfv(GL.FRONT, GL.SPECULAR, vec4f(1,1,.75f,1).v); - glMaterialf(GL.FRONT, GL.SHININESS, 128.f); - - glutSolidTeapot(aslod.value*5); - - gl.rotatef(45, 0, 0, 1); - gl.totatef(90, 0, 1, 0); - gl.translatef(0, -4.5, 7.5); - gl.rotatef(-(aslod.angle * 180.0f) / 3.1415f, 0f, 1f, 0f); - - } - */ private static void ptrAnimate(float degree) { aslod.count += degree; aslod.ripple = (float) (java.lang.Math.cos(aslod.count) / 80.0); Index: PbufferTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/PbufferTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/PbufferTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- PbufferTest.java 2 Aug 2003 20:52:48 -0000 1.9 +++ PbufferTest.java 4 Aug 2003 10:09:39 -0000 1.10 @@ -51,9 +51,6 @@ /** Intended deiplay mode */ private DisplayMode mode; - /** GL instance */ - private GLWindow gl; - /** GLU instance */ private GLU glu; @@ -98,9 +95,8 @@ mode = findDisplayMode(800, 600, 16); // start of in windowed mode - gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); + Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); // gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); - gl.create(); if ((Pbuffer.getPbufferCaps() & Pbuffer.PBUFFER_SUPPORTED) == 0) { System.out.println("No Pbuffer support!"); System.exit(1); @@ -259,11 +255,10 @@ Keyboard.destroy(); Pbuffer.releaseContext(); pbuffer.destroy(); - gl.destroy(); + Window.destroy(); Display.setDisplayMode(mode); - gl = new GLWindow("Test", mode.bpp, 0, 0, 0); - gl.create(); + Window.create("Test", mode.bpp, 0, 0, 0); glInit(); initPbuffer(); @@ -280,11 +275,10 @@ Keyboard.destroy(); Pbuffer.releaseContext(); pbuffer.destroy(); - gl.destroy(); + Window.destroy(); Display.resetDisplayMode(); - gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); - gl.create(); + Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); glInit(); initPbuffer(); @@ -352,7 +346,7 @@ Keyboard.destroy(); Pbuffer.releaseContext(); pbuffer.destroy(); - gl.destroy(); + Window.destroy(); } /** Index: VBOTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- VBOTest.java 2 Aug 2003 20:52:49 -0000 1.5 +++ VBOTest.java 4 Aug 2003 10:09:39 -0000 1.6 @@ -72,10 +72,9 @@ } } - public static final GLWindow gl = new GLWindow("LWJGL Game Example", 16, 0, 0,0); static { try { - gl.create(); + Window.create("LWJGL Game Example", 16, 0, 0,0); System.out.println("Created OpenGL."); } catch (Exception e) { System.err.println("Failed to create OpenGL due to "+e); @@ -210,7 +209,7 @@ GL.glDeleteBuffersARB(int_buffer); Keyboard.destroy(); Mouse.destroy(); - gl.destroy(); + Window.destroy(); try { Display.resetDisplayMode(); } catch (Exception e) { |
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input In directory sc8-pr-cvs1:/tmp/cvs-serv2108/src/java/org/lwjgl/test/input Modified Files: ControllerCreationTest.java ControllerTest.java HWCursorTest.java KeyboardTest.java MouseCreationTest.java MouseTest.java Log Message: Index: ControllerCreationTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerCreationTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ControllerCreationTest.java 2 Aug 2003 20:52:48 -0000 1.9 +++ ControllerCreationTest.java 4 Aug 2003 10:09:39 -0000 1.10 @@ -34,10 +34,9 @@ import org.lwjgl.Sys; import org.lwjgl.Display; import org.lwjgl.DisplayMode; -import org.lwjgl.Window; import org.lwjgl.input.Controller; import org.lwjgl.opengl.GL; -import org.lwjgl.opengl.GLWindow; +import org.lwjgl.opengl.Window; import org.lwjgl.opengl.GLU; import org.lwjgl.vector.Vector2f; @@ -50,10 +49,6 @@ * @version $Revision$ */ public class ControllerCreationTest { - - /** OpenGL instance */ - private GLWindow gl; - /** position of quad to draw */ private Vector2f position = new Vector2f(320.0f, 240.0f); @@ -79,11 +74,10 @@ try { if(fullscreen) { Display.setDisplayMode(displayMode); - gl = new GLWindow("ControllerCreationTest", 16, 0, 0, 0); + Window.create("ControllerCreationTest", 16, 0, 0, 0); } else { - gl = new GLWindow("ControllerCreationTest", 50, 50, 640, 480, 16, 0, 0, 0); + Window.create("ControllerCreationTest", 50, 50, 640, 480, 16, 0, 0, 0); } - gl.create(); } catch (Exception e) { e.printStackTrace(); @@ -115,12 +109,12 @@ // recreate display in fullscreen mode System.out.print("Destroying display..."); - gl.destroy(); + Window.destroy(); System.out.println("success"); System.out.print("Entering fullscreen mode..."); try { - gl.destroy(); + Window.destroy(); initialize(true); Display.setDisplayMode(displayMode); } catch (Exception e) { @@ -143,7 +137,7 @@ System.out.print("Shutting down..."); Display.resetDisplayMode(); Controller.destroy(); - gl.destroy(); + Window.destroy(); System.out.println("shutdown complete"); } Index: ControllerTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ControllerTest.java 2 Aug 2003 20:52:48 -0000 1.7 +++ ControllerTest.java 4 Aug 2003 10:09:39 -0000 1.8 @@ -32,11 +32,10 @@ package org.lwjgl.test.input; import org.lwjgl.DisplayMode; -import org.lwjgl.Window; import org.lwjgl.input.Controller; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL; -import org.lwjgl.opengl.GLWindow; +import org.lwjgl.opengl.Window; import org.lwjgl.opengl.GLU; import org.lwjgl.vector.Vector2f; @@ -50,9 +49,6 @@ */ public class ControllerTest { - /** OpenGL instance */ - private GLWindow gl; - /** GLU instance */ private GLU glu; @@ -80,8 +76,7 @@ private void setupDisplay(boolean fullscreen) { try { - gl = new GLWindow("ControllerTest", 50, 50, 640, 480, 16, 0, 0, 0); - gl.create(); + Window.create("ControllerTest", 50, 50, 640, 480, 16, 0, 0, 0); } catch (Exception e) { e.printStackTrace(); System.exit(-1); @@ -104,7 +99,7 @@ Controller.destroy(); Keyboard.destroy(); - gl.destroy(); + Window.destroy(); } private void createController() { Index: HWCursorTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- HWCursorTest.java 2 Aug 2003 20:52:48 -0000 1.9 +++ HWCursorTest.java 4 Aug 2003 10:09:39 -0000 1.10 @@ -50,9 +50,6 @@ /** Intended deiplay mode */ private DisplayMode mode; - /** GL instance */ - private GLWindow gl; - /** GLU instance */ private GLU glu; @@ -83,8 +80,7 @@ mode = findDisplayMode(800, 600, 16); // start of in windowed mode - gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); - gl.create(); + Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); glInit(); @@ -230,11 +226,10 @@ } cursor.destroy(); Mouse.destroy(); - gl.destroy(); + Window.destroy(); Display.setDisplayMode(mode); - gl = new GLWindow("Test", mode.bpp, 0, 0, 0); - gl.create(); + Window.create("Test", mode.bpp, 0, 0, 0); glInit(); @@ -257,11 +252,10 @@ } cursor.destroy(); Mouse.destroy(); - gl.destroy(); + Window.destroy(); Display.resetDisplayMode(); - gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); - gl.create(); + Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0); glInit(); @@ -304,7 +298,7 @@ cursor.destroy(); Mouse.destroy(); Display.resetDisplayMode(); - gl.destroy(); + Window.destroy(); } /** Index: KeyboardTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/KeyboardTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/KeyboardTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- KeyboardTest.java 2 Aug 2003 20:52:48 -0000 1.4 +++ KeyboardTest.java 4 Aug 2003 10:09:39 -0000 1.5 @@ -32,10 +32,9 @@ package org.lwjgl.test.input; import org.lwjgl.DisplayMode; -import org.lwjgl.Window; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL; -import org.lwjgl.opengl.GLWindow; +import org.lwjgl.opengl.Window; import org.lwjgl.opengl.GLU; import org.lwjgl.vector.Vector2f; @@ -49,9 +48,6 @@ */ public class KeyboardTest { - /** OpenGL instance */ - private GLWindow gl; - /** GLU instance */ private GLU glu; @@ -83,9 +79,7 @@ private void setupDisplay(boolean fullscreen) { try { - gl = new GLWindow("KeyboardTest", 50, 50, 640, 480, 16, 0, 0, 0); - gl.create(); - + Window.create("KeyboardTest", 50, 50, 640, 480, 16, 0, 0, 0); } catch (Exception e) { e.printStackTrace(); System.exit(-1); @@ -107,7 +101,7 @@ wiggleKeyboard(); Keyboard.destroy(); - gl.destroy(); + Window.destroy(); } private void createKeyboard() { Index: MouseCreationTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- MouseCreationTest.java 2 Aug 2003 20:52:48 -0000 1.12 +++ MouseCreationTest.java 4 Aug 2003 10:09:39 -0000 1.13 @@ -34,10 +34,9 @@ import org.lwjgl.Sys; import org.lwjgl.Display; import org.lwjgl.DisplayMode; -import org.lwjgl.Window; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL; -import org.lwjgl.opengl.GLWindow; +import org.lwjgl.opengl.Window; import org.lwjgl.opengl.GLU; import org.lwjgl.vector.Vector2f; @@ -50,10 +49,6 @@ * @version $Revision$ */ public class MouseCreationTest { - - /** OpenGL instance */ - private GLWindow gl; - /** GLU instance */ private GLU glu; @@ -82,11 +77,10 @@ try { if(fullscreen) { Display.setDisplayMode(displayMode); - gl = new GLWindow("MouseCreationTest", 16, 0, 0, 0); + Window.create("MouseCreationTest", 16, 0, 0, 0); } else { - gl = new GLWindow("MouseCreationTest", 50, 50, 640, 480, 16, 0, 0, 0); + Window.create("MouseCreationTest", 50, 50, 640, 480, 16, 0, 0, 0); } - gl.create(); } catch (Exception e) { e.printStackTrace(); @@ -123,7 +117,7 @@ System.out.print("Entering fullscreen mode..."); try { - gl.destroy(); + Window.destroy(); initialize(true); Display.setDisplayMode(displayMode); } catch (Exception e) { @@ -146,7 +140,7 @@ System.out.print("Shutting down..."); Display.resetDisplayMode(); Mouse.destroy(); - gl.destroy(); + Window.destroy(); System.out.println("shutdown complete"); } Index: MouseTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- MouseTest.java 2 Aug 2003 20:52:48 -0000 1.14 +++ MouseTest.java 4 Aug 2003 10:09:39 -0000 1.15 @@ -32,11 +32,10 @@ package org.lwjgl.test.input; import org.lwjgl.DisplayMode; -import org.lwjgl.Window; import org.lwjgl.input.Mouse; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL; -import org.lwjgl.opengl.GLWindow; +import org.lwjgl.opengl.Window; import org.lwjgl.opengl.GLU; import org.lwjgl.vector.Vector2f; @@ -50,9 +49,6 @@ */ public class MouseTest { - /** OpenGL instance */ - private GLWindow gl; - /** GLU instance */ private GLU glu; @@ -80,9 +76,7 @@ private void setupDisplay(boolean fullscreen) { try { - gl = new GLWindow("MouseTest", 50, 50, 640, 480, 16, 0, 0, 0); - gl.create(); - + Window.create("MouseTest", 50, 50, 640, 480, 16, 0, 0, 0); } catch (Exception e) { e.printStackTrace(); System.exit(-1); @@ -105,7 +99,7 @@ Mouse.destroy(); Keyboard.destroy(); - gl.destroy(); + Window.destroy(); } private void createMouse() { |
|
From: Elias N. <eli...@us...> - 2003-08-04 10:09:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal In directory sc8-pr-cvs1:/tmp/cvs-serv2108/src/java/org/lwjgl/test/openal Modified Files: MovingSoundTest.java Log Message: Index: MovingSoundTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/MovingSoundTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/MovingSoundTest.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- MovingSoundTest.java 2 Aug 2003 20:52:48 -0000 1.15 +++ MovingSoundTest.java 4 Aug 2003 10:09:39 -0000 1.16 @@ -31,11 +31,10 @@ */ package org.lwjgl.test.openal; -import org.lwjgl.Window; import org.lwjgl.openal.AL; import org.lwjgl.openal.eax.*; import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GLWindow; +import org.lwjgl.opengl.Window; import java.nio.IntBuffer; import java.nio.FloatBuffer; @@ -52,7 +51,6 @@ public class MovingSoundTest extends BasicTest { public static float MOVEMENT = 50.00f; - private GLWindow gl = new GLWindow("Moving Sound Test", 100, 100, 320, 240, 32, 0 ,0 ,0); /** * Creates an instance of MovingSoundTest @@ -71,7 +69,7 @@ } try { - gl.create(); + Window.create("Moving Sound Test", 100, 100, 320, 240, 32, 0 ,0 ,0); } catch (Exception e) { e.printStackTrace(); } |
|
From: Elias N. <eli...@us...> - 2003-08-04 10:09:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv2108/src/java/org/lwjgl/opengl Added Files: Window.java Log Message: --- NEW FILE: Window.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Window.java /* * Created on 27-Mar-2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code Template */ package org.lwjgl.opengl; /** * This is the abstract class for a Window in LWJGL. LWJGL windows have some * peculiar characteristics: * * - width and height are always fixed and cannot be changed * - the position of the window may or may not be programmable but once specified * cannot be changed programmatically * - the window may be closeable by the user or operating system, and may be minimized * by the user or operating system * - only one window may ever be open at once * - the operating system may or may not be able to do fullscreen or windowed windows. * * @author foo */ import org.lwjgl.Display; import org.lwjgl.Sys; public final class Window { static { System.loadLibrary(Sys.getLibraryName()); } /** Whether the window is currently created, ie. has a native peer */ private static boolean created; /** X coordinate of the window */ private static int x; /** * Y coordinate of the window. Y in window coordinates is from the top of the display down, * unlike GL, where it is typically at the bottom of the display. */ private static int y; /** Width of the window */ private static int width; /** Height of the window */ private static int height; /** Title of the window */ private static String title; /** Color bits */ private static int color; /** Alpha bits */ private static int alpha; /** Depth bits */ private static int depth; /** Stencil bits */ private static int stencil; /** Fullscreen */ private static boolean fullscreen; /** * Construct a Window. Some OSs may not support non-fullscreen windows; in * which case the window will be fullscreen regardless. * * A fullscreen window MUST track changes to the display settings and change its * width and height accordingly. * * In this abstract base class, no actual window peer is constructed. This should be * done in specialised derived classes. * * Only one Window can be created() at a time; to create another Window you must * first destroy() the first window. * * The dimensions may be ignored if the window cannot be made non- * fullscreen. The position may be ignored in either case. * * @param title The window's title * @param x Position on x axis of top left corner of window. * @param y Position on y axis of top left corner of window. * @param width Width of window * @param height Height of window * @throws RuntimeException if you attempt to create more than one window at the same time */ private Window() { } /** * @return the width of the window */ public static int getWidth() { return width; } /** * @return the height of the window */ public static int getHeight() { return height; } /** * @return the title of the window */ public static String getTitle() { return title; } /** * Set the title of the window. This may be ignored by the underlying OS. * @param newTitle The new window title */ public static void setTitle(String newTitle) { assert isCreated(); title = newTitle; nSetTitle(title); } /** * Native implementation of setTitle(). This will read the window's title member * and stash it in the native title of the window. */ private static native void nSetTitle(String title); /** * @return true if the user or operating system has asked the window to close */ public static boolean isCloseRequested() { assert isCreated(); return nIsCloseRequested(); } private static native boolean nIsCloseRequested(); /** * @return true if the window is minimized or otherwise not visible */ public static boolean isMinimized() { assert isCreated(); return nIsMinimized(); } private static native boolean nIsMinimized(); /** * @return true if window is focused */ public static boolean isFocused() { assert isCreated(); return nIsFocused(); } private static native boolean nIsFocused(); /** * Minimize the game and allow the operating system's default display to become * visible. It is the responsibility of LWJGL's native code to restore the display * to its normal display settings. * * If the display is already minimized then this is a no-op. */ public static native void minimize(); /** * Restore the game and hide the operating system away. It is the responsibility of * LWJGL's native code to restore the display to its game display settings. * * If the display is not minimized then this is a no-op/ */ public static native void restore(); /** * Determine if the window's contents have been damaged by external events. * If you are writing a straightforward game rendering loop and simply paint * every frame regardless, you can ignore this flag altogether. If you are * trying to be kind to other processes you can check this flag and only * redraw when it returns true. The flag is cleared when you call paint(). * * @return true if the window has been damaged by external changes * and needs to repaint itself */ public static boolean isDirty() { assert isCreated(); return nIsDirty(); } private static native boolean nIsDirty(); /** * Paint the window. This clears the dirty flag and swaps the buffers. */ public static void paint() { assert isCreated(); swapBuffers(); } /** * Swap double buffers. */ private static native void swapBuffers(); /** * Create a fullscreen window. If the underlying OS does not * support fullscreen mode, then a window will be created instead. If this * fails too then an Exception will be thrown. * * @param title The title of the window * @param bpp Minimum bits per pixel * @param alpha Minimum bits per pixel in alpha buffer * @param depth Minimum bits per pixel in depth buffer * @param stencil Minimum bits per pixel in stencil buffer * @throws Exception if the window could not be created for any reason; typically because * the minimum requirements could not be met satisfactorily */ public static void create(String title, int bpp, int alpha, int depth, int stencil) throws Exception { if (isCreated()) throw new Exception("Only one LWJGL window may be instantiated at any one time."); Window.x = 0; Window.y = 0; Window.color = bpp; Window.alpha = alpha; Window.depth = depth; Window.stencil = stencil; Window.fullscreen = true; Window.title = title; Window.width = Display.getWidth(); Window.height = Display.getHeight(); nCreate(title, x, y, width, height, fullscreen, color, alpha, depth, stencil); created = true; } /** * Create a window. If the underlying OS does not have "floating" windows, then a fullscreen * display will be created instead. If this fails too then an Exception will be thrown. * If the window is created fullscreen, then its size may not match the specified size * here. * * @param title The title of the window * @param x The position of the window on the x axis. May be ignored. * @param y The position of the window on the y axis. May be ignored. * @param width The width of the window's client area * @param height The height of the window's client area * @param bpp Minimum bits per pixel * @param alpha Minimum bits per pixel in alpha buffer * @param depth Minimum bits per pixel in depth buffer * @param stencil Minimum bits per pixel in stencil buffer * @throws Exception if the window could not be created for any reason; typically because * the minimum requirements could not be met satisfactorily */ public static void create(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil) throws Exception { if (isCreated()) throw new Exception("Only one LWJGL window may be instantiated at any one time."); Window.x = x; Window.y = y; Window.width = width; Window.height = height; Window.color = bpp; Window.alpha = alpha; Window.depth = depth; Window.stencil = stencil; Window.fullscreen = false; Window.title = title; nCreate(title, x, y, width, height, fullscreen, color, alpha, depth, stencil); created = true; } /** * Create the native window peer. * @throws Exception */ private static native void nCreate( String title, int x, int y, int width, int height, boolean fullscreen, int bpp, int alpha, int depth, int stencil) throws Exception; /** * Destroy the window. */ public static void destroy() { if (!created) return; nDestroy(); created = false; } /** * Destroy the native window peer. */ private native static void nDestroy(); /** * @return true if the window's native peer has been created */ public static boolean isCreated() { return created; } /** * 'Tick' the window. This must be called at least once per video frame * to handle window close requests, moves, paints, etc. */ public static native void tick(); } |
|
From: Elias N. <eli...@us...> - 2003-08-04 10:09:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test In directory sc8-pr-cvs1:/tmp/cvs-serv2108/src/java/org/lwjgl/test Modified Files: WindowCreationTest.java Log Message: Index: WindowCreationTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/WindowCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/WindowCreationTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- WindowCreationTest.java 2 Aug 2003 20:52:48 -0000 1.7 +++ WindowCreationTest.java 4 Aug 2003 10:09:39 -0000 1.8 @@ -7,7 +7,7 @@ package org.lwjgl.test; import org.lwjgl.*; -import org.lwjgl.opengl.GLWindow; +import org.lwjgl.opengl.Window; /** * @author Brian @@ -15,14 +15,11 @@ public class WindowCreationTest { public static void main(String[] args) { - GLWindow gl = null; - DisplayMode[] modes = Display.getAvailableDisplayModes(); System.out.println("Found " + modes.length + " display modes"); try { - gl = new GLWindow("WindowCreationTest", 50, 50, 320, 240, 16, 0, 0, 0); - gl.create(); + Window.create("WindowCreationTest", 50, 50, 320, 240, 16, 0, 0, 0); } catch (Exception e) { e.printStackTrace(); } @@ -38,6 +35,6 @@ } } - gl.destroy(); + Window.destroy(); } } |
|
From: Elias N. <eli...@us...> - 2003-08-04 10:09:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv2108/src/java/org/lwjgl Removed Files: Window.java Log Message: --- Window.java DELETED --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Window.java |