You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
1
|
2
(5) |
3
(1) |
4
(1) |
5
|
|
6
|
7
(6) |
8
(2) |
9
(11) |
10
|
11
(1) |
12
|
|
13
(1) |
14
(2) |
15
(30) |
16
(46) |
17
(13) |
18
(2) |
19
|
|
20
(26) |
21
(12) |
22
(9) |
23
(22) |
24
(5) |
25
(2) |
26
|
|
27
|
28
|
|
|
|
|
|
|
From: Caspian Rychlik-P. <ci...@us...> - 2005-02-20 23:04:56
|
Update of /cvsroot/java-game-lib/LWJGL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3370 Modified Files: build.xml Log Message: Refactored generator into util package Index: build.xml =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/build.xml,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- build.xml 20 Feb 2005 19:57:06 -0000 1.65 +++ build.xml 20 Feb 2005 23:04:43 -0000 1.66 @@ -373,7 +373,7 @@ <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/opengl/**" source="1.4" target="1.4" taskname="opengl" /> <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.4" target="1.4" taskname="test" /> <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.4" target="1.4" taskname="examples" /> - <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/**" source="1.4" target="1.4" taskname="util" /> + <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/**" excludes="org/lwjgl/util/generator/**" source="1.4" target="1.4" taskname="util" /> <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/fmod3/**" source="1.4" target="1.4" taskname="fmod" /> <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/devil/**" source="1.4" target="1.4" taskname="devil"/> </target> |
Update of /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2287/src/templates/org/lwjgl/opengl Modified Files: NV_register_combiners2.java ATI_texture_compression_3dc.java ARB_texture_compression.java ATI_fragment_shader.java GL14.java GL15.java ARB_shader_objects.java EXT_depth_bounds_test.java EXT_compiled_vertex_array.java GL12.java ARB_draw_buffers.java GL11.java ARB_multitexture.java ARB_transpose_matrix.java ATI_map_object_buffer.java ARB_buffer_object.java ATI_pn_triangles.java ATI_vertex_streams.java EXT_fog_coord.java ARB_matrix_palette.java GL20.java ARB_program.java ATI_vertex_array_object.java EXT_secondary_color.java ARB_color_buffer_float.java NV_vertex_array_range.java GL13.java NV_texture_compression_vtc.java ATI_draw_buffers.java EXT_texture_compression_s3tc.java EXT_vertex_shader.java ATI_envmap_bumpmap.java ATI_separate_stencil.java EXT_point_parameters.java EXT_texture_lod_bias.java EXT_blend_func_separate.java EXT_multi_draw_arrays.java ATI_vertex_attrib_array_object.java ARB_imaging.java ARB_vertex_shader.java ARB_multisample.java ARB_vertex_blend.java NV_occlusion_query.java EXT_draw_range_elements.java NV_program.java EXT_blend_equation_separate.java NV_point_sprite.java EXT_paletted_texture.java ARB_point_parameters.java EXT_stencil_two_side.java NV_fragment_program.java NV_register_combiners.java EXT_vertex_weighting.java NV_pixel_data_range.java EXT_framebuffer_object.java NV_half_float.java ATI_element_array.java NV_evaluators.java NV_vertex_program.java NV_primitive_restart.java NV_fence.java ARB_occlusion_query.java ARB_vertex_program.java Log Message: Refactored generator into util package Index: NV_register_combiners.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_register_combiners.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_register_combiners.java 15 Feb 2005 17:06:15 -0000 1.2 +++ NV_register_combiners.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -34,7 +34,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_register_combiners { int GL_REGISTER_COMBINERS_NV = 0x8522; Index: EXT_depth_bounds_test.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_depth_bounds_test.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_depth_bounds_test.java 15 Feb 2005 17:06:00 -0000 1.2 +++ EXT_depth_bounds_test.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_depth_bounds_test { /* Index: NV_primitive_restart.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_primitive_restart.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_primitive_restart.java 15 Feb 2005 17:06:15 -0000 1.2 +++ NV_primitive_restart.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_primitive_restart { /* Index: EXT_blend_equation_separate.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_blend_equation_separate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_blend_equation_separate.java 15 Feb 2005 17:06:00 -0000 1.2 +++ EXT_blend_equation_separate.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_blend_equation_separate { /* Index: EXT_secondary_color.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_secondary_color.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_secondary_color.java 15 Feb 2005 17:06:02 -0000 1.2 +++ EXT_secondary_color.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.Buffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_secondary_color { int GL_COLOR_SUM_EXT = 0x8458; Index: EXT_multi_draw_arrays.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_multi_draw_arrays.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_multi_draw_arrays.java 15 Feb 2005 17:06:00 -0000 1.2 +++ EXT_multi_draw_arrays.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_multi_draw_arrays { @Code( " if (piFirst.remaining() != piCount.remaining()) {\n" + Index: ARB_point_parameters.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_point_parameters.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_point_parameters.java 15 Feb 2005 17:05:55 -0000 1.2 +++ ARB_point_parameters.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.FloatBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_point_parameters { int GL_POINT_SIZE_MIN_ARB = 0x8126; Index: EXT_vertex_shader.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_vertex_shader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_vertex_shader.java 15 Feb 2005 17:06:02 -0000 1.2 +++ EXT_vertex_shader.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -37,7 +37,7 @@ import java.nio.IntBuffer; import java.nio.ShortBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_vertex_shader { int GL_VERTEX_SHADER_EXT = 0x8780; Index: GL13.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/GL13.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GL13.java 15 Feb 2005 17:06:12 -0000 1.2 +++ GL13.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -34,7 +34,7 @@ import java.nio.Buffer; import java.nio.FloatBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; /** * $Id$ Index: ATI_vertex_array_object.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_vertex_array_object.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_vertex_array_object.java 15 Feb 2005 17:05:59 -0000 1.2 +++ ATI_vertex_array_object.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -35,7 +35,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ATI_vertex_array_object { int GL_STATIC_ATI = 0x8760; Index: ATI_map_object_buffer.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_map_object_buffer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_map_object_buffer.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ATI_map_object_buffer.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.ByteBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ATI_map_object_buffer { /** Index: ATI_fragment_shader.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_fragment_shader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_fragment_shader.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ATI_fragment_shader.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -38,7 +38,7 @@ import java.nio.FloatBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ATI_fragment_shader { int GL_FRAGMENT_SHADER_ATI = 0x8920; Index: ARB_buffer_object.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ARB_buffer_object.java 15 Feb 2005 19:26:17 -0000 1.3 +++ ARB_buffer_object.java 20 Feb 2005 20:53:49 -0000 1.4 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; import java.nio.*; Index: ARB_texture_compression.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_texture_compression.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_texture_compression.java 15 Feb 2005 17:05:56 -0000 1.2 +++ ARB_texture_compression.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.Buffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_texture_compression { int GL_COMPRESSED_ALPHA_ARB = 0x84E9; Index: NV_evaluators.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_evaluators.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_evaluators.java 15 Feb 2005 17:06:14 -0000 1.2 +++ NV_evaluators.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -35,7 +35,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_evaluators { int GL_EVAL_2D_NV = 0x86C0; Index: ARB_occlusion_query.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_occlusion_query.java 15 Feb 2005 17:05:55 -0000 1.2 +++ ARB_occlusion_query.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_occlusion_query { /* Index: NV_point_sprite.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_point_sprite.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_point_sprite.java 15 Feb 2005 17:06:15 -0000 1.2 +++ NV_point_sprite.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_point_sprite { int GL_POINT_SPRITE_NV = 0x8861; Index: GL15.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/GL15.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GL15.java 15 Feb 2005 17:06:12 -0000 1.2 +++ GL15.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; import java.nio.*; Index: ARB_multitexture.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_multitexture.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_multitexture.java 15 Feb 2005 17:05:55 -0000 1.2 +++ ARB_multitexture.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_multitexture { int GL_TEXTURE0_ARB = 0x84C0; Index: EXT_vertex_weighting.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_vertex_weighting.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_vertex_weighting.java 15 Feb 2005 17:06:02 -0000 1.2 +++ EXT_vertex_weighting.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.Buffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_vertex_weighting { int GL_MODELVIEW0_STACK_DEPTH_EXT = 0x0BA3; Index: ATI_vertex_streams.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_vertex_streams.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_vertex_streams.java 15 Feb 2005 17:06:00 -0000 1.2 +++ ATI_vertex_streams.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ATI_vertex_streams { int GL_MAX_VERTEX_STREAMS_ATI = 0x876B; Index: ATI_vertex_attrib_array_object.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_vertex_attrib_array_object.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_vertex_attrib_array_object.java 15 Feb 2005 17:06:00 -0000 1.2 +++ ATI_vertex_attrib_array_object.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -34,7 +34,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ATI_vertex_attrib_array_object { void glVertexAttribArrayObjectATI(@GLuint int index, int size, @GLenum int type, boolean normalized, @GLsizei int stride, @GLuint int buffer, @GLuint int offset); Index: ARB_vertex_program.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_program.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_vertex_program.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ARB_vertex_program.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -36,7 +36,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_vertex_program extends ARB_program { /* Index: NV_occlusion_query.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_occlusion_query.java 15 Feb 2005 17:06:15 -0000 1.2 +++ NV_occlusion_query.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_occlusion_query { int GL_OCCLUSION_TEST_HP = 0x8165; Index: EXT_framebuffer_object.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_framebuffer_object.java 15 Feb 2005 17:06:00 -0000 1.2 +++ EXT_framebuffer_object.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; import java.nio.IntBuffer; Index: EXT_blend_func_separate.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_blend_func_separate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_blend_func_separate.java 15 Feb 2005 17:06:00 -0000 1.2 +++ EXT_blend_func_separate.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_blend_func_separate { int GL_BLEND_DST_RGB_EXT = 0x80C8; Index: NV_program.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_program.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_program.java 15 Feb 2005 17:06:15 -0000 1.2 +++ NV_program.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -35,7 +35,7 @@ import java.nio.ByteBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; @Extension(postfix="NV", isFinal=false) public interface NV_program { Index: EXT_stencil_two_side.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_stencil_two_side.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_stencil_two_side.java 15 Feb 2005 17:06:02 -0000 1.2 +++ EXT_stencil_two_side.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_stencil_two_side { int GL_STENCIL_TEST_TWO_SIDE_EXT = 0x8910; Index: EXT_point_parameters.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_point_parameters.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_point_parameters.java 15 Feb 2005 17:06:02 -0000 1.2 +++ EXT_point_parameters.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.FloatBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_point_parameters { int GL_POINT_SIZE_MIN_EXT = 0x8126; Index: ARB_imaging.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_imaging.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_imaging.java 15 Feb 2005 17:05:55 -0000 1.2 +++ ARB_imaging.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -35,7 +35,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; /** * $Id$ Index: GL12.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/GL12.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GL12.java 15 Feb 2005 17:06:11 -0000 1.2 +++ GL12.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.Buffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; /** * $Id$ Index: NV_fence.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_fence.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_fence.java 15 Feb 2005 17:06:14 -0000 1.2 +++ NV_fence.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_fence { int GL_ALL_COMPLETED_NV = 0x84F2; Index: ARB_transpose_matrix.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_transpose_matrix.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_transpose_matrix.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ARB_transpose_matrix.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.FloatBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_transpose_matrix { int GL_TRANSPOSE_MODELVIEW_MATRIX_ARB = 0x84E3; Index: ATI_envmap_bumpmap.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_envmap_bumpmap.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_envmap_bumpmap.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ATI_envmap_bumpmap.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -34,7 +34,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ATI_envmap_bumpmap { int GL_BUMP_ROT_MATRIX_ATI = 0x8775; Index: ARB_matrix_palette.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_matrix_palette.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_matrix_palette.java 15 Feb 2005 17:05:55 -0000 1.2 +++ ARB_matrix_palette.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -36,7 +36,7 @@ import java.nio.IntBuffer; import java.nio.ShortBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_matrix_palette { int GL_MATRIX_PALETTE_ARB = 0x8840; Index: ATI_element_array.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_element_array.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_element_array.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ATI_element_array.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.Buffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ATI_element_array { int GL_ELEMENT_ARRAY_ATI = 0x8768; Index: GL14.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/GL14.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GL14.java 15 Feb 2005 17:06:12 -0000 1.2 +++ GL14.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -35,7 +35,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; /** * $Id$ Index: EXT_texture_lod_bias.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_lod_bias.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_texture_lod_bias.java 15 Feb 2005 17:06:02 -0000 1.2 +++ EXT_texture_lod_bias.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; @Extension(postfix="EXT", className="EXTTextureLODBias") public interface EXT_texture_lod_bias { Index: ATI_separate_stencil.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_separate_stencil.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_separate_stencil.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ATI_separate_stencil.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ATI_separate_stencil { int GL_STENCIL_BACK_FUNC_ATI = 0x8800; Index: EXT_compiled_vertex_array.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_compiled_vertex_array.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_compiled_vertex_array.java 15 Feb 2005 17:06:00 -0000 1.2 +++ EXT_compiled_vertex_array.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_compiled_vertex_array { int GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = 0x81A8; Index: ARB_color_buffer_float.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_color_buffer_float.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ARB_color_buffer_float.java 16 Feb 2005 11:33:47 -0000 1.3 +++ ARB_color_buffer_float.java 20 Feb 2005 20:53:49 -0000 1.4 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_color_buffer_float { /* Index: NV_texture_compression_vtc.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_texture_compression_vtc.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_texture_compression_vtc.java 15 Feb 2005 17:06:16 -0000 1.2 +++ NV_texture_compression_vtc.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; @Extension(postfix="NV", className="NVTextureCompressionVTC") public interface NV_texture_compression_vtc { Index: NV_vertex_program.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_vertex_program.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_vertex_program.java 15 Feb 2005 17:06:16 -0000 1.2 +++ NV_vertex_program.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -38,7 +38,7 @@ import java.nio.IntBuffer; import java.nio.ShortBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_vertex_program extends NV_program { /* Index: NV_half_float.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_half_float.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_half_float.java 15 Feb 2005 17:06:14 -0000 1.2 +++ NV_half_float.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.ShortBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_half_float { /* Index: ATI_pn_triangles.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_pn_triangles.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_pn_triangles.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ATI_pn_triangles.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ATI_pn_triangles { int GL_PN_TRIANGLES_ATI = 0x87F0; Index: ARB_vertex_blend.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_blend.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_vertex_blend.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ARB_vertex_blend.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -37,7 +37,7 @@ import java.nio.IntBuffer; import java.nio.ShortBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_vertex_blend { int GL_MAX_VERTEX_UNITS_ARB = 0x86A4; Index: ATI_draw_buffers.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_draw_buffers.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ATI_draw_buffers.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ATI_draw_buffers { /* Index: EXT_paletted_texture.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_paletted_texture.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_paletted_texture.java 15 Feb 2005 17:06:00 -0000 1.2 +++ EXT_paletted_texture.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; import java.nio.*; Index: GL20.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/GL20.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GL20.java 15 Feb 2005 17:06:12 -0000 1.2 +++ GL20.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; import java.nio.*; Index: NV_pixel_data_range.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_pixel_data_range.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_pixel_data_range.java 15 Feb 2005 17:06:15 -0000 1.2 +++ NV_pixel_data_range.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.Buffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_pixel_data_range { /* Index: ARB_shader_objects.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_shader_objects.java 15 Feb 2005 17:05:56 -0000 1.2 +++ ARB_shader_objects.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -35,7 +35,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_shader_objects { /* Index: EXT_texture_compression_s3tc.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_compression_s3tc.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_texture_compression_s3tc.java 15 Feb 2005 17:06:02 -0000 1.2 +++ EXT_texture_compression_s3tc.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; @Extension(postfix="EXT", className="EXTTextureCompressionS3TC") public interface EXT_texture_compression_s3tc { Index: NV_register_combiners2.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_register_combiners2.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_register_combiners2.java 15 Feb 2005 17:06:15 -0000 1.2 +++ NV_register_combiners2.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.FloatBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_register_combiners2 { int GL_PER_STAGE_CONSTANTS_NV = 0x8535; Index: ARB_multisample.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_multisample.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_multisample.java 15 Feb 2005 17:05:55 -0000 1.2 +++ ARB_multisample.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_multisample { int GL_MULTISAMPLE_ARB = 0x809D; Index: ARB_vertex_shader.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_vertex_shader.java 15 Feb 2005 17:05:58 -0000 1.2 +++ ARB_vertex_shader.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -34,7 +34,7 @@ import java.nio.ByteBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface ARB_vertex_shader { /* Index: NV_vertex_array_range.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_vertex_array_range.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- NV_vertex_array_range.java 16 Feb 2005 16:04:29 -0000 1.3 +++ NV_vertex_array_range.java 20 Feb 2005 20:53:49 -0000 1.4 @@ -34,7 +34,7 @@ import java.nio.Buffer; import java.nio.ByteBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_vertex_array_range { int GL_VERTEX_ARRAY_RANGE_NV = 0x851D; Index: EXT_fog_coord.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_fog_coord.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_fog_coord.java 15 Feb 2005 17:06:00 -0000 1.2 +++ EXT_fog_coord.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.Buffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_fog_coord { int GL_FOG_COORDINATE_SOURCE_EXT = 0x8450; Index: GL11.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/GL11.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- GL11.java 15 Feb 2005 17:06:02 -0000 1.2 +++ GL11.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.*; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; /** * $Id$ Index: ATI_texture_compression_3dc.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ATI_texture_compression_3dc.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ATI_texture_compression_3dc.java 15 Feb 2005 17:05:59 -0000 1.2 +++ ATI_texture_compression_3dc.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; @Extension(postfix="ATI", className="ATITextureCompression3DC") public interface ATI_texture_compression_3dc { Index: ARB_draw_buffers.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_draw_buffers.java 15 Feb 2005 17:05:54 -0000 1.2 +++ ARB_draw_buffers.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -31,7 +31,7 @@ */ package org.lwjgl.opengl; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; import java.nio.IntBuffer; Index: ARB_program.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ARB_program.java 15 Feb 2005 17:05:56 -0000 1.2 +++ ARB_program.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -35,7 +35,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; @Extension(postfix="ARB", isFinal=false) public interface ARB_program { Index: NV_fragment_program.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/NV_fragment_program.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NV_fragment_program.java 15 Feb 2005 17:06:14 -0000 1.2 +++ NV_fragment_program.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -34,7 +34,7 @@ import java.nio.ByteBuffer; import java.nio.FloatBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface NV_fragment_program extends NV_program { /* Index: EXT_draw_range_elements.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/opengl/EXT_draw_range_elements.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- EXT_draw_range_elements.java 15 Feb 2005 17:06:00 -0000 1.2 +++ EXT_draw_range_elements.java 20 Feb 2005 20:53:49 -0000 1.3 @@ -33,7 +33,7 @@ import java.nio.Buffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; public interface EXT_draw_range_elements { int GL_MAX_ELEMENTS_VERTICES_EXT = 0x80E8; |
|
From: Caspian Rychlik-P. <ci...@us...> - 2005-02-20 20:54:02
|
Update of /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/openal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2287/src/templates/org/lwjgl/openal Modified Files: AL10.java Log Message: Refactored generator into util package Index: AL10.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/templates/org/lwjgl/openal/AL10.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AL10.java 15 Feb 2005 17:04:37 -0000 1.2 +++ AL10.java 20 Feb 2005 20:53:50 -0000 1.3 @@ -35,7 +35,7 @@ import java.nio.IntBuffer; import java.nio.FloatBuffer; -import org.lwjgl.generator.*; +import org.lwjgl.util.generator.*; /** * $Id$ |
|
From: Caspian Rychlik-P. <ci...@us...> - 2005-02-20 19:57:15
|
Update of /cvsroot/java-game-lib/LWJGL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19253 Modified Files: build.xml Log Message: Moved generator to util packages Index: build.xml =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/build.xml,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- build.xml 20 Feb 2005 11:24:14 -0000 1.64 +++ build.xml 20 Feb 2005 19:57:06 -0000 1.65 @@ -201,7 +201,7 @@ <!-- Compiles the Java source code --> <target name="generators" description="Compiles the native method generators"> - <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/generator/**.java" source="1.5" target="1.5" taskname="generator"> + <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator"> <compilerarg value="-Xlint:all"/> </javac> </target> @@ -213,14 +213,14 @@ <apply executable="apt" parallel="true"> <arg value="-nocompile"/> <arg value="-factory"/> - <arg value="org.lwjgl.generator.GeneratorProcessorFactory"/> + <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> <arg value="-cp"/> <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> <arg path="${lwjgl.src}/java"/> <arg value="-d"/> <arg path="${lwjgl.src.headers}"/> - <arg value="-Atypemap=org.lwjgl.generator.ALTypeMap"/> + <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/> <arg value="-Ageneratechecks"/> <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java"/> </apply> @@ -232,7 +232,7 @@ <apply executable="apt" parallel="true"> <arg value="-nocompile"/> <arg value="-factory"/> - <arg value="org.lwjgl.generator.GeneratorProcessorFactory"/> + <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> <arg value="-cp"/> <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> @@ -240,14 +240,14 @@ <arg value="-d"/> <arg path="${lwjgl.src.headers}"/> <arg value="-Acontextspecific"/> - <arg value="-Atypemap=org.lwjgl.generator.GLTypeMap"/> + <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/opengl/GL*.java"/> </apply> <!-- Generate ARB --> <apply executable="apt" parallel="true"> <arg value="-nocompile"/> <arg value="-factory"/> - <arg value="org.lwjgl.generator.GeneratorProcessorFactory"/> + <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> <arg value="-cp"/> <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> @@ -255,14 +255,14 @@ <arg value="-d"/> <arg path="${lwjgl.src.headers}/arb"/> <arg value="-Acontextspecific"/> - <arg value="-Atypemap=org.lwjgl.generator.GLTypeMap"/> + <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/opengl/ARB*.java"/> </apply> <!-- Generate ATI --> <apply executable="apt" parallel="true"> <arg value="-nocompile"/> <arg value="-factory"/> - <arg value="org.lwjgl.generator.GeneratorProcessorFactory"/> + <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> <arg value="-cp"/> <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> @@ -270,14 +270,14 @@ <arg value="-d"/> <arg path="${lwjgl.src.headers}/ati"/> <arg value="-Acontextspecific"/> - <arg value="-Atypemap=org.lwjgl.generator.GLTypeMap"/> + <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/opengl/ATI*.java"/> </apply> <!-- Generate EXT --> <apply executable="apt" parallel="true"> <arg value="-nocompile"/> <arg value="-factory"/> - <arg value="org.lwjgl.generator.GeneratorProcessorFactory"/> + <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> <arg value="-cp"/> <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> @@ -285,14 +285,14 @@ <arg value="-d"/> <arg path="${lwjgl.src.headers}/ext"/> <arg value="-Acontextspecific"/> - <arg value="-Atypemap=org.lwjgl.generator.GLTypeMap"/> + <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/opengl/EXT*.java"/> </apply> <!-- Generate NV --> <apply executable="apt" parallel="true"> <arg value="-nocompile"/> <arg value="-factory"/> - <arg value="org.lwjgl.generator.GeneratorProcessorFactory"/> + <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> <arg value="-cp"/> <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> @@ -300,14 +300,14 @@ <arg value="-d"/> <arg path="${lwjgl.src.headers}/nv"/> <arg value="-Acontextspecific"/> - <arg value="-Atypemap=org.lwjgl.generator.GLTypeMap"/> + <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/opengl/NV*.java"/> </apply> <!-- Generate HP --> <apply executable="apt" parallel="true"> <arg value="-nocompile"/> <arg value="-factory"/> - <arg value="org.lwjgl.generator.GeneratorProcessorFactory"/> + <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> <arg value="-cp"/> <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> @@ -315,14 +315,14 @@ <arg value="-d"/> <arg path="${lwjgl.src.headers}/hp"/> <arg value="-Acontextspecific"/> - <arg value="-Atypemap=org.lwjgl.generator.GLTypeMap"/> + <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/opengl/HP*.java"/> </apply> <!-- Generate IBM --> <apply executable="apt" parallel="true"> <arg value="-nocompile"/> <arg value="-factory"/> - <arg value="org.lwjgl.generator.GeneratorProcessorFactory"/> + <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> <arg value="-cp"/> <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> @@ -330,14 +330,14 @@ <arg value="-d"/> <arg path="${lwjgl.src.headers}/ibm"/> <arg value="-Acontextspecific"/> - <arg value="-Atypemap=org.lwjgl.generator.GLTypeMap"/> + <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/opengl/IBM*.java"/> </apply> <!-- Generate SUN --> <apply executable="apt" parallel="true"> <arg value="-nocompile"/> <arg value="-factory"/> - <arg value="org.lwjgl.generator.GeneratorProcessorFactory"/> + <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> <arg value="-cp"/> <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> @@ -345,7 +345,7 @@ <arg value="-d"/> <arg path="${lwjgl.src.headers}/sun"/> <arg value="-Acontextspecific"/> - <arg value="-Atypemap=org.lwjgl.generator.GLTypeMap"/> + <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/opengl/SUN*.java"/> </apply> </target> @@ -355,7 +355,7 @@ <apply executable="apt" parallel="true"> <arg value="-nocompile"/> <arg value="-factory"/> - <arg value="org.lwjgl.generator.ContextGeneratorProcessorFactory"/> + <arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/> <arg value="-cp"/> <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> <arg value="-s"/> |
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/generator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10196/src/java/org/lwjgl/util/generator Added Files: GeneratorVisitor.java GLbitfield.java RegisterStubsGenerator.java Mode.java ALint.java ALTypeMap.java JNITypeTranslator.java JavaTypeTranslator.java AutoResultSize.java GLenum.java Result.java StripPostfix.java ALenum.java Indirect.java GenerateAutos.java ALbyte.java PostfixTranslator.java Signedness.java ALboolean.java GLcharARB.java FieldsGenerator.java AutoSize.java Auto.java GLint.java ALuint.java Code.java Constant.java GLdouble.java NativeTypeTranslator.java GLintptr.java TypeInfo.java GeneratorProcessorFactory.java Extension.java ALubyte.java SignatureTranslator.java PlatformDependent.java GLintptrARB.java NativeMethodStubsGenerator.java TypedefsGenerator.java GLhalf.java GLclampd.java NativeType.java BufferObject.java GLshort.java NullTerminated.java GLboolean.java GLbyte.java GLubyte.java NoErrorCheck.java Utils.java Platform.java AutoType.java ALfloat.java GLhandleARB.java GLsizeiptr.java GLclampf.java ContextCapabilitiesGenerator.java JavaMethodsGenerator.java BufferKind.java CachedResult.java GLvoid.java GLchar.java GLsizeiptrARB.java GLushort.java ALvoid.java Const.java Check.java TypeMap.java GLfloat.java GLuint.java ALshort.java ALsizei.java ContextGeneratorProcessorFactory.java GLsizei.java GLTypeMap.java Log Message: Moved generator to util packages --- NEW FILE: Utils.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * $Id: Utils.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * Various utility methods to the generator. * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ import com.sun.mirror.type.*; import java.nio.Buffer; import java.io.*; import java.util.*; import com.sun.mirror.declaration.*; public class Utils { public static final String TYPEDEF_POSTFIX = "PROC"; public static final String FUNCTION_POINTER_VAR_NAME = "function_pointer"; public static final String FUNCTION_POINTER_POSTFIX = "_pointer"; public static final String CONTEXT_CAPS_CLASS_NAME = "ContextCapabilities"; public static final String STUB_INITIALIZER_NAME = "initNativeStubs"; public static final String BUFFER_OBJECT_METHOD_POSTFIX = "BO"; public static final String BUFFER_OBJECT_PARAMETER_POSTFIX = "_buffer_offset"; public static final String RESULT_SIZE_NAME = "result_size"; public static final String RESULT_VAR_NAME = "__result"; public static final String CACHED_BUFFER_NAME = "old_buffer"; private static final String OVERLOADED_METHOD_PREFIX = "n"; public static String getTypedefName(MethodDeclaration method) { return method.getSimpleName() + TYPEDEF_POSTFIX; } public static String getFunctionAddressName(InterfaceDeclaration interface_decl, MethodDeclaration method) { return interface_decl.getSimpleName() + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX; } public static boolean isFinal(InterfaceDeclaration d) { Extension extension_annotation = d.getAnnotation(Extension.class); return extension_annotation == null || extension_annotation.isFinal(); } private static class AnnotationMirrorComparator implements Comparator<AnnotationMirror> { public int compare(AnnotationMirror a1, AnnotationMirror a2) { String n1 = a1.getAnnotationType().getDeclaration().getQualifiedName(); String n2 = a2.getAnnotationType().getDeclaration().getQualifiedName(); int result = n1.compareTo(n2); return result; } public boolean equals(AnnotationMirror a1, AnnotationMirror a2) { return compare(a1, a2) == 0; } } public static Collection<AnnotationMirror> getSortedAnnotations(Collection<AnnotationMirror> annotations) { List<AnnotationMirror> annotation_list = new ArrayList<AnnotationMirror>(annotations); Collections.sort(annotation_list, new AnnotationMirrorComparator()); return annotation_list; } public static boolean isAddressableType(TypeMirror type) { return isAddressableType(getJavaType(type)); } public static boolean isAddressableType(Class type) { return Buffer.class.isAssignableFrom(type) || String.class.equals(type); } public static Class getJavaType(TypeMirror type_mirror) { JavaTypeTranslator translator = new JavaTypeTranslator(); type_mirror.accept(translator); return translator.getType(); } private static boolean hasParameterMultipleTypes(ParameterDeclaration param) { int num_native_annotations = 0; for (AnnotationMirror annotation : param.getAnnotationMirrors()) if (NativeTypeTranslator.getAnnotation(annotation, NativeType.class) != null) num_native_annotations++; return num_native_annotations > 1; } public static boolean isParameterMultiTyped(ParameterDeclaration param) { boolean result = Buffer.class.equals(Utils.getJavaType(param.getType())); if (!result && hasParameterMultipleTypes(param)) throw new RuntimeException(param + " not defined as java.nio.Buffer but has multiple types"); return result; } public static ParameterDeclaration findParameter(MethodDeclaration method, String name) { for (ParameterDeclaration param : method.getParameters()) if (param.getSimpleName().equals(name)) return param; throw new RuntimeException("Parameter " + name + " not found"); } public static void printDocComment(PrintWriter writer, Declaration decl) { String doc_comment = decl.getDocComment(); if (doc_comment != null) { writer.println("\t/**"); StringTokenizer doc_lines = new StringTokenizer(doc_comment, "\n"); while (doc_lines.hasMoreTokens()) writer.println("\t *" + doc_lines.nextToken()); writer.println("\t */"); } } public static ParameterDeclaration getAutoResultSizeParameter(MethodDeclaration method) { ParameterDeclaration result = null; for (ParameterDeclaration param : method.getParameters()) if (param.getAnnotation(AutoResultSize.class) != null) { if (result != null) throw new RuntimeException(method + " contains multiple AutoResultSize annotations"); result = param; } return result; } public static AnnotationMirror getParameterAutoAnnotation(ParameterDeclaration param) { for (AnnotationMirror annotation : param.getAnnotationMirrors()) if (NativeTypeTranslator.getAnnotation(annotation, Auto.class) != null) return annotation; return null; } public static boolean isMethodIndirect(boolean generate_error_checks, boolean context_specific, MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { if (isAddressableType(param.getType()) || getParameterAutoAnnotation(param) != null || param.getAnnotation(Constant.class) != null) return true; } return hasMethodBufferObjectParameter(method) || method.getAnnotation(Code.class) != null || method.getAnnotation(CachedResult.class) != null || (generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null) || context_specific; } public static String getNativeQualifiedName(String qualified_name) { return qualified_name.replaceAll("\\.", "_"); } public static String getQualifiedNativeMethodName(String qualified_class_name, String method_name) { return "Java_" + getNativeQualifiedName(qualified_class_name) + "_" + method_name; } public static String getQualifiedNativeMethodName(String qualified_class_name, MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { String method_name = getSimpleNativeMethodName(method, generate_error_checks, context_specific); return getQualifiedNativeMethodName(qualified_class_name, method_name); } public static ParameterDeclaration getResultParameter(MethodDeclaration method) { ParameterDeclaration result_param = null; for (ParameterDeclaration param : method.getParameters()) { if (param.getAnnotation(Result.class) != null) { if (result_param != null) throw new RuntimeException("Multiple parameters annotated with Result in method " + method); result_param = param; } } return result_param; } public static TypeMirror getMethodReturnType(MethodDeclaration method) { TypeMirror result_type; ParameterDeclaration result_param = getResultParameter(method); if (result_param != null) { result_type = result_param.getType(); } else result_type = method.getReturnType(); return result_type; } public static boolean needResultSize(MethodDeclaration method) { return getNIOBufferType(getMethodReturnType(method)) != null && getAutoResultSizeParameter(method) == null; } public static void printExtraCallArguments(PrintWriter writer, MethodDeclaration method, String size_parameter_name) { writer.print(size_parameter_name); if (method.getAnnotation(CachedResult.class) != null) { writer.print(", " + CACHED_BUFFER_NAME); } } private static String getClassName(InterfaceDeclaration interface_decl, String opengl_name) { Extension extension_annotation = interface_decl.getAnnotation(Extension.class); if (extension_annotation != null && !"".equals(extension_annotation.className())) { return extension_annotation.className(); } StringBuilder result = new StringBuilder(); for (int i = 0; i < opengl_name.length(); i++) { int ch = opengl_name.codePointAt(i); if (ch == '_') { i++; result.appendCodePoint(Character.toUpperCase(opengl_name.codePointAt(i))); } else result.appendCodePoint(ch); } return result.toString(); } public static boolean hasMethodBufferObjectParameter(MethodDeclaration method) { for (ParameterDeclaration param : method.getParameters()) { if (param.getAnnotation(BufferObject.class) != null) { return true; } } return false; } public static String getQualifiedClassName(InterfaceDeclaration interface_decl) { return interface_decl.getPackage().getQualifiedName() + "." + getSimpleClassName(interface_decl); } public static String getSimpleClassName(InterfaceDeclaration interface_decl) { return getClassName(interface_decl, interface_decl.getSimpleName()); } public static Class<?> getNIOBufferType(TypeMirror t) { Class<?> param_type = getJavaType(t); if (Buffer.class.isAssignableFrom(param_type)) return param_type; else return null; } public static String getSimpleNativeMethodName(MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { String method_name = method.getSimpleName(); if (isMethodIndirect(generate_error_checks, context_specific, method)) method_name = OVERLOADED_METHOD_PREFIX + method_name; return method_name; } } --- NEW FILE: GLubyte.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * $Id: GLubyte.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLubyte { } --- NEW FILE: GLsizei.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * $Id: GLsizei.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLsizei { } --- NEW FILE: GLsizeiptr.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * $Id: GLsizeiptr.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLsizeiptr { } --- NEW FILE: GLdouble.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * $Id: GLdouble.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLdouble { } --- NEW FILE: GLushort.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * $Id: GLushort.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLushort { } --- NEW FILE: GLint.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * $Id: GLint.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @NativeType @Target({ElementType.PARAMETER, ElementType.METHOD}) public @interface GLint { } --- NEW FILE: JavaMethodsGenerator.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * $Id: JavaMethodsGenerator.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * This class generates the methods in the generated java source files. * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ import com.sun.mirror.apt.*; import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import java.io.*; import java.util.*; import java.nio.*; public class JavaMethodsGenerator { public static void generateMethodsJava(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, boolean generate_error_checks, boolean context_specific) { for (MethodDeclaration method : interface_decl.getMethods()) generateMethodJava(env, type_map, writer, interface_decl, method, generate_error_checks, context_specific); } private static void generateMethodJava(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, boolean generate_error_checks, boolean context_specific) { writer.println(); if (Utils.isMethodIndirect(generate_error_checks, context_specific, method)) { if (method.getAnnotation(GenerateAutos.class) != null) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.AUTOS, generate_error_checks, context_specific); } Collection<Map<ParameterDeclaration, TypeInfo>> cross_product = TypeInfo.getTypeInfoCrossProduct(type_map, method); for (Map<ParameterDeclaration, TypeInfo> typeinfos_instance : cross_product) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, typeinfos_instance, Mode.NORMAL, generate_error_checks, context_specific); } } printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific); if (Utils.hasMethodBufferObjectParameter(method)) { printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific); printJavaNativeStub(writer, method, Mode.BUFFEROBJECT, generate_error_checks, context_specific); } } private static void printJavaNativeStub(PrintWriter writer, MethodDeclaration method, Mode mode, boolean generate_error_checks, boolean context_specific) { if (Utils.isMethodIndirect(generate_error_checks, context_specific, method)) { writer.print("\tprivate static native "); } else { Utils.printDocComment(writer, method); writer.print("\tpublic static native "); } printResultType(writer, method); writer.print(" " + Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); if (mode == Mode.BUFFEROBJECT) writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); writer.print("("); boolean first_parameter = generateParametersJava(writer, method, TypeInfo.getDefaultTypeInfoMap(method), true, mode); if (context_specific) { if (!first_parameter) writer.print(", "); writer.print("long " + Utils.FUNCTION_POINTER_VAR_NAME); } writer.println(");"); } private static boolean generateParametersJava(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, boolean native_stub, Mode mode) { boolean first_parameter = true; for (ParameterDeclaration param : method.getParameters()) { AnnotationMirror auto_annotation_mirror = Utils.getParameterAutoAnnotation(param); boolean hide_auto_parameter = mode == Mode.NORMAL && !native_stub && auto_annotation_mirror != null; if (hide_auto_parameter) { AutoType auto_type_annotation = param.getAnnotation(AutoType.class); if (auto_type_annotation != null) { ParameterDeclaration auto_parameter = Utils.findParameter(method, auto_type_annotation.value()); TypeInfo auto_param_type_info = typeinfos_instance.get(auto_parameter); if (auto_param_type_info.getSignedness() == Signedness.BOTH) { if (!first_parameter) writer.print(", "); first_parameter = false; writer.print("boolean " + TypeInfo.UNSIGNED_PARAMETER_NAME); } } } else if (param.getAnnotation(Result.class) == null && (native_stub || param.getAnnotation(Constant.class) == null) && (getAutoTypeParameter(method, param) == null || mode != Mode.AUTOS)) { TypeInfo type_info = typeinfos_instance.get(param); first_parameter = generateParameterJava(writer, param, type_info, native_stub, first_parameter, mode); } } TypeMirror result_type = Utils.getMethodReturnType(method); if ((native_stub && Utils.getNIOBufferType(result_type) != null) || Utils.needResultSize(method)) { if (!first_parameter) writer.print(", "); first_parameter = false; writer.print("int " + Utils.RESULT_SIZE_NAME); if (method.getAnnotation(CachedResult.class) != null) { writer.print(", "); printResultType(writer, method); writer.print(" " + Utils.CACHED_BUFFER_NAME); } } return first_parameter; } private static boolean generateParameterJava(PrintWriter writer, ParameterDeclaration param, TypeInfo type_info, boolean native_stub, boolean first_parameter, Mode mode) { Class buffer_type = Utils.getNIOBufferType(param.getType()); if (!first_parameter) writer.print(", "); BufferObject bo_annotation = param.getAnnotation(BufferObject.class); if (bo_annotation != null && mode == Mode.BUFFEROBJECT) { if (buffer_type == null) throw new RuntimeException("type of " + param + " is not a nio Buffer parameter but is annotated as buffer object"); writer.print("int " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX); } else { writer.print(type_info.getType().getSimpleName()); writer.print(" " + param.getSimpleName()); if (buffer_type != null && native_stub) writer.print(", int " + param.getSimpleName() + NativeMethodStubsGenerator.BUFFER_POSITION_POSTFIX); } return false; } private static void printBufferObjectCheck(PrintWriter writer, BufferKind kind, Mode mode) { String bo_check_method_name = kind.toString(); writer.print("\t\tGLBufferChecks.ensure" + bo_check_method_name); if (mode == Mode.BUFFEROBJECT) writer.print("enabled"); else writer.print("disabled"); writer.println("();"); } private static void printBufferObjectChecks(PrintWriter writer, MethodDeclaration method, Mode mode) { EnumSet<BufferKind> check_set = EnumSet.noneOf(BufferKind.class); for (ParameterDeclaration param : method.getParameters()) { BufferObject bo_annotation = param.getAnnotation(BufferObject.class); if (bo_annotation != null) check_set.add(bo_annotation.value()); } for (BufferKind kind : check_set) printBufferObjectCheck(writer, kind, mode); } private static void printMethodWithMultiType(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode, boolean generate_error_checks, boolean context_specific) { Utils.printDocComment(writer, method); writer.print("\tpublic static "); printResultType(writer, method); StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); String method_name = method.getSimpleName(); if (strip_annotation != null && mode == Mode.NORMAL) method_name = getPostfixStrippedName(type_map, interface_decl, method); writer.print(" " + method_name + "("); generateParametersJava(writer, method, typeinfos_instance, false, mode); TypeMirror result_type = Utils.getMethodReturnType(method); writer.println(") {"); printBufferObjectChecks(writer, method, mode); printParameterChecks(writer, method, mode); Code code_annotation = method.getAnnotation(Code.class); if (code_annotation != null) writer.println(code_annotation.value()); if (context_specific) { writer.print("\t\tlong " + Utils.FUNCTION_POINTER_VAR_NAME + " = GLContext.getCapabilities()."); writer.println(Utils.getFunctionAddressName(interface_decl, method) + ";"); writer.print("\t\tBufferChecks.checkFunctionAddress("); writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");"); } writer.print("\t\t"); boolean has_result = !result_type.equals(env.getTypeUtils().getVoidType()); if (has_result) { printResultType(writer, method); writer.print(" " + Utils.RESULT_VAR_NAME + " = "); } writer.print(Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); if (mode == Mode.BUFFEROBJECT) writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); writer.print("("); boolean first_parameter = printMethodCallArguments(writer, method, typeinfos_instance, mode); if (context_specific) { if (!first_parameter) writer.print(", "); writer.print(Utils.FUNCTION_POINTER_VAR_NAME); } writer.println(");"); if (generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null) writer.println("\t\t" + type_map.getErrorCheckMethodName() + ";"); if (has_result) writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ";"); writer.println("\t}"); } private static String getExtensionPostfix(InterfaceDeclaration interface_decl) { String interface_simple_name = interface_decl.getSimpleName(); Extension extension_annotation = interface_decl.getAnnotation(Extension.class); if (extension_annotation == null) { int underscore_index = interface_simple_name.indexOf("_"); if (underscore_index != -1) return interface_simple_name.substring(0, underscore_index); else return ""; } else return extension_annotation.postfix(); } private static ParameterDeclaration getAutoTypeParameter(MethodDeclaration method, ParameterDeclaration target_parameter) { for (ParameterDeclaration param : method.getParameters()) { AnnotationMirror auto_annotation = Utils.getParameterAutoAnnotation(param); if (auto_annotation != null) { Class annotation_type = NativeTypeTranslator.getClassFromType(auto_annotation.getAnnotationType()); String parameter_name; if (annotation_type.equals(AutoType.class)) parameter_name = param.getAnnotation(AutoType.class).value(); else if (annotation_type.equals(AutoSize.class)) parameter_name = param.getAnnotation(AutoSize.class).value(); else throw new RuntimeException("Unkown annotation type " + annotation_type); if (target_parameter.getSimpleName().equals(parameter_name)) return param; } } return null; } private static boolean hasAnyParameterAutoTypeAnnotation(MethodDeclaration method, ParameterDeclaration target_param) { for (ParameterDeclaration param : method.getParameters()) { AutoType auto_type_annotation = param.getAnnotation(AutoType.class); if (auto_type_annotation != null) { ParameterDeclaration type_target_param = Utils.findParameter(method, auto_type_annotation.value()); if (target_param.equals(type_target_param)) return true; } } return false; } private static String getPostfixStrippedName(TypeMap type_map, InterfaceDeclaration interface_decl, MethodDeclaration method) { StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class); ParameterDeclaration postfix_parameter = Utils.findParameter(method, strip_annotation.value()); PostfixTranslator translator = new PostfixTranslator(type_map, postfix_parameter); postfix_parameter.getType().accept(translator); String postfix = translator.getSignature(); String method_name = method.getSimpleName(); String extension_postfix = getExtensionPostfix(interface_decl); String result; if (method_name.endsWith(postfix + "v" + extension_postfix)) result = method_name.substring(0, method_name.length() - (postfix.length() + 1 + extension_postfix.length())); else if (method_name.endsWith(postfix + extension_postfix)) result = method_name.substring(0, method_name.length() - (postfix.length() + extension_postfix.length())); else if (method_name.endsWith("v" + extension_postfix)) result = method_name.substring(0, method_name.length() - (1 + extension_postfix.length())); else throw new RuntimeException(method + " is specified as being postfix stripped on parameter " + postfix_parameter + ", but it's postfix is not '" + postfix + "' nor 'v'"); return result + extension_postfix; } private static int getBufferElementSizeExponent(Class c) { if (IntBuffer.class.equals(c)) return 2; else if (LongBuffer.class.equals(c)) return 3; else if (DoubleBuffer.class.equals(c)) return 3; else if (ShortBuffer.class.equals(c)) return 1; else if (ByteBuffer.class.equals(c)) return 0; else if (FloatBuffer.class.equals(c)) return 2; else throw new RuntimeException(c + " is not allowed"); } private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode, boolean first_parameter) { if (!first_parameter) writer.print(", "); AnnotationMirror auto_annotation = Utils.getParameterAutoAnnotation(param); Constant constant_annotation = param.getAnnotation(Constant.class); if (constant_annotation != null) { writer.print(constant_annotation.value()); } else if (auto_annotation != null && mode == Mode.NORMAL) { Class param_type = NativeTypeTranslator.getClassFromType(auto_annotation.getAnnotationType()); if (AutoType.class.equals(param_type)) { AutoType auto_type_annotation = param.getAnnotation(AutoType.class); String auto_parameter_name = auto_type_annotation.value(); ParameterDeclaration auto_parameter = Utils.findParameter(method, auto_parameter_name); String auto_type = typeinfos_instance.get(auto_parameter).getAutoType(); if (auto_type == null) throw new RuntimeException("No auto type for parameter " + param.getSimpleName() + " in method " + method); writer.print(auto_type); } else if (AutoSize.class.equals(param_type)) { AutoSize auto_type_annotation = param.getAnnotation(AutoSize.class); String auto_parameter_name = auto_type_annotation.value(); ParameterDeclaration auto_target_param = Utils.findParameter(method, auto_parameter_name); TypeInfo auto_target_type_info = typeinfos_instance.get(auto_target_param); writer.print("(" + auto_parameter_name + ".remaining()"); // Shift the remaining if the target parameter is multityped and there's no AutoType to track type boolean shift_remaining = !hasAnyParameterAutoTypeAnnotation(method, auto_target_param) && Utils.isParameterMultiTyped(auto_target_param); if (shift_remaining) { int shifting = getBufferElementSizeExponent(auto_target_type_info.getType()); if (shifting > 0) writer.print(" << " + shifting); } writer.print(")"); writer.print(auto_type_annotation.expression()); } else throw new RuntimeException("Unknown auto annotation " + param_type); } else { if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) { writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX); } else { boolean hide_buffer = mode == Mode.AUTOS && getAutoTypeParameter(method, param) != null; if (hide_buffer) writer.print("null"); else writer.print(param.getSimpleName()); Class buffer_type = Utils.getNIOBufferType(param.getType()); if (buffer_type != null) { writer.print(", "); if (!hide_buffer) { TypeInfo type_info = typeinfos_instance.get(param); Check check_annotation = param.getAnnotation(Check.class); int shifting; if (Utils.getNIOBufferType(param.getType()).equals(Buffer.class)) shifting = getBufferElementSizeExponent(type_info.getType()); else shifting = 0; writer.print(param.getSimpleName()); if (check_annotation != null && check_annotation.canBeNull()) writer.print(" != null ? " + param.getSimpleName()); writer.print(".position()"); if (shifting > 0) writer.print(" << " + shifting); if (check_annotation != null && check_annotation.canBeNull()) writer.print(" : 0"); } else writer.print("0"); } } } return false; } private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode) { boolean first_parameter = true; for (ParameterDeclaration param : method.getParameters()) if (param.getAnnotation(Result.class) == null) { first_parameter = printMethodCallArgument(writer, method, param, typeinfos_instance, mode, first_parameter); } if (Utils.getNIOBufferType(Utils.getMethodReturnType(method)) != null) { if (!first_parameter) writer.print(", "); first_parameter = false; ParameterDeclaration auto_result_size_parameter = Utils.getAutoResultSizeParameter(method); String result_size_parameter_name; if (auto_result_size_parameter == null) result_size_parameter_name = Utils.RESULT_SIZE_NAME; else result_size_parameter_name = auto_result_size_parameter.getSimpleName(); Utils.printExtraCallArguments(writer, method, result_size_parameter_name); } return first_parameter; } private static void printParameterChecks(PrintWriter writer, MethodDeclaration method, Mode mode) { for (ParameterDeclaration param : method.getParameters()) { Class java_type = Utils.getJavaType(param.getType()); if (Utils.isAddressableType(java_type) && (mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) && (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) && param.getAnnotation(Result.class) == null) { String check_value = null; boolean can_be_null = false; Check check_annotation = param.getAnnotation(Check.class); if (check_annotation != null) { check_value = check_annotation.value(); can_be_null = check_annotation.canBeNull(); } boolean null_terminated = param.getAnnotation(NullTerminated.class) != null; if (Buffer.class.isAssignableFrom(java_type)) { printParameterCheck(writer, param.getSimpleName(), check_value, can_be_null, null_terminated); } else if (String.class.equals(java_type)) { if (!can_be_null) writer.println("\t\tBufferChecks.checkNotNull(" + param.getSimpleName() + ");"); } } } if (method.getAnnotation(CachedResult.class) != null) printParameterCheck(writer, Utils.CACHED_BUFFER_NAME, null, true, false); } private static void printParameterCheck(PrintWriter writer, String name, String check_value, boolean can_be_null, boolean null_terminated) { if (can_be_null) { writer.println("\t\tif (" + name + " != null)"); writer.print("\t"); } writer.print("\t\tBufferChecks.check"); if (check_value != null && !"".equals(check_value) ) { writer.print("Buffer(" + name + ", " + check_value); } else { writer.print("Direct"); writer.print("(" + name); } writer.println(");"); if (null_terminated) writer.println("\t\tBufferChecks.checkNullTerminated(" + name + ");"); } private static void printResultType(PrintWriter writer, MethodDeclaration method) { writer.print(Utils.getMethodReturnType(method).toString()); } } --- NEW FILE: GeneratorProcessorFactory.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import com.sun.mirror.apt.*; import com.sun.mirror.declaration.*; import java.util.Collection; import java.util.Set; import java.util.Map; import java.util.Arrays; import static java.util.Collections.*; import static com.sun.mirror.util.DeclarationVisitors.*; /** * $Id: GeneratorProcessorFactory.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * Generator tool for creating the java classes and native code * from an annotated template java interface. * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ public class GeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener { private static boolean first_round = true; // Process any set of annotations private static final Collection<String> supportedAnnotations = unmodifiableCollection(Arrays.asList("*")); private static final Collection<String> supportedOptions = unmodifiableCollection(Arrays.asList("-Atypemap", "-Ageneratechecks", "-Acontextspecific")); public Collection<String> supportedAnnotationTypes() { return supportedAnnotations; } public Collection<String> supportedOptions() { return supportedOptions; } public void roundComplete(RoundCompleteEvent event) { first_round = false; } public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) { // Only process the initial types, not the generated ones if (first_round) { env.addListener(this); return new GeneratorProcessor(env); } else return AnnotationProcessors.NO_OP; } private static class GeneratorProcessor implements AnnotationProcessor { private final AnnotationProcessorEnvironment env; GeneratorProcessor(AnnotationProcessorEnvironment env) { this.env = env; } public void process() { Map<String, String> options = env.getOptions(); String typemap_classname = null; boolean generate_error_checks = options.containsKey("-Ageneratechecks"); boolean context_specific = options.containsKey("-Acontextspecific"); for (String k : options.keySet()) { int delimiter = k.indexOf('='); if (delimiter != -1) { if (k.startsWith("-Atypemap")) { typemap_classname = k.substring(delimiter + 1); } } } if (typemap_classname == null) throw new RuntimeException("No TypeMap class name specified with -Atypemap=<class-name>"); try { TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance()); for (TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations()) { typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific), NO_OP)); } } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } } } --- NEW FILE: StripPostfix.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * $Id: StripPostfix.java,v 1.1 2005/02/20 19:28:31 cix_foo Exp $ * * This annotation implies that a method have its postfix stripped * according to a specified Buffer parameter. * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.METHOD) public @interface StripPostfix { String value(); // The parameter to deduce the postfix from } --- NEW FILE: Constant.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; /** * $Id: Constant.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ import java.lang.annotation.Target; import java.lang.annotation.ElementType; @Target(ElementType.PARAMETER) public @interface Constant { String value(); } --- NEW FILE: ContextGeneratorProcessorFactory.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.util.generator; import com.sun.mirror.apt.*; import com.sun.mirror.declaration.*; import com.sun.mirror.type.*; import com.sun.mirror.util.*; import java.util.Collection; import java.util.Collections; import java.util.Set; import java.util.Iterator; import java.util.Map; import java.util.Arrays; import java.io.PrintWriter; import java.io.IOException; import java.io.File; import static java.util.Collections.*; import static com.sun.mirror.util.DeclarationVisitors.*; /** * $Id: ContextGeneratorProcessorFactory.java,v 1.1 2005/02/20 19:28:32 cix_foo Exp $ * * Generator tool for creating the java classes and native code * from an annotated template java interface. * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ public class ContextGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener { private static boolean first_round = true; // Process any set of annotations private static final Collection<String> supportedAnnotations = unmodifiableCollection(Arrays.asList("*")); public Collection<String> supportedAnnotationTypes() { return supportedAnnotations; } public Collection<String> supportedOptions() { return unmodifiableCollection(Arrays.asList("-Acontextspecific")); } public void roundComplete(RoundCompleteEvent event) { first_round = false; } public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) { // Only process the initial types, not the generated ones if (first_round) { env.addListener(this); return new GeneratorProcessor(env); } else return AnnotationProcessors.NO_OP; } private static class GeneratorProcessor implements AnnotationProcessor { private final AnnotationProcessorEnvironment env; GeneratorProcessor(AnnotationProcessorEnvironment env) { this.env = env; } public void process() { Map<String, String> options = env.getOptions(); boolean context_specific = options.containsKey("-Acontextspecific"); try { generateContextCapabilitiesSource(context_specific); } catch (IOException e) { throw new RuntimeException(e); } } private void generateContextCapabilitiesSource(boolean context_specific) throws IOException { PrintWriter writer = env.getFiler().createSourceFile("org.lwjgl.opengl." + Utils.CONTEXT_CAPS_CLASS_NAME); writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */"); writer.println(); writer.println("package org.lwjgl.opengl;"); writer.println(); writer.println("import org.lwjgl.LWJGLException;"); writer.println("import java.util.Set;"); writer.println(); ContextCapabilitiesGenerator.generateClassPrologue(writer, context_specific); DeclarationFilter filter = DeclarationFilter.getFilter(InterfaceDeclaration.class); Collection<TypeDeclaration> interface_decls = filter.filter(env.getSpecifiedTypeDeclarations()); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; if (Utils.isFinal(interface_decl)) ContextCapabilitiesGenerator.generateField(writer, interface_decl); } writer.println(); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; ContextCapabilitiesGenerator.generateSymbolAddresses(writer, interface_decl); } writer.println(); if (context_specific) { for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; ContextCapabilitiesGenerator.generateAddressesInitializers(writer, interface_decl); } writer.println(); } ContextCapabilitiesGenerator.generateInitStubsPrologue(writer, context_specific); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; if (!Utils.isFinal(interface_decl)) ContextCapabilitiesGenerator.generateAddExtension(writer, interface_decl); } for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; String simple_name = interface_decl.getSimpleName(); if (simple_name.equals("GL11")) continue; ContextCapabilitiesGenerator.generateInitStubs(writer, interface_decl, context_specific); } ContextCapabilitiesGenerator.generateInitStubsEpilogue(writer, context_specific); writer.println(); writer.println("\tstatic void unloadAllStubs() {"); if (!context_specific) { writer.println("\t\tif (!loaded_stubs)"); writer.println("\t\t\treturn;"); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; ContextCapabilitiesGenerator.generateUnloadStubs(writer, interface_decl); } writer.println("\t\tloaded_stubs = false;"); } writer.println("\t}"); writer.println(); ContextCapabilitiesGenerator.generateInitializerPrologue(writer); for (TypeDeclaration typedecl : interface_decls) { InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl; if (Utils.isFinal(interface_decl)) ContextCapabilitiesGenerator.generateInitializer(writer, interface_decl); } writer.println("\t}"); writer.println("}"); writer.close(); } } } --- NEW FILE: GeneratorVisitor.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in s... [truncated message content] |
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/generator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10196/src/java/org/lwjgl/generator Removed Files: GLfloat.java GLvoid.java GLcharARB.java GLubyte.java Const.java ContextCapabilitiesGenerator.java BufferObject.java Auto.java GLTypeMap.java GLbyte.java GLshort.java JavaTypeTranslator.java GLclampf.java ALsizei.java ALvoid.java Code.java GLdouble.java AutoResultSize.java ALuint.java TypedefsGenerator.java RegisterStubsGenerator.java ALTypeMap.java Signedness.java Mode.java BufferKind.java AutoType.java Utils.java NativeTypeTranslator.java Platform.java GLuint.java CachedResult.java ALshort.java GLchar.java NullTerminated.java Extension.java GLsizeiptr.java GLhandleARB.java ALbyte.java JavaMethodsGenerator.java TypeMap.java Constant.java GLintptrARB.java NativeType.java Check.java ContextGeneratorProcessorFactory.java GLenum.java GenerateAutos.java GLushort.java TypeInfo.java SignatureTranslator.java GLboolean.java GLint.java GLsizeiptrARB.java GLbitfield.java AutoSize.java ALenum.java GeneratorVisitor.java GLhalf.java FieldsGenerator.java ALfloat.java NativeMethodStubsGenerator.java JNITypeTranslator.java GLintptr.java GeneratorProcessorFactory.java ALint.java StripPostfix.java PostfixTranslator.java Result.java ALubyte.java Indirect.java NoErrorCheck.java PlatformDependent.java GLclampd.java ALboolean.java GLsizei.java Log Message: Moved generator to util packages --- Utils.java DELETED --- --- GLubyte.java DELETED --- --- GLsizei.java DELETED --- --- GLsizeiptr.java DELETED --- --- GLdouble.java DELETED --- --- GLushort.java DELETED --- --- GLint.java DELETED --- --- JavaMethodsGenerator.java DELETED --- --- GeneratorProcessorFactory.java DELETED --- --- StripPostfix.java DELETED --- --- Constant.java DELETED --- --- ContextGeneratorProcessorFactory.java DELETED --- --- GeneratorVisitor.java DELETED --- --- AutoType.java DELETED --- --- BufferKind.java DELETED --- --- GLuint.java DELETED --- --- ALboolean.java DELETED --- --- GLvoid.java DELETED --- --- ALvoid.java DELETED --- --- GLintptrARB.java DELETED --- --- Result.java DELETED --- --- NativeMethodStubsGenerator.java DELETED --- --- GLenum.java DELETED --- --- JNITypeTranslator.java DELETED --- --- GLbitfield.java DELETED --- --- ALshort.java DELETED --- --- Indirect.java DELETED --- --- TypedefsGenerator.java DELETED --- --- Auto.java DELETED --- --- GLbyte.java DELETED --- --- GLcharARB.java DELETED --- --- NativeType.java DELETED --- --- NativeTypeTranslator.java DELETED --- --- JavaTypeTranslator.java DELETED --- --- GLclampd.java DELETED --- --- SignatureTranslator.java DELETED --- --- Mode.java DELETED --- --- NoErrorCheck.java DELETED --- --- GLshort.java DELETED --- --- Code.java DELETED --- --- Extension.java DELETED --- --- GLintptr.java DELETED --- --- NullTerminated.java DELETED --- --- ALint.java DELETED --- --- FieldsGenerator.java DELETED --- --- GenerateAutos.java DELETED --- --- ALfloat.java DELETED --- --- GLsizeiptrARB.java DELETED --- --- ALsizei.java DELETED --- --- Const.java DELETED --- --- GLfloat.java DELETED --- --- CachedResult.java DELETED --- --- Platform.java DELETED --- --- ContextCapabilitiesGenerator.java DELETED --- --- GLboolean.java DELETED --- --- AutoSize.java DELETED --- --- GLhandleARB.java DELETED --- --- GLclampf.java DELETED --- --- Signedness.java DELETED --- --- GLTypeMap.java DELETED --- --- GLchar.java DELETED --- --- RegisterStubsGenerator.java DELETED --- --- Check.java DELETED --- --- AutoResultSize.java DELETED --- --- GLhalf.java DELETED --- --- TypeMap.java DELETED --- --- PlatformDependent.java DELETED --- --- TypeInfo.java DELETED --- --- BufferObject.java DELETED --- --- ALuint.java DELETED --- --- ALTypeMap.java DELETED --- --- PostfixTranslator.java DELETED --- --- ALubyte.java DELETED --- --- ALbyte.java DELETED --- --- ALenum.java DELETED --- |
|
From: Caspian Rychlik-P. <ci...@us...> - 2005-02-20 19:28:27
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/generator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10147/src/java/org/lwjgl/util/generator Log Message: Directory /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/generator added to the repository |
|
From: Elias N. <eli...@us...> - 2005-02-20 12:55:46
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5058/src/native/common Modified Files: org_lwjgl_opengl_AWTSurfaceLock.c Log Message: Win32 compilation fixed to AWTSurfaceLock.c Index: org_lwjgl_opengl_AWTSurfaceLock.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_AWTSurfaceLock.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_opengl_AWTSurfaceLock.c 20 Feb 2005 11:24:21 -0000 1.1 +++ org_lwjgl_opengl_AWTSurfaceLock.c 20 Feb 2005 12:55:35 -0000 1.2 @@ -39,7 +39,9 @@ #include <jni.h> #include <jawt.h> +#ifndef _WIN32 #include <unistd.h> +#endif #include "org_lwjgl_opengl_AWTSurfaceLock.h" #include "awt_tools.h" #include "common_tools.h" @@ -48,14 +50,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_AWTSurfaceLock_lockAndInitHandle (JNIEnv *env, jclass clazz, jobject lock_buffer_handle, jobject canvas) { + JAWT awt; + JAWT_DrawingSurface* ds; + JAWT_DrawingSurfaceInfo *dsi; + AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); if ((*env)->GetDirectBufferCapacity(env, lock_buffer_handle) < sizeof(AWTSurfaceLock)) { throwException(env, "Lock handle buffer not large enough"); return; } - AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); - JAWT awt; - JAWT_DrawingSurface* ds; - JAWT_DrawingSurfaceInfo *dsi; awt.version = JAWT_VERSION_1_4; while (true) { if (JAWT_GetAWT(env, &awt) == JNI_FALSE) { |
|
From: Elias N. <eli...@us...> - 2005-02-20 12:31:51
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv765/src/java/org/lwjgl/opengl Modified Files: LinuxCanvasImplementation.java Log Message: Index: LinuxCanvasImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- LinuxCanvasImplementation.java 20 Feb 2005 12:24:02 -0000 1.3 +++ LinuxCanvasImplementation.java 20 Feb 2005 12:31:42 -0000 1.4 @@ -51,7 +51,7 @@ static int getScreenFromDevice(GraphicsDevice device) throws LWJGLException { try { Method getScreen_method = device.getClass().getMethod("getScreen", null); - Integer screen = (Integer)getScreen_method.invoke(null, null); + Integer screen = (Integer)getScreen_method.invoke(device, null); return screen.intValue(); } catch (Exception e) { throw new LWJGLException(e); @@ -61,7 +61,7 @@ private static int getVisualIDFromConfiguration(GraphicsConfiguration configuration) throws LWJGLException { try { Method getVisual_method = configuration.getClass().getMethod("getVisual", null); - Integer visual = (Integer)getVisual_method.invoke(null, null); + Integer visual = (Integer)getVisual_method.invoke(configuration, null); return visual.intValue(); } catch (Exception e) { throw new LWJGLException(e); |
|
From: Elias N. <eli...@us...> - 2005-02-20 12:24:11
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30179/src/java/org/lwjgl/opengl Modified Files: LinuxCanvasImplementation.java Log Message: Fixed reflection method names in LinuxCanvasImplementation.java Index: LinuxCanvasImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- LinuxCanvasImplementation.java 20 Feb 2005 12:05:19 -0000 1.2 +++ LinuxCanvasImplementation.java 20 Feb 2005 12:24:02 -0000 1.3 @@ -50,7 +50,7 @@ final class LinuxCanvasImplementation implements AWTCanvasImplementation { static int getScreenFromDevice(GraphicsDevice device) throws LWJGLException { try { - Method getScreen_method = device.getClass().getMethod("getScreen()", null); + Method getScreen_method = device.getClass().getMethod("getScreen", null); Integer screen = (Integer)getScreen_method.invoke(null, null); return screen.intValue(); } catch (Exception e) { @@ -60,7 +60,7 @@ private static int getVisualIDFromConfiguration(GraphicsConfiguration configuration) throws LWJGLException { try { - Method getVisual_method = configuration.getClass().getMethod("getVisual()", null); + Method getVisual_method = configuration.getClass().getMethod("getVisual", null); Integer visual = (Integer)getVisual_method.invoke(null, null); return visual.intValue(); } catch (Exception e) { |
|
From: Elias N. <eli...@us...> - 2005-02-20 12:05:29
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18964/src/java/org/lwjgl/opengl Modified Files: LinuxCanvasImplementation.java Log Message: Made Linux specific code use reflection to avoid compilation errors on other platforms Index: LinuxCanvasImplementation.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxCanvasImplementation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- LinuxCanvasImplementation.java 20 Feb 2005 11:24:17 -0000 1.1 +++ LinuxCanvasImplementation.java 20 Feb 2005 12:05:19 -0000 1.2 @@ -39,14 +39,7 @@ import java.awt.GraphicsDevice; import java.awt.GraphicsConfiguration; -/* - * Import the needed SUN specific classes. They - * are needed since there is no official way to access - * the screen and visual from GraphicsDevice and - * GraphicsConfiguration respectively. - */ -import sun.awt.X11GraphicsDevice; -import sun.awt.X11GraphicsConfig; +import java.lang.reflect.Method; /** * $Id$ @@ -55,14 +48,24 @@ * @version $Revision$ */ final class LinuxCanvasImplementation implements AWTCanvasImplementation { - static int getScreenFromDevice(GraphicsDevice device) { - X11GraphicsDevice x11_device = (X11GraphicsDevice)device; - return x11_device.getScreen(); + static int getScreenFromDevice(GraphicsDevice device) throws LWJGLException { + try { + Method getScreen_method = device.getClass().getMethod("getScreen()", null); + Integer screen = (Integer)getScreen_method.invoke(null, null); + return screen.intValue(); + } catch (Exception e) { + throw new LWJGLException(e); + } } - private static int getVisualIDFromConfiguration(GraphicsConfiguration configuration) { - X11GraphicsConfig x11_config = (X11GraphicsConfig)configuration; - return x11_config.getVisual(); + private static int getVisualIDFromConfiguration(GraphicsConfiguration configuration) throws LWJGLException { + try { + Method getVisual_method = configuration.getClass().getMethod("getVisual()", null); + Integer visual = (Integer)getVisual_method.invoke(null, null); + return visual.intValue(); + } catch (Exception e) { + throw new LWJGLException(e); + } } public PeerInfo createPeerInfo(AWTGLCanvas canvas) throws LWJGLException { @@ -75,7 +78,6 @@ * @return The GraphicsConfiguration corresponding to a visual that matches the pixel format. */ public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { - X11GraphicsDevice x11_device = (X11GraphicsDevice)device; int screen = getScreenFromDevice(device); int visual_id_matching_format = findVisualIDFromFormat(screen, pixel_format); GraphicsConfiguration[] configurations = device.getConfigurations(); |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:36:23
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13265/src/java/org/lwjgl/opengl Added Files: LinuxPbufferPeerInfo.java Log Message: Added missing file --- NEW FILE: LinuxPbufferPeerInfo.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: LinuxPbufferPeerInfo.java,v 1.1 2005/02/20 11:36:15 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class LinuxPbufferPeerInfo extends LinuxPeerInfo { public LinuxPbufferPeerInfo(int width, int height, PixelFormat pixel_format) throws LWJGLException { nInitHandle(getHandle(), width, height, pixel_format); } private static native void nInitHandle(ByteBuffer handle, int width, int height, PixelFormat pixel_format) throws LWJGLException; public void destroy() { nDestroy(getHandle()); } private static native void nDestroy(ByteBuffer handle); protected void doLockAndInitHandle() throws LWJGLException { // NO-OP } protected void doUnlock() throws LWJGLException { // NO-OP } } |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:25:02
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/test/opengl Modified Files: FullScreenWindowedTest.java PbufferTest.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: FullScreenWindowedTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/FullScreenWindowedTest.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- FullScreenWindowedTest.java 6 Jul 2004 16:08:17 -0000 1.34 +++ FullScreenWindowedTest.java 20 Feb 2005 11:24:19 -0000 1.35 @@ -233,7 +233,7 @@ * Minimum required bits per pixel * @return */ - private DisplayMode findDisplayMode(int width, int height, int bpp) { + private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException { DisplayMode[] modes = Display.getAvailableDisplayModes(); for (int i = 0; i < modes.length; i++) { if (modes[i].getWidth() == width && modes[i].getHeight() == height && modes[i].getBitsPerPixel() >= bpp && modes[i].getFrequency() <= 60) { Index: PbufferTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/PbufferTest.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- PbufferTest.java 18 Jan 2005 12:34:34 -0000 1.41 +++ PbufferTest.java 20 Feb 2005 11:24:19 -0000 1.42 @@ -341,7 +341,7 @@ * @param bpp Minimum required bits per pixel * @return */ - private DisplayMode findDisplayMode(int width, int height, int bpp) { + private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException { DisplayMode[] modes = Display.getAvailableDisplayModes(); for (int i = 0; i < modes.length; i++) { if (modes[i].getWidth() == width |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:25:01
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/test/opengl/pbuffers Modified Files: PbufferTest.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: PbufferTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- PbufferTest.java 18 Jan 2005 12:34:34 -0000 1.3 +++ PbufferTest.java 20 Feb 2005 11:24:20 -0000 1.4 @@ -345,7 +345,7 @@ * * @return */ - private DisplayMode findDisplayMode(int width, int height, int bpp) { + private DisplayMode findDisplayMode(int width, int height, int bpp) throws LWJGLException { DisplayMode[] modes = Display.getAvailableDisplayModes(); for ( int i = 0; i < modes.length; i++ ) { if ( modes[i].getWidth() == width |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:25:01
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/awt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/test/opengl/awt Modified Files: AWTTest.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: AWTTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/awt/AWTTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AWTTest.java 16 Feb 2005 13:31:46 -0000 1.1 +++ AWTTest.java 20 Feb 2005 11:24:20 -0000 1.2 @@ -5,9 +5,11 @@ package org.lwjgl.test.opengl.awt; import java.awt.Frame; +import java.awt.Graphics; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import org.lwjgl.LWJGLException; import org.lwjgl.opengl.AWTGLCanvas; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.glu.GLU; @@ -30,31 +32,54 @@ /** * C'tor */ - public AWTTest() { + public AWTTest() throws LWJGLException { setTitle("LWJGL AWT Canvas Test"); setSize(640, 320); setLayout(null); add(canvas0 = new AWTGLCanvas() { - protected void doPaint() { - GL11.glClearColor(0.0f, 0.0f, 1.0f, 1.0f); - GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); + public void paint(Graphics g) { + try { + makeCurrent(); + GL11.glViewport(0, 0, getWidth(), getHeight()); + GL11.glClearColor(1.0f, 0.0f, 0.0f, 1.0f); + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GLU.gluOrtho2D(0.0f, (float) getWidth(), 0.0f, (float) getHeight()); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPushMatrix(); + GL11.glColor3f(1f, 1f, 0f); + GL11.glTranslatef(getWidth() / 2.0f, getHeight() / 2.0f, 0.0f); + GL11.glRotatef(angle, 0f, 0f, 1.0f); + GL11.glRectf(-50.0f, -50.0f, 50.0f, 50.0f); + GL11.glPopMatrix(); + swapBuffers(); + } catch (LWJGLException e) { + throw new RuntimeException(e); + } } }); canvas0.setBounds(0, 0, 320, 320); add(canvas1 = new AWTGLCanvas() { - protected void doPaint() { - GL11.glViewport(0, 0, getWidth(), getHeight()); - GL11.glClearColor(1.0f, 0.0f, 0.0f, 1.0f); - GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); - GL11.glMatrixMode(GL11.GL_PROJECTION); - GL11.glLoadIdentity(); - GLU.gluOrtho2D(0.0f, (float) getWidth(), 0.0f, (float) getHeight()); - GL11.glMatrixMode(GL11.GL_MODELVIEW); - GL11.glPushMatrix(); - GL11.glTranslatef(getWidth() / 2.0f, getHeight() / 2.0f, 0.0f); - GL11.glRotatef(angle, 0f, 0f, 1.0f); - GL11.glRectf(-50.0f, -50.0f, 50.0f, 50.0f); - GL11.glPopMatrix(); + public void paint(Graphics g) { + try { + makeCurrent(); + GL11.glViewport(0, 0, getWidth(), getHeight()); + GL11.glClearColor(0.0f, 1.0f, 0.0f, 1.0f); + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GLU.gluOrtho2D(0.0f, (float) getWidth(), 0.0f, (float) getHeight()); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPushMatrix(); + GL11.glTranslatef(getWidth() / 2.0f, getHeight() / 2.0f, 0.0f); + GL11.glRotatef(2*angle, 0f, 0f, -1.0f); + GL11.glRectf(-50.0f, -50.0f, 50.0f, 50.0f); + GL11.glPopMatrix(); + swapBuffers(); + } catch (LWJGLException e) { + throw new RuntimeException(e); + } } }); canvas1.setBounds(320, 0, 320, 320); @@ -64,6 +89,7 @@ } }); setResizable(true); + setVisible(true); new Thread() { { @@ -72,6 +98,7 @@ public void run() { for (;;) { angle += 1.0f; + canvas0.repaint(); canvas1.repaint(); try { sleep(20); @@ -83,7 +110,7 @@ }.start(); } - public static void main(String[] args) { - new AWTTest().setVisible(true); + public static void main(String[] args) throws LWJGLException { + new AWTTest(); } } |
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/opengl Modified Files: AWTGLCanvas.java Display.java DisplayImplementation.java LinuxDisplay.java MacOSXDisplay.java Pbuffer.java Win32Display.java Added Files: AWTCanvasImplementation.java AWTSurfaceLock.java Context.java ContextImplementation.java Drawable.java LinuxAWTGLCanvasPeerInfo.java LinuxCanvasImplementation.java LinuxContextImplementation.java LinuxDisplayPeerInfo.java LinuxPeerInfo.java PeerInfo.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: Win32Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Win32Display.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Win32Display.java 18 Jan 2005 20:22:46 -0000 1.10 +++ Win32Display.java 20 Feb 2005 11:24:17 -0000 1.11 @@ -58,25 +58,29 @@ public native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException; public native String getAdapter(); public native String getVersion(); - public native DisplayMode init(); + public native DisplayMode init() throws LWJGLException; public native void setTitle(String title); public native boolean isCloseRequested(); public native boolean isVisible(); public native boolean isActive(); public native boolean isDirty(); - public native void swapBuffers(); - public native void makeCurrent() throws LWJGLException; - public native void createContext(PixelFormat pixel_format) throws LWJGLException; - public native void destroyContext(); +// public native void swapBuffers(); +// public native void makeCurrent() throws LWJGLException; + public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { + throw new RuntimeException("Not supported yet"); + } +// public native void createContext(PixelFormat pixel_format) throws LWJGLException; +// public native void destroyContext(); + public native void destroyPeerInfo(); public native void update(); public native void setVSyncEnabled(boolean sync); public native void reshape(int x, int y, int width, int height); - public native DisplayMode[] getAvailableDisplayModes(); + public native DisplayMode[] getAvailableDisplayModes() throws LWJGLException; /* Mouse */ public native boolean hasWheel(); public native int getButtonCount(); - public native void createMouse(); + public native void createMouse() throws LWJGLException; public native void destroyMouse(); public native void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons); public native int readMouse(IntBuffer buffer, int buffer_position); @@ -106,10 +110,17 @@ public native void destroyCursor(Object cursorHandle); public native int getPbufferCapabilities(); - public native boolean isBufferLost(ByteBuffer handle); - public native void makePbufferCurrent(ByteBuffer handle) throws LWJGLException; + public native boolean isBufferLost(PeerInfo handle); +// public native boolean isBufferLost(ByteBuffer handle); +// public native void makePbufferCurrent(ByteBuffer handle) throws LWJGLException; - public ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, + public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, + IntBuffer pixelFormatCaps, + IntBuffer pBufferAttribs) throws LWJGLException { + throw new RuntimeException("Not yet supported"); + } + +/* public ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException { ByteBuffer handle = BufferUtils.createByteBuffer(PBUFFER_HANDLE_SIZE); @@ -120,10 +131,14 @@ private native void nCreatePbuffer(ByteBuffer handle, int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException; +*/ + public native void destroyPbuffer(PeerInfo handle); +// public native void destroyPbuffer(ByteBuffer handle); - public native void destroyPbuffer(ByteBuffer handle); - - public native void setPbufferAttrib(ByteBuffer handle, int attrib, int value); + public native void setPbufferAttrib(PeerInfo handle, int attrib, int value); + public native void bindTexImageToPbuffer(PeerInfo handle, int buffer); + public native void releaseTexImageFromPbuffer(PeerInfo handle, int buffer); +/* public native void setPbufferAttrib(ByteBuffer handle, int attrib, int value); public native void bindTexImageToPbuffer(ByteBuffer handle, int buffer); - public native void releaseTexImageFromPbuffer(ByteBuffer handle, int buffer); + public native void releaseTexImageFromPbuffer(ByteBuffer handle, int buffer);*/ } --- NEW FILE: LinuxCanvasImplementation.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.BufferUtils; import java.awt.GraphicsDevice; import java.awt.GraphicsConfiguration; /* * Import the needed SUN specific classes. They * are needed since there is no official way to access * the screen and visual from GraphicsDevice and * GraphicsConfiguration respectively. */ import sun.awt.X11GraphicsDevice; import sun.awt.X11GraphicsConfig; /** * $Id: LinuxCanvasImplementation.java,v 1.1 2005/02/20 11:24:17 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class LinuxCanvasImplementation implements AWTCanvasImplementation { static int getScreenFromDevice(GraphicsDevice device) { X11GraphicsDevice x11_device = (X11GraphicsDevice)device; return x11_device.getScreen(); } private static int getVisualIDFromConfiguration(GraphicsConfiguration configuration) { X11GraphicsConfig x11_config = (X11GraphicsConfig)configuration; return x11_config.getVisual(); } public PeerInfo createPeerInfo(AWTGLCanvas canvas) throws LWJGLException { return new LinuxAWTGLCanvasPeerInfo(canvas); } /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. * * @return The GraphicsConfiguration corresponding to a visual that matches the pixel format. */ public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { X11GraphicsDevice x11_device = (X11GraphicsDevice)device; int screen = getScreenFromDevice(device); int visual_id_matching_format = findVisualIDFromFormat(screen, pixel_format); GraphicsConfiguration[] configurations = device.getConfigurations(); for (int i = 0; i < configurations.length; i++) { int visual_id = getVisualIDFromConfiguration(configurations[i]); if (visual_id == visual_id_matching_format) return configurations[i]; } throw new LWJGLException("Could not find the matching GraphicsConfiguration to visual id"); } private static int findVisualIDFromFormat(int screen, PixelFormat pixel_format) throws LWJGLException { try { LinuxDisplay.lockAWT(); try { GLContext.loadOpenGLLibrary(); try { LinuxDisplay.incDisplay(); return nFindVisualIDFromFormat(screen, pixel_format); } finally { LinuxDisplay.decDisplay(); } } finally { GLContext.unloadOpenGLLibrary(); } } finally { LinuxDisplay.unlockAWT(); } } private static native int nFindVisualIDFromFormat(int screen, PixelFormat pixel_format) throws LWJGLException; } --- NEW FILE: PeerInfo.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: PeerInfo.java,v 1.1 2005/02/20 11:24:17 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ abstract class PeerInfo { private final ByteBuffer handle; protected PeerInfo(ByteBuffer handle) { this.handle = handle; } private final void lockAndInitHandle() throws LWJGLException { doLockAndInitHandle(); } public synchronized final void unlock() throws LWJGLException { doUnlock(); } protected abstract void doLockAndInitHandle() throws LWJGLException; protected abstract void doUnlock() throws LWJGLException; public synchronized final ByteBuffer lockAndGetHandle() throws LWJGLException { lockAndInitHandle(); return getHandle(); } protected final ByteBuffer getHandle() { return handle; } } --- NEW FILE: AWTCanvasImplementation.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import java.awt.GraphicsDevice; import java.awt.GraphicsConfiguration; /** * $Id: AWTCanvasImplementation.java,v 1.1 2005/02/20 11:24:17 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ interface AWTCanvasImplementation { /** * Return an opaque handle to the canvas peer information required to create a context from it. */ public PeerInfo createPeerInfo(AWTGLCanvas canvas) throws LWJGLException; /** * Find a proper GraphicsConfiguration from the given GraphicsDevice and PixelFormat. * * @return A GraphicsConfiguration matching the given GraphicsConfiguration and PixelFormat. * @throws LWJGLException if no suitable configuration could be found. */ public GraphicsConfiguration findConfiguration(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException; } --- NEW FILE: Drawable.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; /** * The Drawable interface describes an OpenGL drawable with an associated * Context. * * @author elias_naur */ public interface Drawable { Context getContext(); } --- NEW FILE: LinuxAWTGLCanvasPeerInfo.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: LinuxAWTGLCanvasPeerInfo.java,v 1.1 2005/02/20 11:24:17 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class LinuxAWTGLCanvasPeerInfo extends LinuxPeerInfo { private final static int LOCK_HANDLE_SIZE = 64; private final ByteBuffer lock_buffer = BufferUtils.createByteBuffer(LOCK_HANDLE_SIZE); private final AWTGLCanvas canvas; private final AWTSurfaceLock awt_surface = new AWTSurfaceLock(); public LinuxAWTGLCanvasPeerInfo(AWTGLCanvas canvas) { this.canvas = canvas; } protected void doLockAndInitHandle() throws LWJGLException { int screen = LinuxCanvasImplementation.getScreenFromDevice(canvas.getGraphicsConfiguration().getDevice()); nInitHandle(screen, awt_surface.lockAndGetHandle(canvas), getHandle()); } private static native void nInitHandle(int screen, ByteBuffer surface_buffer, ByteBuffer peer_info_handle) throws LWJGLException; protected void doUnlock() throws LWJGLException { awt_surface.unlock(); } } Index: AWTGLCanvas.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/AWTGLCanvas.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AWTGLCanvas.java 16 Feb 2005 13:47:21 -0000 1.2 +++ AWTGLCanvas.java 20 Feb 2005 11:24:17 -0000 1.3 @@ -33,6 +33,8 @@ import java.awt.Canvas; import java.awt.Graphics; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; @@ -45,37 +47,88 @@ * @version $Revision$ * @author $Author$ */ -public class AWTGLCanvas extends Canvas { +public class AWTGLCanvas extends Canvas implements Drawable { + private final static AWTCanvasImplementation implementation; static { System.loadLibrary("jawt"); Sys.initialize(); + String class_name; + String OS_NAME = System.getProperty("os.name"); + if (OS_NAME.startsWith("Linux")) { + class_name = "org.lwjgl.opengl.LinuxCanvasImplementation"; + } else if (OS_NAME.startsWith("Windows")) { + class_name = "org.lwjgl.opengl.DefaultCanvasImplementation"; + } else if (OS_NAME.startsWith("Mac")) { + class_name = "org.lwjgl.opengl.DefaultCanvasImplementation"; + } else + throw new IllegalStateException("The platform " + OS_NAME + " is not supported"); + try { + Class impl_class = Class.forName(class_name); + implementation = (AWTCanvasImplementation)impl_class.newInstance(); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } catch (InstantiationException e) { + throw new RuntimeException(e); + } } /** The requested pixel format */ - private PixelFormat pixelFormat; + private final PeerInfo peer_info; + + /** The drawable to share context with */ + private final Drawable drawable; /** Context handle */ - private long context; + private Context context; + + /** + * This method should only be called internally. + */ + public Context getContext() { + return context; + } /** * Constructor using the default PixelFormat. */ - public AWTGLCanvas() { + public AWTGLCanvas() throws LWJGLException { this(new PixelFormat()); } /** - * Create an AWTGLCanvas with the requested PixelFormat. Construction is always - * successful, however, when the time comes to actually realise the component on the - * screen + * Create an AWTGLCanvas with the requested PixelFormat on the default GraphicsDevice. + * * @param pixelFormat The desired pixel format. May not be null + * @param device the device to create the canvas on. */ - public AWTGLCanvas(PixelFormat pixelFormat) { - if (pixelFormat == null) { - throw new IllegalArgumentException("Pixel format may not be null"); - } - this.pixelFormat = pixelFormat; + public AWTGLCanvas(PixelFormat pixel_format) throws LWJGLException { + this(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(), pixel_format); + } + + /** + * Create an AWTGLCanvas with the requested PixelFormat on the default GraphicsDevice. + * + * @param pixelFormat The desired pixel format. May not be null + * @param device the device to create the canvas on. + */ + public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format) throws LWJGLException { + this(device, pixel_format, null); + } + + /** + * Create an AWTGLCanvas with the requested PixelFormat on the specified GraphicsDevice. + * + * @param device the device to create the canvas on. + * @param pixelFormat The desired pixel format. May not be null + * @param shared_drawable The Drawable to share context with + */ + public AWTGLCanvas(GraphicsDevice device, PixelFormat pixel_format, Drawable drawable) throws LWJGLException { + super(implementation.findConfiguration(device, pixel_format)); + this.peer_info = implementation.createPeerInfo(this); + this.drawable = drawable; } /* (non-Javadoc) @@ -94,64 +147,74 @@ * @see java.awt.Component#removeNotify() */ public void removeNotify() { - super.removeNotify(); try { destroyContext(); } catch (LWJGLException e) { throw new RuntimeException(e); } + super.removeNotify(); } /** - * Create the OpenGL context. This occurs when the component becomes displayable - * @throws LWJGLException + * Enable vsync */ - private synchronized void createContext() throws LWJGLException { - nCreateContext(); + public synchronized void setVSyncEnabled(boolean enabled) throws LWJGLException { + if (context == null) + throw new IllegalStateException("Canvas not yet displayable"); + context.setVSync(enabled); } - private native void nCreateContext() throws LWJGLException; /** - * Destroy the OpenGL context. This occurs when the component is no longer displayable. + * Swap the canvas' buffer */ - private synchronized void destroyContext() throws LWJGLException { - nDestroyContext(); + public synchronized void swapBuffers() throws LWJGLException { + if (context == null) + throw new IllegalStateException("Canvas not yet displayable"); + context.swapBuffers(); } - private native void nDestroyContext() throws LWJGLException; - /* (non-Javadoc) - * @see java.awt.Canvas#paint(java.awt.Graphics) - */ - public synchronized final void paint(Graphics g) { - try { - nPaint(); - } catch (Exception e) { - throw new RuntimeException(e); - } + public synchronized void releaseContext() throws LWJGLException { + if (context == null) + throw new IllegalStateException("Canvas not yet displayable"); + if (context.isCurrent()) + Context.releaseCurrentContext(); } - private native void nPaint() throws Exception; - /** - * Paint callback from native code + * Make the canvas' context current. It is highly recommended that the context + * is only made current inside the AWT thread (for example in an overridden paint()). */ - private final void cPaint() { - try { - GLContext.useContext(this); - } catch (LWJGLException e) { - throw new RuntimeException(e); - } - doPaint(); + public synchronized void makeCurrent() throws LWJGLException { + if (context == null) + throw new IllegalStateException("Canvas not yet displayable"); + context.makeCurrent(); } /** - * Do painting. Override this method to call GL commands. + * Create the OpenGL context. This occurs when the component becomes displayable + * @throws LWJGLException */ - protected void doPaint() { + private synchronized void createContext() throws LWJGLException { + if (context == null) + context = new Context(peer_info, drawable != null ? drawable.getContext() : null); } - /* (non-Javadoc) - * @see java.awt.Canvas#update(java.awt.Graphics) + /** + * Destroy the OpenGL context. This happens when the component becomes undisplayable + */ + private synchronized void destroyContext() throws LWJGLException { + context.forceDestroy(); + context = null; + } + + /** + * Empty paint to avoid clearing + */ + public void paint(Graphics g) { + } + + /** + * override update to avoid clearing */ public void update(Graphics g) { paint(g); Index: MacOSXDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- MacOSXDisplay.java 22 Jan 2005 00:34:49 -0000 1.21 +++ MacOSXDisplay.java 20 Feb 2005 11:24:17 -0000 1.22 @@ -157,11 +157,11 @@ return new DisplayMode(awt_mode.getWidth(), awt_mode.getHeight(), bit_depth, refresh_rate); } - public DisplayMode init() { + public DisplayMode init() throws LWJGLException { return createLWJGLDisplayMode(MacOSXFrame.getDevice().getDisplayMode()); } - public DisplayMode[] getAvailableDisplayModes() { + public DisplayMode[] getAvailableDisplayModes() throws LWJGLException { java.awt.DisplayMode[] awt_modes = MacOSXFrame.getDevice().getDisplayModes(); List modes = new ArrayList(); for (int i = 0; i < awt_modes.length; i++) @@ -199,13 +199,17 @@ public native void setView(MacOSXGLCanvas canvas); - public native void swapBuffers(); +// public native void swapBuffers(); - public native void makeCurrent() throws LWJGLException; +// public native void makeCurrent() throws LWJGLException; - public native void createContext(PixelFormat pixel_format) throws LWJGLException; + public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLException { + throw new RuntimeException("Not supported yet"); + } +// public native void createContext(PixelFormat pixel_format) throws LWJGLException; - public native void destroyContext(); + public native void destroyPeerInfo(); +// public native void destroyContext(); public void update() { if (frame.syncShouldUpdateContext()) { @@ -251,7 +255,7 @@ return MouseEventQueue.NUM_BUTTONS; } - public void createMouse() { + public void createMouse() throws LWJGLException { MacOSXGLCanvas canvas = frame.getCanvas(); this.mouse_queue = new MouseEventQueue(canvas.getWidth(), canvas.getHeight()); canvas.addMouseListener(mouse_queue); @@ -409,13 +413,19 @@ } } - public boolean isBufferLost(ByteBuffer handle) { + public boolean isBufferLost(PeerInfo handle) { return false; } - public native void makePbufferCurrent(ByteBuffer handle) throws LWJGLException; +// public native void makePbufferCurrent(ByteBuffer handle) throws LWJGLException; - public ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, + public PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, + IntBuffer pixelFormatCaps, + IntBuffer pBufferAttribs) throws LWJGLException { + throw new RuntimeException("Not yet supported"); + } + +/* public ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException { ByteBuffer handle = BufferUtils.createByteBuffer(PBUFFER_HANDLE_SIZE); @@ -426,18 +436,19 @@ private native void nCreatePbuffer(ByteBuffer handle, int width, int height, PixelFormat pixel_format, IntBuffer pixelFormatCaps, IntBuffer pBufferAttribs, ByteBuffer shared_pbuffer_handle) throws LWJGLException; +*/ +// public native void destroyPbuffer(ByteBuffer handle); + public native void destroyPbuffer(PeerInfo handle); - public native void destroyPbuffer(ByteBuffer handle); - - public void setPbufferAttrib(ByteBuffer handle, int attrib, int value) { + public void setPbufferAttrib(PeerInfo handle, int attrib, int value) { throw new UnsupportedOperationException(); } - public void bindTexImageToPbuffer(ByteBuffer handle, int buffer) { + public void bindTexImageToPbuffer(PeerInfo handle, int buffer) { throw new UnsupportedOperationException(); } - public void releaseTexImageFromPbuffer(ByteBuffer handle, int buffer) { + public void releaseTexImageFromPbuffer(PeerInfo handle, int buffer) { throw new UnsupportedOperationException(); } } Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Display.java,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- Display.java 4 Feb 2005 12:00:24 -0000 1.43 +++ Display.java 20 Feb 2005 11:24:17 -0000 1.44 @@ -86,20 +86,41 @@ private static boolean vsync; /** A unique context object, so we can track different contexts between creates() and destroys() */ - private static Display context; + private static Context context; private static boolean window_created = false; static { Sys.initialize(); display_impl = createDisplayImplementation(); - current_mode = initial_mode = display_impl.init(); - Sys.log("Initial mode: " + initial_mode); - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - reset(); - } - }); + try { + current_mode = initial_mode = display_impl.init(); + Sys.log("Initial mode: " + initial_mode); + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + reset(); + } + }); + } catch (LWJGLException e) { + throw new RuntimeException(e); + } + } + + /** + * Fetch the Drawable from the Display. + * + * @return the Drawable corresponding to the Display context, or null it display is + * not created. + */ + public static Drawable getDrawable() { + if (context != null) { + return new Drawable() { + public Context getContext() { + return context; + } + }; + } else + return null; } private static DisplayImplementation createDisplayImplementation() { @@ -141,7 +162,7 @@ * * @return an array of all display modes the system reckons it can handle. */ - public static DisplayMode[] getAvailableDisplayModes() { + public static DisplayMode[] getAvailableDisplayModes() throws LWJGLException { DisplayMode[] unfilteredModes = display_impl.getAvailableDisplayModes(); if (unfilteredModes == null) { @@ -192,7 +213,7 @@ switchDisplayMode(); createWindow(); } catch (LWJGLException e) { - display_impl.destroyContext(); + destroyContext(); display_impl.resetDisplayMode(); throw e; } @@ -385,7 +406,7 @@ } createWindow(); } catch (LWJGLException e) { - display_impl.destroyContext(); + destroyContext(); display_impl.resetDisplayMode(); throw e; } @@ -483,7 +504,11 @@ // We paint only when the window is visible or dirty if (isVisible() || isDirty()) { Util.checkGLError(); - display_impl.swapBuffers(); + try { + context.swapBuffers(); + } catch (LWJGLException e) { + throw new RuntimeException(e); + } } processMessages(); @@ -505,8 +530,7 @@ public static void makeCurrent() throws LWJGLException { if (!isCreated()) throw new IllegalStateException("No window created to make current"); - display_impl.makeCurrent(); - GLContext.useContext(context); + context.makeCurrent(); } /** @@ -537,25 +561,35 @@ * @throws LWJGLException */ public static void create(PixelFormat pixel_format) throws LWJGLException { + create(pixel_format, null); + } + + /** + * Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed + * context are not supported on the platform, the display mode will be switched to the mode returned by + * getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context + * will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be + * created with the given parameters, a LWJGLException will be thrown. + * + * <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates. + * + * @param pixel_format Describes the minimum specifications the context must fulfill. + * @param shared_drawable The Drawable to share context with. + * @throws LWJGLException + */ + public static void create(PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLException { if (isCreated()) throw new IllegalStateException("Only one LWJGL context may be instantiated at any one time."); if (fullscreen) switchDisplayMode(); try { - GLContext.loadOpenGLLibrary(); + PeerInfo peer_info = display_impl.createPeerInfo(pixel_format); + context = new Context(peer_info, shared_drawable != null ? shared_drawable.getContext() : null); try { - display_impl.createContext(pixel_format); - try { - context = new Display(); - createWindow(); - initContext(); - } catch (LWJGLException e) { - display_impl.destroyContext(); - context = null; - throw e; - } + createWindow(); + initContext(); } catch (LWJGLException e) { - GLContext.unloadOpenGLLibrary(); + destroyContext(); throw e; } } catch (LWJGLException e) { @@ -617,16 +651,20 @@ } destroyWindow(); - display_impl.destroyContext(); - GLContext.unloadOpenGLLibrary(); - context = null; - x = y = -1; + destroyContext(); + x = y = -1; + reset(); + } + + private static void destroyContext() { try { - GLContext.useContext(null); + context.forceDestroy(); } catch (LWJGLException e) { - Sys.log("Failed to reset GLContext due to: " + e); + throw new RuntimeException(e); + } finally { + context = null; + display_impl.destroyPeerInfo(); } - reset(); } /* @@ -641,7 +679,7 @@ /** * @return the unique Display context (or null, if the Display has not been created) */ - public static Object getContext() { + public static Context getContext() { return context; } @@ -660,7 +698,7 @@ public static void setVSyncEnabled(boolean sync) { vsync = sync; if (isCreated()) - display_impl.setVSyncEnabled(vsync); + context.setVSync(vsync); } /** Index: Pbuffer.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Pbuffer.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- Pbuffer.java 22 Jan 2005 00:34:50 -0000 1.37 +++ Pbuffer.java 20 Feb 2005 11:24:17 -0000 1.38 @@ -41,14 +41,13 @@ * <p/> * Pbuffer encapsulates an OpenGL pbuffer. * <p/> - * Each instance of GL is only valid in the thread that creates it. In addition, only one instance of an OpenGL window or - * Pbuffer may be the current GL context in any one thread. To make a GL instance the current context, use makeCurrent(). + * + * This class is thread-safe. * * @author elias_naur <eli...@us...> * @version $Revision$ */ -public final class Pbuffer { - +public final class Pbuffer implements Drawable { /** * Indicates that Pbuffers can be created. */ @@ -137,7 +136,7 @@ /** * Handle to the native GL rendering context */ - private final ByteBuffer handle; + private final PeerInfo peer_info; /** * Width @@ -149,6 +148,10 @@ */ private final int height; + private final Context context; + + private boolean destroyed; + static { Sys.initialize(); } @@ -169,29 +172,40 @@ * @param height Pbuffer height * @param pixel_format Minimum Pbuffer context properties * @param renderTexture - * @param shared_context If non-null the Pbuffer will share display lists and textures with it. Otherwise, the Pbuffer will share + * @param shared_drawable If non-null the Pbuffer will share display lists and textures with it. Otherwise, the Pbuffer will share * with the Display context (if created). */ - public Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Pbuffer shared_context) throws LWJGLException { + public Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Drawable shared_drawable) throws LWJGLException { this.width = width; this.height = height; - this.handle = createPbuffer(width, height, pixel_format, renderTexture, shared_context != null ? shared_context.handle : null); + this.peer_info = createPbuffer(width, height, pixel_format, renderTexture); + Context shared_context = null; + if (shared_drawable != null) { + shared_context = shared_drawable.getContext(); + } else { + Drawable display_drawable = Display.getDrawable(); + if (display_drawable != null) + shared_context = display_drawable.getContext(); + } + this.context = new Context(peer_info, shared_context); } - private static ByteBuffer createPbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, ByteBuffer shared_context_handle) throws LWJGLException { - GLContext.loadOpenGLLibrary(); - try { - if ( renderTexture == null ) - return Display.getImplementation().createPbuffer(width, height, pixel_format, null, null, shared_context_handle); - else - return Display.getImplementation().createPbuffer(width, height, pixel_format, - renderTexture.pixelFormatCaps, - renderTexture.pBufferAttribs, - shared_context_handle); - } catch (LWJGLException e) { - GLContext.unloadOpenGLLibrary(); - throw e; - } + private static PeerInfo createPbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture) throws LWJGLException { + if ( renderTexture == null ) + return Display.getImplementation().createPbuffer(width, height, pixel_format, null, null); + else + return Display.getImplementation().createPbuffer(width, height, pixel_format, + renderTexture.pixelFormatCaps, + renderTexture.pBufferAttribs); + } + + public Context getContext() { + return context; + } + + private void checkDestroyed() { + if (destroyed) + throw new IllegalStateException("Pbuffer is destroyed"); } /** @@ -201,17 +215,18 @@ * * @return true if the buffer is lost and destroyed, false if the buffer is valid. */ - public boolean isBufferLost() { - return Display.getImplementation().isBufferLost(handle); + public synchronized boolean isBufferLost() { + checkDestroyed(); + return Display.getImplementation().isBufferLost(peer_info); } /** * Method to make the Pbuffer context current. All subsequent OpenGL calls will go to this buffer. * @throws LWJGLException if the context could not be made current */ - public void makeCurrent() throws LWJGLException { - Display.getImplementation().makePbufferCurrent(handle); - GLContext.useContext(this); + public synchronized void makeCurrent() throws LWJGLException { + checkDestroyed(); + context.makeCurrent(); } /** @@ -227,17 +242,15 @@ * Destroys the Pbuffer. After this call, there will be no valid GL rendering context - regardless of whether this Pbuffer was * the current rendering context or not. */ - public void destroy() { + public synchronized void destroy() { + if (destroyed) + return; try { - makeCurrent(); - int error = GL11.glGetError(); - Display.getImplementation().destroyPbuffer(handle); - GLContext.useContext(null); - GLContext.unloadOpenGLLibrary(); - if (error != GL11.GL_NO_ERROR) - throw new OpenGLException(error); + context.forceDestroy(); + Display.getImplementation().destroyPbuffer(peer_info); + destroyed = true; } catch (LWJGLException e) { - // ignore exception + Sys.log("Exception occurred while destroying pbuffer: " + e); } } @@ -257,8 +270,9 @@ * @param attrib * @param value */ - public void setAttrib(int attrib, int value) { - Display.getImplementation().setPbufferAttrib(handle, attrib, value); + public synchronized void setAttrib(int attrib, int value) { + checkDestroyed(); + Display.getImplementation().setPbufferAttrib(peer_info, attrib, value); } /** @@ -268,8 +282,9 @@ * * @param buffer */ - public void bindTexImage(int buffer) { - Display.getImplementation().bindTexImageToPbuffer(handle, buffer); + public synchronized void bindTexImage(int buffer) { + checkDestroyed(); + Display.getImplementation().bindTexImageToPbuffer(peer_info, buffer); } /** @@ -277,21 +292,24 @@ * * @param buffer */ - public void releaseTexImage(int buffer) { - Display.getImplementation().releaseTexImageFromPbuffer(handle, buffer); + public synchronized void releaseTexImage(int buffer) { + checkDestroyed(); + Display.getImplementation().releaseTexImageFromPbuffer(peer_info, buffer); } /** * @return Returns the height. */ - public int getHeight() { + public synchronized int getHeight() { + checkDestroyed(); return height; } /** * @return Returns the width. */ - public int getWidth() { + public synchronized int getWidth() { + checkDestroyed(); return width; } } --- NEW FILE: Context.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.Sys; /** * $Id: Context.java,v 1.1 2005/02/20 11:24:17 elias_naur Exp $ * <p/> * Context encapsulates an OpenGL context. * <p/> * * This class is thread-safe. * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class Context { /** * The platform specific implementation of context methods */ private final static ContextImplementation implementation; /** The current Context */ private final static ThreadLocal current_context_local = new ThreadLocal(); /** * Handle to the native GL rendering context */ private final ByteBuffer handle; private final PeerInfo peer_info; /** Whether the context has been destroyed */ private boolean destroyed; private boolean destroy_requested; /** The thread that has this context current, or null. */ private Thread thread; static { Sys.initialize(); String class_name; String OS_NAME = System.getProperty("os.name"); if (OS_NAME.startsWith("Linux")) { class_name = "org.lwjgl.opengl.LinuxContextImplementation"; } else if (OS_NAME.startsWith("Windows")) { class_name = "org.lwjgl.opengl.Win32ContextImplementation"; } else if (OS_NAME.startsWith("Mac")) { class_name = "org.lwjgl.opengl.MacOSXContextImplementation"; } else throw new IllegalStateException("The platform " + OS_NAME + " is not supported"); try { Class impl_class = Class.forName(class_name); implementation = (ContextImplementation)impl_class.newInstance(); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InstantiationException e) { throw new RuntimeException(e); } } PeerInfo getPeerInfo() { return peer_info; } static Context getCurrentContext() { return (Context)current_context_local.get(); } /** * Create a context with the specified peer info and shared context */ public Context(PeerInfo peer_info, Context shared_context) throws LWJGLException { Context context_lock = shared_context != null ? shared_context : this; // If shared_context is not null, synchronize on it to make sure it is not deleted // while this context is created. Otherwise, simply synchronize on ourself to avoid NPE synchronized (context_lock) { if (shared_context != null && shared_context.destroyed) throw new IllegalArgumentException("Shared context is destroyed"); GLContext.loadOpenGLLibrary(); try { this.peer_info = peer_info; this.handle = implementation.create(peer_info, shared_context != null ? shared_context.handle : null); } catch (LWJGLException e) { GLContext.unloadOpenGLLibrary(); throw e; } } } /** * Release the current context (if any). After this call, no context is current. */ public static void releaseCurrentContext() throws LWJGLException { Context current_context = getCurrentContext(); if (current_context != null) { implementation.releaseCurrentContext(); GLContext.useContext(null); current_context_local.set(null); synchronized (current_context) { current_context.thread = null; current_context.checkDestroy(); } } } /** * Swap the buffers on the current context. Only valid for double-buffered contexts */ public static void swapBuffers() throws LWJGLException { implementation.swapBuffers(); } private boolean canAccess() { return thread == null || Thread.currentThread() == thread; } private void checkAccess() { if (!canAccess()) throw new IllegalStateException("From thread " + Thread.currentThread() + ": " +thread + " already has the context current"); } /** * Make the context current */ public synchronized void makeCurrent() throws LWJGLException { checkAccess(); if (destroyed) throw new IllegalStateException("Context is destroyed"); thread = Thread.currentThread(); current_context_local.set(this); implementation.makeCurrent(peer_info, handle); GLContext.useContext(this); } /** * Query whether the context is current */ public synchronized boolean isCurrent() throws LWJGLException { if (destroyed) throw new IllegalStateException("Context is destroyed"); return implementation.isCurrent(handle); } private void checkDestroy() { if (!destroyed && destroy_requested) { try { implementation.destroy(peer_info, handle); destroyed = true; thread = null; GLContext.unloadOpenGLLibrary(); } catch (LWJGLException e) { Sys.log("Exception occurred while destroying context: " + e); } } } /** * Enable or disable vertical monitor synchronization. This call is a best-attempt at changing * the monitor vertical refresh synchronization of the context, and is not guaranteed to be successful. * @param sync true to synchronize; false to ignore synchronization */ public synchronized void setVSync(boolean enable) { implementation.setVSync(enable); } /** * Destroy the context. This method behaves the same as destroy() with the extra * requirement that the context must be either current to the current thread or not * current at all. */ public synchronized void forceDestroy() throws LWJGLException { checkAccess(); destroy(); } /** * Request destruction of the Context. If the context is current, no context will be current after this call. * The context is destroyed when no thread has it current. */ public synchronized void destroy() throws LWJGLException { if (destroyed) return; destroy_requested = true; boolean was_current = isCurrent(); int error = GL11.GL_NO_ERROR; if (was_current) { error = GL11.glGetError(); releaseCurrentContext(); } checkDestroy(); if (was_current && error != GL11.GL_NO_ERROR) throw new OpenGLException(error); } } --- NEW FILE: LinuxContextImplementation.java --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.opengl; import java.nio.ByteBuffer; import org.lwjgl.LWJGLException; import org.lwjgl.BufferUtils; /** * $Id: LinuxContextImplementation.java,v 1.1 2005/02/20 11:24:17 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ final class LinuxContextImplementation implements ContextImplementation { private final static int HANDLE_SIZE = 64; private static PeerInfo getCurrentPeerInfo() { return Context.getCurrentContext().getPeerInfo(); } public ByteBuffer create(PeerInfo peer_info, ByteBuffer shared_context_handle) throws LWJGLException { ByteBuffer handle = BufferUtils.createByteBuffer(HANDLE_SIZE); LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { nCreate(peer_handle, handle, shared_context_handle); return handle; } finally { peer_info.unlock(); } } finally { LinuxDisplay.unlockAWT(); } } private static native void nCreate(ByteBuffer peer_handle, ByteBuffer context_handle, ByteBuffer shared_context_handle) throws LWJGLException; public void swapBuffers() throws LWJGLException { PeerInfo current_peer_info = getCurrentPeerInfo(); if (current_peer_info == null) throw new IllegalStateException("No context is current"); LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); try { nSwapBuffers(peer_handle); } finally { current_peer_info.unlock(); } } finally { LinuxDisplay.unlockAWT(); } } private static native void nSwapBuffers(ByteBuffer peer_info_handle) throws LWJGLException; public void releaseCurrentContext() throws LWJGLException { PeerInfo current_peer_info = getCurrentPeerInfo(); if (current_peer_info == null) return; // No context is current LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = current_peer_info.lockAndGetHandle(); try { nReleaseCurrentContext(peer_handle); } finally { current_peer_info.unlock(); } } finally { LinuxDisplay.unlockAWT(); } } private static native void nReleaseCurrentContext(ByteBuffer peer_info_handle) throws LWJGLException; public void makeCurrent(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { nMakeCurrent(peer_handle, handle); } finally { peer_info.unlock(); } } finally { LinuxDisplay.unlockAWT(); } } private static native void nMakeCurrent(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException; public boolean isCurrent(ByteBuffer handle) throws LWJGLException { LinuxDisplay.lockAWT(); try { boolean result = nIsCurrent(handle); return result; } finally { LinuxDisplay.unlockAWT(); } } private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException; public void setVSync(boolean enabled) { LinuxDisplay.lockAWT(); nSetVSync(enabled); LinuxDisplay.unlockAWT(); } private static native void nSetVSync(boolean enabled); public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException { LinuxDisplay.lockAWT(); try { ByteBuffer peer_handle = peer_info.lockAndGetHandle(); try { nDestroy(peer_handle, handle); } finally { peer_info.unlock(); } } finally { LinuxDisplay.unlockAWT(); } } private static native void nDestroy(ByteBuffer peer_handle, ByteBuffer context_handle) throws LWJGLException; } Index: LinuxDisplay.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- LinuxDisplay.java 20 Jan 2005 22:51:26 -0000 1.14 +++ LinuxDisplay.java 20 Feb 2005 11:24:17 -0000 1.15 @@ -42,6 +42,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; +import org.lwjgl.Sys; import org.lwjgl.BufferUtils; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; @@ -51,41 +52,62 @@ private static final int PBUFFER_HANDLE_SIZE = 24; private static final int NUM_BUTTONS = 3; + private static PeerInfo peer_info; + /* Since Xlib is not guaranteed to be thread safe, we need a way to synchronize LWJGL - * Xlib calls with AWT Xlib calls. Fortunately, JAWT implements LockAWT and UnlockAWT(), to + * Xlib calls with AWT Xlib calls. Fortunately, JAWT implements LockAWT and UnlockAWT() to * do just that. */ - private native void lockAWT(); - private native void unlockAWT(); - + static native void lockAWT(); + static native void unlockAWT(); + + /** + * increment and decrement display usage. + */ + static native void incDisplay() throws LWJGLException; + static native void decDisplay(); + public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException { lockAWT(); - nCreateWindow(mode, fullscreen, x, y); - unlockAWT(); + try { + ByteBuffer handle = peer_info.lockAndGetHandle(); + try { + nCreateWindow(handle, mode, fullscreen, x, y); + } finally { + peer_info.unlock(); + } + } finally { + unlockAWT(); + } } - public native void nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException; - + private static native void nCreateWindow(ByteBuffer peer_info_handle, DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException; public void destroyWindow() { lockAWT(); nDestroyWindow(); unlockAWT(); } - public native void nDestroyWindow(); + private static native void nDestroyWindow(); public void switchDisplayMode(DisplayMode mode) throws LWJGLException { lockAWT(); - nSwitchDisplayMode(mode); - unlockAWT(); + try { + nSwitchDisplayMode(mode); + } finally { + unlockAWT(); + } } - public native void nSwitchDisplayMode(DisplayMode mode) throws LWJGLException; - + private static native void nSwitchDisplayMode(DisplayMode mode) throws LWJGLException; + public void resetDisplayMode() { lockAWT(); - nResetDisplayMode(); - unlockAWT(); + try { + nResetDisplayMode(); + } finally { + unlockAWT(); + } } - public native void nResetDisplayMode(); + private static native void nResetDisplayMode(); public int getGammaRampLength() { lockAWT(); @@ -93,126 +115,130 @@ unlockAWT(); return length; } - public native int nGetGammaRampLength(); - + private static native int nGetGammaRampLength(); + public void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException { lockAWT(); - nSetGammaRamp(gammaRamp); - unlockAWT(); + try { + nSetGammaRamp(gammaRamp); + } finally { + unlockAWT(); + } } - public native void nSetGammaRamp(FloatBuffer gammaRamp) throws LWJGLException; + private static native void nSetGammaRamp(FloatBuffer gammaRamp) throws LWJGLException; public String getAdapter() { return null; } - + public String getVersion() { return null; } - - public DisplayMode init() { + + public DisplayMode init() throws LWJGLException { lockAWT(); - DisplayMode mode = nInit(); - unlockAWT(); - return mode; + try { + DisplayMode mode = nInit(); + return mode; + } finally { + unlockAWT(); + } } - public native DisplayMode nInit(); + private static native DisplayMode nInit() throws LWJGLException; public void setTitle(String title) { lockAWT(); nSetTitle(title); unlockAWT(); } - public native void nSetTitle(String title); - + private static native void nSetTitle(String title); + public boolean isCloseRequested() { lockAWT(); boolean result = nIsCloseRequested(); unlockAWT(); return result; } - public native boolean nIsCloseRequested(); - + private static native boolean nIsCloseRequested(); + public boolean isVisible() { lockAWT(); boolean result = nIsVisible(); unlockAWT(); return result; } - public native boolean nIsVisible(); - + private static native boolean nIsVisible(); + public boolean isActive() { lockAWT(); boolean result = nIsActive(); unlockAWT(); return result; } - public native boolean nIsActive(); - + private static native boolean nIsActive(); + public boolean isDirty() { lockAWT(); boolean result = nIsDirty(); unlockAWT(); return result; } - public native boolean nIsDirty(); - - public void swapBuffers() { - lockAWT(); - nSwapBuffers(); - unlockAWT(); - } - public native void nSwapBuffers(); - - public void makeCurrent() throws LWJGLException { - lockAWT(); - nMakeCurrent(); - unlockAWT(); - } - public native void nMakeCurrent() throws LWJGLException; + private static native boolean nIsDirty(); - public void createContext(PixelFormat pixel_format) throws LWJGLException { + public PeerInfo createPeerInfo(PixelFormat pixel_format) throws LWJGLExcepti... [truncated message content] |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:24:59
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/test/input Modified Files: HWCursorTest.java KeyboardTest.java MouseCreationTest.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: MouseCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- MouseCreationTest.java 7 Dec 2004 21:54:43 -0000 1.34 +++ MouseCreationTest.java 20 Feb 2005 11:24:18 -0000 1.35 @@ -72,10 +72,10 @@ * Sets the display mode for fullscreen mode */ protected boolean setDisplayMode() { - // get modes - DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); - try { + // get modes + DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); + org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + 640, "height=" + 480, Index: HWCursorTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- HWCursorTest.java 18 Jan 2005 12:49:26 -0000 1.41 +++ HWCursorTest.java 20 Feb 2005 11:24:18 -0000 1.42 @@ -76,10 +76,10 @@ * Sets the display mode for fullscreen mode */ protected boolean setDisplayMode() { - // get modes - DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); - try { + // get modes + DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); + org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + 640, "height=" + 480, Index: KeyboardTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/KeyboardTest.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- KeyboardTest.java 10 Jan 2005 08:19:28 -0000 1.30 +++ KeyboardTest.java 20 Feb 2005 11:24:18 -0000 1.31 @@ -78,10 +78,10 @@ * Sets the display mode for fullscreen mode */ protected boolean setDisplayMode() { - // get modes - DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); - try { + // get modes + DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); + org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + 640, "height=" + 480, |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:24:59
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/test/openal Modified Files: BasicTest.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: BasicTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/BasicTest.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- BasicTest.java 22 Jul 2004 14:27:07 -0000 1.19 +++ BasicTest.java 20 Feb 2005 11:24:19 -0000 1.20 @@ -109,10 +109,10 @@ * Sets the display mode for fullscreen mode */ protected boolean setDisplayMode() { - // get modes - DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); - try { + // get modes + DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); + org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + 640, "height=" + 480, |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:24:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/test Modified Files: DisplayTest.java SysTest.java WindowCreationTest.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: DisplayTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/DisplayTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- DisplayTest.java 22 Sep 2004 18:42:16 -0000 1.6 +++ DisplayTest.java 20 Feb 2005 11:24:18 -0000 1.7 @@ -54,7 +54,7 @@ /** * Runs the tests */ - public void executeTest() { + public void executeTest() throws LWJGLException { currentTest(); queryModesTest(); setDisplayModeTest(); @@ -80,7 +80,7 @@ /** * Tests querying for modes */ - private void queryModesTest() { + private void queryModesTest() throws LWJGLException { DisplayMode[] modes = null; System.out.println("==== Test query ===="); @@ -109,7 +109,7 @@ /** * Tests setting display modes */ - private void setDisplayModeTest() { + private void setDisplayModeTest() throws LWJGLException { DisplayMode mode = null; DisplayMode[] modes = null; @@ -241,7 +241,7 @@ * * @param args ignored */ - public static void main(String[] args) { + public static void main(String[] args) throws LWJGLException { new DisplayTest().executeTest(); } } Index: SysTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/SysTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- SysTest.java 18 Jan 2005 19:22:40 -0000 1.6 +++ SysTest.java 20 Feb 2005 11:24:18 -0000 1.7 @@ -33,6 +33,7 @@ import org.lwjgl.opengl.Display; import org.lwjgl.Sys; +import org.lwjgl.LWJGLException; /** * $Id$ @@ -75,7 +76,11 @@ } // get some display modes, to force some debug info - Display.getAvailableDisplayModes(); + try { + Display.getAvailableDisplayModes(); + } catch (LWJGLException e) { + throw new RuntimeException(e); + } System.out.println("---- Test Debug ----\n"); } Index: WindowCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/WindowCreationTest.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- WindowCreationTest.java 27 Dec 2004 21:39:30 -0000 1.26 +++ WindowCreationTest.java 20 Feb 2005 11:24:18 -0000 1.27 @@ -50,7 +50,7 @@ * * @param args ignored params to app */ - public static void main(String[] args) { + public static void main(String[] args) throws LWJGLException { // get avaialble modes, and print out DisplayMode[] modes = Display.getAvailableDisplayModes(); System.out.println("Found " + modes.length + " display modes"); @@ -138,10 +138,10 @@ * Sets the display mode for fullscreen mode */ protected static boolean setDisplayMode() { - // get modes - DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); - try { + // get modes + DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 60); + org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + 640, "height=" + 480, |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:24:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples/spaceinvaders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/examples/spaceinvaders Modified Files: Game.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: Game.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/Game.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Game.java 18 Jan 2005 15:31:58 -0000 1.5 +++ Game.java 20 Feb 2005 11:24:15 -0000 1.6 @@ -272,10 +272,10 @@ * Sets the display mode for fullscreen mode */ private boolean setDisplayMode() { - // get modes - DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(width, height, -1, -1, -1, -1, 60, 60); - try { + // get modes + DisplayMode[] dm = org.lwjgl.util.Display.getAvailableDisplayModes(width, height, -1, -1, -1, -1, 60, 60); + org.lwjgl.util.Display.setDisplayMode(dm, new String[] { "width=" + width, "height=" + height, |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:24:56
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/input Modified Files: Cursor.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: Cursor.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Cursor.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- Cursor.java 18 Jan 2005 12:34:32 -0000 1.33 +++ Cursor.java 20 Feb 2005 11:24:16 -0000 1.34 @@ -64,6 +64,8 @@ /** Index into list of cursors */ private int index = 0; + + private boolean destroyed; /** * Constructs a new Cursor, with the given parameters. Mouse must have been created before you can create @@ -219,15 +221,23 @@ * Gets the native handle associated with the cursor object. */ Object getHandle() { + checkValid(); return cursors[index].cursorHandle; } + private void checkValid() { + if (destroyed) + throw new IllegalStateException("The cursor is destroyed"); + } + /** * Destroy the native cursor. If the cursor is current, * the current native cursor is set to null (the default * OS cursor) */ public void destroy() { + if (destroyed) + return; if (Mouse.getNativeCursor() == this) { try { Mouse.setNativeCursor(null); @@ -238,12 +248,14 @@ for(int i=0; i<cursors.length; i++) { Display.getImplementation().destroyCursor(cursors[i].cursorHandle); } + destroyed = true; } /** * Sets the timout property to the time it should be changed */ protected void setTimeout() { + checkValid(); cursors[index].timeout = System.currentTimeMillis() + cursors[index].delay; } @@ -252,6 +264,7 @@ * @return true if the this cursor has timed out, false if not */ protected boolean hasTimedOut() { + checkValid(); return cursors.length > 1 && cursors[index].timeout < System.currentTimeMillis(); } @@ -259,6 +272,7 @@ * Changes to the next cursor */ protected void nextCursor() { + checkValid(); index = ++index % cursors.length; } |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:24:55
|
Update of /cvsroot/java-game-lib/LWJGL In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507 Modified Files: build.xml Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: build.xml =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/build.xml,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- build.xml 16 Feb 2005 16:04:17 -0000 1.63 +++ build.xml 20 Feb 2005 11:24:14 -0000 1.64 @@ -559,6 +559,11 @@ <!-- platform specific classes --> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes"> <class name="org.lwjgl.opengl.LinuxDisplay" /> + <class name="org.lwjgl.opengl.LinuxPbufferPeerInfo" /> + <class name="org.lwjgl.opengl.LinuxDisplayPeerInfo" /> + <class name="org.lwjgl.opengl.LinuxAWTGLCanvasPeerInfo" /> + <class name="org.lwjgl.opengl.LinuxContextImplementation" /> + <class name="org.lwjgl.opengl.LinuxCanvasImplementation" /> </javah> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/win32" force="yes"> <class name="org.lwjgl.opengl.Win32Display" /> @@ -569,6 +574,7 @@ </javah> <!-- lwjgl --> <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}" force="yes"> + <class name="org.lwjgl.opengl.AWTSurfaceLock" /> <class name="org.lwjgl.DefaultSysImplementation" /> <class name="org.lwjgl.input.Cursor" /> <class name="org.lwjgl.input.Keyboard" /> @@ -577,7 +583,6 @@ <class name="org.lwjgl.openal.ALC" /> <class name="org.lwjgl.openal.AL" /> - <class name="org.lwjgl.opengl.AWTGLCanvas" /> <class name="org.lwjgl.opengl.GLContext" /> <class name="org.lwjgl.opengl.Pbuffer" /> </javah> |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:24:34
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/native/linux Modified Files: Window.h org_lwjgl_input_Cursor.c org_lwjgl_input_Keyboard.c org_lwjgl_input_Mouse.c org_lwjgl_opengl_Display.c org_lwjgl_opengl_Pbuffer.c Added Files: context.c context.h org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c org_lwjgl_opengl_LinuxCanvasImplementation.c org_lwjgl_opengl_LinuxContextImplementation.c Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) --- NEW FILE: context.h --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: context.h,v 1.1 2005/02/20 11:24:22 elias_naur Exp $ * * Include file to access public window features * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #ifndef _LWJGL_CONTEXT_H_INCLUDED_ #define _LWJGL_CONTEXT_H_INCLUDED_ #include <jni.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include "extgl_glx.h" typedef struct { VisualID visualid; int depth; } GLXConfig; typedef struct { GLXFBConfigID config_id; } GLX13Config; typedef struct { Display *display; int screen; GLXDrawable drawable; // This flag determines the appropriate glx struct bool glx13; union { GLXConfig glx_config; GLX13Config glx13_config; } config; } X11PeerInfo; /* GLX 1.3 chooser */ extern GLXFBConfig *chooseVisualGLX13(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer); /* Default GLX chooser*/ extern XVisualInfo *chooseVisualGLX(JNIEnv *env, Display *disp, int screen, jobject pixel_format, bool use_display_bpp, bool double_buffer); extern XVisualInfo *getVisualInfoFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info); extern GLXFBConfig *getFBConfigFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info); extern bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int screen, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffered, bool force_glx13); #endif /* _LWJGL_CONTEXT_H_INCLUDED_ */ --- NEW FILE: org_lwjgl_opengl_LinuxCanvasImplementation.c --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_LinuxCanvasImplementation.c,v 1.1 2005/02/20 11:24:22 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <jni.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include "org_lwjgl_opengl_LinuxCanvasImplementation.h" #include "extgl_glx.h" #include "context.h" #include "Window.h" JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxCanvasImplementation_nFindVisualIDFromFormat (JNIEnv *env, jclass clazz, jint screen, jobject pixel_format) { if (!extgl_InitGLX(env, getDisplay(), screen)) { throwException(env, "Could not initialize GLX"); return -1; } XVisualInfo *vis_info = chooseVisualGLX(env, getDisplay(), screen, pixel_format, true, true); if (vis_info == NULL) { throwException(env, "Could not choose a VisualInfo"); return -1; } VisualID vis_id = vis_info->visualid; XFree(vis_info); return vis_id; } --- NEW FILE: org_lwjgl_opengl_LinuxContextImplementation.c --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_LinuxContextImplementation.c,v 1.1 2005/02/20 11:24:22 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <jni.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include "org_lwjgl_opengl_LinuxContextImplementation.h" #include "extgl_glx.h" #include "context.h" #include "common_tools.h" #include "Window.h" typedef struct { bool glx13; GLXContext context; } X11Context; static bool checkContext(JNIEnv *env, Display *display, GLXContext context) { if (context == NULL) { throwException(env, "Could not create GLX context"); return false; } jboolean allow_software_acceleration = getBooleanProperty(env, "org.lwjgl.opengl.Display.allowSoftwareOpenGL"); if (!allow_software_acceleration && glXIsDirect(display, context) == False) { glXDestroyContext(display, context); throwException(env, "Could not create a direct GLX context"); return false; } return true; } static void createContextGLX13(JNIEnv *env, X11PeerInfo *peer_info, X11Context *context_info, GLXContext shared_context) { GLXFBConfig *config = getFBConfigFromPeerInfo(env, peer_info); if (config == NULL) return; GLXContext context = glXCreateNewContext(peer_info->display, *config, GLX_RGBA_TYPE, shared_context, True); XFree(config); if (!checkContext(env, peer_info->display, context)) return; context_info->glx13 = true; context_info->context = context; } static void createContextGLX(JNIEnv *env, X11PeerInfo *peer_info, X11Context *context_info, GLXContext shared_context) { XVisualInfo *vis_info = getVisualInfoFromPeerInfo(env, peer_info); if (vis_info == NULL) return; GLXContext context = glXCreateContext(peer_info->display, vis_info, shared_context, True); XFree(vis_info); if (!checkContext(env, peer_info->display, context)) return; context_info->glx13 = false; context_info->context = context; } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSetVSync (JNIEnv *env, jclass clazz, jboolean sync) { if (extension_flags.GLX_SGI_swap_control) { int interval = sync == JNI_TRUE ? 1 : 0; glXSwapIntervalSGI(interval); } } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nCreate (JNIEnv *env , jclass clazz, jobject peer_handle, jobject context_handle, jobject shared_context_handle) { if ((*env)->GetDirectBufferCapacity(env, context_handle) < sizeof(X11Context)) { throwException(env, "Handle buffer not large enough"); return; } X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); if (!extgl_InitGLX(env, peer_info->display, peer_info->screen)) { throwException(env, "Could not initialize GLX"); return; } GLXContext shared_context = NULL; if (shared_context_handle != NULL) { X11Context *shared_context_info = (*env)->GetDirectBufferAddress(env, shared_context_handle); shared_context = shared_context_info->context; } if (peer_info->glx13) { createContextGLX13(env, peer_info, context_info, shared_context); } else { createContextGLX(env, peer_info, context_info, shared_context); } } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nDestroy (JNIEnv *env, jclass clazz, jobject peer_handle, jobject context_handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); glXDestroyContext(peer_info->display, context_info->context); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nReleaseCurrentContext (JNIEnv *env , jclass clazz, jobject peer_info_handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); Bool result; if (extension_flags.GLX13) { result = glXMakeContextCurrent(peer_info->display, None, None, NULL); } else { result = glXMakeCurrent(peer_info->display, None, NULL); } if (!result) throwException(env, "Could not release current context"); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nMakeCurrent (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); Bool result; if (context_info->glx13) { result = glXMakeContextCurrent(peer_info->display, peer_info->drawable, peer_info->drawable, context_info->context); } else { result = glXMakeCurrent(peer_info->display, peer_info->drawable, context_info->context); } if (!result) throwException(env, "Could not make context current"); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nIsCurrent (JNIEnv *env, jclass clazz, jobject context_handle) { X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); return context_info->context == glXGetCurrentContext(); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSwapBuffers (JNIEnv *env, jclass clazz, jobject peer_info_handle) { X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); glXSwapBuffers(peer_info->display, peer_info->drawable); } Index: org_lwjgl_input_Mouse.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- org_lwjgl_input_Mouse.c 18 Jan 2005 17:25:34 -0000 1.33 +++ org_lwjgl_input_Mouse.c 20 Feb 2005 11:24:22 -0000 1.34 @@ -190,7 +190,7 @@ XWarpPointer(getDisplay(), None, getCurrentWindow(), 0, 0, 0, 0, center_x, center_y); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetNativeCursor(JNIEnv *env, jobject this, jobject cursor_handle) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetNativeCursor(JNIEnv *env, jclass clazz, jobject cursor_handle) { if (cursor_handle != NULL) { Cursor *cursor = (Cursor *)(*env)->GetDirectBufferAddress(env, cursor_handle); current_cursor = *cursor; @@ -204,18 +204,14 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateMouse - (JNIEnv * env, jobject this) + (JNIEnv * env, jclass clazz) { - Display *disp = incDisplay(env); - if (disp == NULL) - return; int i; last_y = last_x = accum_dx = accum_dy = accum_dz = 0; reset(); for (i = 0; i < org_lwjgl_opengl_LinuxDisplay_NUM_BUTTONS; i++) buttons[i] = 0; if (!blankCursor(env)) { - decDisplay(); return; } current_cursor = None; @@ -226,12 +222,11 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyMouse - (JNIEnv * env, jobject this) + (JNIEnv * env, jclass clazz) { ungrabPointer(); XFreeCursor(getDisplay(), blank_cursor); created = false; - decDisplay(); } static unsigned char mapButton(XButtonEvent *event) { @@ -313,7 +308,7 @@ doHandlePointerMotion(event->x_root, event->y_root, event->x, event->y); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nPollMouse(JNIEnv * env, jobject this, jobject coord_buffer_obj, jobject button_buffer_obj) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nPollMouse(JNIEnv * env, jclass clazz, jobject coord_buffer_obj, jobject button_buffer_obj) { int *coords = (int *)(*env)->GetDirectBufferAddress(env, coord_buffer_obj); int coords_length = (*env)->GetDirectBufferCapacity(env, coord_buffer_obj); unsigned char *buttons_buffer = (unsigned char *)(*env)->GetDirectBufferAddress(env, button_buffer_obj); @@ -340,14 +335,14 @@ buttons_buffer[i] = buttons[i]; } -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReadMouse(JNIEnv *env, jobject this, jobject buffer, jint buffer_position) { +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReadMouse(JNIEnv *env, jclass clazz, jobject buffer, jint buffer_position) { jint* buffer_ptr = (jint *)(*env)->GetDirectBufferAddress(env, buffer); int buffer_size = ((*env)->GetDirectBufferCapacity(env, buffer))/sizeof(jint) - buffer_position; handleMessages(env); return copyEvents(&event_queue, buffer_ptr + buffer_position, buffer_size); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabMouse(JNIEnv * env, jobject this, jboolean new_grab) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGrabMouse(JNIEnv * env, jclass clazz, jboolean new_grab) { Window root_return, child_return; int root_x, root_y, win_x, win_y; unsigned int mask_return; --- NEW FILE: org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.c,v 1.1 2005/02/20 11:24:22 elias_naur Exp $ * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <jni.h> #include <jawt.h> #include <jawt_md.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include "awt_tools.h" #include "org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h" #include "extgl_glx.h" #include "context.h" #include "Window.h" JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo_nInitHandle (JNIEnv *env, jclass clazz, int screen, jobject lock_buffer_handle, jobject peer_info_handle) { if ((*env)->GetDirectBufferCapacity(env, peer_info_handle) < sizeof(X11PeerInfo)) { throwException(env, "PeerInfo handle buffer not large enough"); return; } const AWTSurfaceLock *awt_lock = (AWTSurfaceLock *)(*env)->GetDirectBufferAddress(env, lock_buffer_handle); X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); // Get the platform-specific drawing info JAWT_X11DrawingSurfaceInfo *dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)awt_lock->dsi->platformInfo; peer_info->display = dsi_x11->display; peer_info->screen = screen; peer_info->drawable = dsi_x11->drawable; peer_info->glx13 = false; peer_info->config.glx_config.visualid = dsi_x11->visualID; peer_info->config.glx_config.depth = dsi_x11->depth; } Index: org_lwjgl_input_Keyboard.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Keyboard.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- org_lwjgl_input_Keyboard.c 18 Jan 2005 16:42:30 -0000 1.15 +++ org_lwjgl_input_Keyboard.c 20 Feb 2005 11:24:22 -0000 1.16 @@ -119,11 +119,8 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateKeyboard - (JNIEnv * env, jobject this) + (JNIEnv * env, jclass clazz) { - Display *disp = incDisplay(env); - if (disp == NULL) - return; int i; for (i = 0; i < KEYBOARD_SIZE; i++) key_map[i] = i; @@ -169,12 +166,11 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyKeyboard - (JNIEnv * env, jobject this) + (JNIEnv * env, jclass clazz) { closeUnicodeStructs(); ungrabKeyboard(); created = false; - decDisplay(); } static unsigned char getKeycode(XKeyEvent *event) { @@ -280,13 +276,13 @@ bufferEvent(event); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nPollKeyboard(JNIEnv * env, jobject this, jobject buffer) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nPollKeyboard(JNIEnv * env, jclass clazz, jobject buffer) { unsigned char *new_keyboard_buffer = (unsigned char *)(*env)->GetDirectBufferAddress(env, buffer); handleMessages(env); memcpy(new_keyboard_buffer, key_buf, KEYBOARD_SIZE*sizeof(unsigned char)); } -JNIEXPORT int JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReadKeyboard(JNIEnv * env, jobject this, jobject buffer, jint buffer_position) { +JNIEXPORT int JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReadKeyboard(JNIEnv * env, jclass clazz, jobject buffer, jint buffer_position) { handleMessages(env); jint* buffer_ptr = (jint *)(*env)->GetDirectBufferAddress(env, buffer); int buffer_size = ((*env)->GetDirectBufferCapacity(env, buffer))/sizeof(jint) - buffer_position; Index: org_lwjgl_opengl_Display.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Display.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- org_lwjgl_opengl_Display.c 18 Feb 2005 09:26:32 -0000 1.23 +++ org_lwjgl_opengl_Display.c 20 Feb 2005 11:24:22 -0000 1.24 @@ -51,10 +51,12 @@ #include "extgl.h" #include "extgl_glx.h" #include "Window.h" +#include "context.h" #include "display.h" #include "org_lwjgl_opengl_LinuxDisplay.h" +#include "org_lwjgl_opengl_LinuxDisplayPeerInfo.h" -#define USEGLX13 extension_flags.GLX13 +//#define USEGLX13 extension_flags.GLX13 #define ERR_MSG_SIZE 1024 typedef struct { @@ -69,10 +71,10 @@ typedef enum {FULLSCREEN_LEGACY, FULLSCREEN_NETWM, WINDOWED} window_mode; -static GLXContext display_context = NULL; // OpenGL rendering context -static GLXFBConfig *configs = NULL; -static GLXWindow glx_window; -static XVisualInfo *vis_info = NULL; +//static GLXContext display_context = NULL; // OpenGL rendering context +//static GLXFBConfig *configs = NULL; +static GLXWindow glx_window = None; +//static XVisualInfo *vis_info = NULL; static Atom delete_atom; static Colormap cmap; @@ -97,20 +99,16 @@ static char error_message[ERR_MSG_SIZE]; static Atom warp_atom; -GLXFBConfig getCurrentGLXFBConfig(void) { - return configs[0]; -} - -GLXContext getDisplayContext(void) { +/*GLXContext getDisplayContext(void) { return display_context; } - +*/ int getCurrentScreen(void) { return current_screen; } -bool checkXError(JNIEnv *env) { - XSync(getDisplay(), False); +bool checkXError(JNIEnv *env, Display *disp) { + XSync(disp, False); if (async_x_error) { async_x_error = false; if (env != NULL) @@ -137,7 +135,7 @@ return display_connection; } -Display *incDisplay(JNIEnv *env) { +static Display *incDisplay(JNIEnv *env) { if (display_connection_usage == 0) { async_x_error = false; XSetErrorHandler(errorHandler); @@ -149,6 +147,7 @@ printfDebugJava(env, "Could not open X display connection"); return NULL; } + current_screen = XDefaultScreen(getDisplay()); warp_atom = XInternAtom(display_connection, "_LWJGL_WARP", False); } async_x_error = false; @@ -160,7 +159,7 @@ return warp_atom; } -void decDisplay(void) { +static void decDisplay(void) { display_connection_usage--; if (display_connection_usage == 0) { XCloseDisplay(display_connection); @@ -318,15 +317,37 @@ XStoreName(getDisplay(), current_win, title); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jobject this, jstring title_obj) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_incDisplay(JNIEnv *env, jclass clazz) { + incDisplay(env); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_decDisplay(JNIEnv *env, jclass clazz) { + decDisplay(); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDrawable(JNIEnv *env, jclass clazz, jobject peer_info_handle) { + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + if (peer_info->glx13) + peer_info->drawable = glx_window; + else + peer_info->drawable = getCurrentWindow(); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplayPeerInfo_initDefaultPeerInfo(JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject pixel_format) { + initPeerInfo(env, peer_info_handle, getDisplay(), getCurrentScreen(), pixel_format, true, GLX_WINDOW_BIT, true, false); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetTitle(JNIEnv * env, jclass clazz, jstring title_obj) { char * title = GetStringNativeChars(env, title_obj); setWindowTitle(title); free(title); } static void destroyWindow(JNIEnv *env) { - if (USEGLX13) + if (glx_window != None) { glXDestroyWindow(getDisplay(), glx_window); + glx_window = None; + } XDestroyWindow(getDisplay(), current_win); XFreeColormap(getDisplay(), cmap); setRepeatMode(env, AutoRepeatModeDefault); @@ -357,11 +378,11 @@ return supported; } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env, jobject this, jint x, jint y, jint width, jint height) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nReshape(JNIEnv *env, jclass clazz, jint x, jint y, jint width, jint height) { XMoveWindow(getDisplay(), getCurrentWindow(), x, y); } -static bool createWindow(JNIEnv* env, int x, int y, int width, int height) { +static bool createWindow(JNIEnv* env, X11PeerInfo *peer_info, int x, int y, int width, int height) { bool undecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated"); dirty = true; focused = true; @@ -378,6 +399,9 @@ current_width = width; current_height = height; root_win = RootWindow(getDisplay(), getCurrentScreen()); + XVisualInfo *vis_info = getVisualInfoFromPeerInfo(env, peer_info); + if (vis_info == NULL) + return false; cmap = XCreateColormap(getDisplay(), root_win, vis_info->visual, AllocNone); attribs.colormap = cmap; attribs.event_mask = ExposureMask | /*FocusChangeMask | */VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; @@ -389,7 +413,8 @@ attribs.override_redirect = True; } win = XCreateWindow(getDisplay(), root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); - if (!checkXError(env)) { + XFree(vis_info); + if (!checkXError(env, getDisplay())) { XFreeColormap(getDisplay(), cmap); return false; } @@ -418,7 +443,7 @@ waitMapped(win); XClearWindow(getDisplay(), win); setRepeatMode(env, AutoRepeatModeOff); - if (!checkXError(env)) { + if (!checkXError(env, getDisplay())) { destroyWindow(env); return false; } @@ -438,12 +463,12 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nUpdate - (JNIEnv *env, jobject this) + (JNIEnv *env, jclass clazz) { handleMessages(env); } -bool releaseContext(GLXContext context) { +/*bool releaseContext(GLXContext context) { if (glXGetCurrentContext() != context) return true; if (USEGLX13) @@ -460,145 +485,13 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nMakeCurrent - (JNIEnv *env, jobject this) + (JNIEnv *env, jclass clazz) { if (!makeCurrent()) throwException(env, "Could not make display context current"); } - -int convertToBPE(int bpp) { - int bpe; - switch (bpp) { - case 32: - case 24: - bpe = 8; - break; - case 16: /* Fall through */ - default: - bpe = 4; - break; - } - return bpe; -} - -static GLXFBConfig *chooseVisualGLX13FromBPP(JNIEnv *env, jobject pixel_format, int bpp, int drawable_type, bool double_buffer) { - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); - int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); - int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); - int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); - int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); - int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); - bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); - - int bpe = convertToBPE(bpp); - int accum_bpe = convertToBPE(accum_bpp); - attrib_list_t attrib_list; - initAttribList(&attrib_list); - putAttrib(&attrib_list, GLX_RENDER_TYPE); putAttrib(&attrib_list, GLX_RGBA_BIT); - putAttrib(&attrib_list, GLX_DOUBLEBUFFER); putAttrib(&attrib_list, double_buffer ? True : False); - putAttrib(&attrib_list, GLX_DRAWABLE_TYPE); putAttrib(&attrib_list, drawable_type); - putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth); - putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha); - putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil); - putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers); - putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha); - putAttrib(&attrib_list, GLX_STEREO); putAttrib(&attrib_list, stereo ? True : False); - if (samples > 0 && extension_flags.GLX_ARB_multisample) { - putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); - putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); - } - putAttrib(&attrib_list, None); putAttrib(&attrib_list, None); - int num_formats = 0; - GLXFBConfig* configs = glXChooseFBConfig(getDisplay(), getCurrentScreen(), attrib_list.attribs, &num_formats); - if (num_formats > 0) { - return configs; - } else { - if (configs != NULL) - XFree(configs); - return NULL; - } -} - -GLXFBConfig *chooseVisualGLX13(JNIEnv *env, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer) { - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int bpp; - if (use_display_bpp) { - bpp = XDefaultDepthOfScreen(XScreenOfDisplay(getDisplay(), getCurrentScreen())); - GLXFBConfig *configs = chooseVisualGLX13FromBPP(env, pixel_format, bpp, drawable_type, double_buffer); - if (configs != NULL) - return configs; - else - bpp = 16; - } else - bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "bpp", "I")); - return chooseVisualGLX13FromBPP(env, pixel_format, bpp, drawable_type, double_buffer); -} - -static XVisualInfo *chooseVisualGLX(JNIEnv *env, jobject pixel_format) { - int bpp = XDefaultDepthOfScreen(XScreenOfDisplay(getDisplay(), getCurrentScreen())); - jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); - int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); - int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); - int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); - int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); - int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); - int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); - int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); - bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stereo", "Z")); - - int bpe = convertToBPE(bpp); - int accum_bpe = convertToBPE(accum_bpp); - attrib_list_t attrib_list; - initAttribList(&attrib_list); - putAttrib(&attrib_list, GLX_RGBA); - putAttrib(&attrib_list, GLX_DOUBLEBUFFER); - putAttrib(&attrib_list, GLX_DEPTH_SIZE); putAttrib(&attrib_list, depth); - putAttrib(&attrib_list, GLX_RED_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_GREEN_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_BLUE_SIZE); putAttrib(&attrib_list, bpe); - putAttrib(&attrib_list, GLX_ALPHA_SIZE); putAttrib(&attrib_list, alpha); - putAttrib(&attrib_list, GLX_STENCIL_SIZE); putAttrib(&attrib_list, stencil); - putAttrib(&attrib_list, GLX_AUX_BUFFERS); putAttrib(&attrib_list, num_aux_buffers); - putAttrib(&attrib_list, GLX_ACCUM_RED_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_GREEN_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_BLUE_SIZE); putAttrib(&attrib_list, accum_bpe); - putAttrib(&attrib_list, GLX_ACCUM_ALPHA_SIZE); putAttrib(&attrib_list, accum_alpha); - if (stereo) - putAttrib(&attrib_list, GLX_STEREO); - if (samples > 0 && extension_flags.GLX_ARB_multisample) { - putAttrib(&attrib_list, GLX_SAMPLE_BUFFERS_ARB); putAttrib(&attrib_list, 1); - putAttrib(&attrib_list, GLX_SAMPLES_ARB); putAttrib(&attrib_list, samples); - } - putAttrib(&attrib_list, None); - return glXChooseVisual(getDisplay(), getCurrentScreen(), attrib_list.attribs); -} - -static void dumpVisualInfo(JNIEnv *env, XVisualInfo *vis_info) { - int alpha, depth, stencil, r, g, b; - int sample_buffers = 0; - int samples = 0; - glXGetConfig(getDisplay(), vis_info, GLX_RED_SIZE, &r); - glXGetConfig(getDisplay(), vis_info, GLX_GREEN_SIZE, &g); - glXGetConfig(getDisplay(), vis_info, GLX_BLUE_SIZE, &b); - glXGetConfig(getDisplay(), vis_info, GLX_ALPHA_SIZE, &alpha); - glXGetConfig(getDisplay(), vis_info, GLX_DEPTH_SIZE, &depth); - glXGetConfig(getDisplay(), vis_info, GLX_STENCIL_SIZE, &stencil); - if (extension_flags.GLX_ARB_multisample) { - glXGetConfig(getDisplay(), vis_info, GLX_SAMPLE_BUFFERS_ARB, &sample_buffers); - glXGetConfig(getDisplay(), vis_info, GLX_SAMPLES_ARB, &samples); - } - printfDebugJava(env, "Pixel format info: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d, sample buffers = %d, samples = %d", r, g, b, alpha, depth, stencil, sample_buffers, samples); -} - -static void destroyContext(void) { +*/ +/*static void destroyContext(void) { if (USEGLX13) { XFree(configs); configs = NULL; @@ -609,9 +502,9 @@ glXDestroyContext(getDisplay(), display_context); display_context = NULL; } - -static bool initWindowGLX13(JNIEnv *env, jobject pixel_format) { - configs = chooseVisualGLX13(env, pixel_format, true, GLX_WINDOW_BIT, true); +*/ +/*static bool initWindowGLX13(JNIEnv *env, jobject pixel_format) { + configs = chooseVisualGLX13(env, getDisplay(), getCurrentScreen(), pixel_format, true, GLX_WINDOW_BIT, true); if (configs == NULL) { throwException(env, "Could not find a matching pixel format"); return false; @@ -636,7 +529,7 @@ throwException(env, "Could not get visual from FB config"); return false; } - if (!checkXError(env)) { + if (!checkXError(env, getDisplay())) { glXDestroyContext(getDisplay(), display_context); XFree(configs); XFree(vis_info); @@ -646,13 +539,11 @@ } static bool initWindowGLX(JNIEnv *env, jobject pixel_format) { - vis_info = chooseVisualGLX(env, pixel_format); + vis_info = chooseVisualGLX(env, getDisplay(), getCurrentScreen(), pixel_format, true, true); if (vis_info == NULL) { throwException(env, "Could not find a matching pixel format"); return false; } - if (isDebugEnabled()) - dumpVisualInfo(env, vis_info); display_context = glXCreateContext(getDisplay(), vis_info, NULL, True); if (display_context == NULL) { XFree(vis_info); @@ -666,39 +557,39 @@ throwException(env, "Could not create a direct GLX context"); return false; } - if (!checkXError(env)) { + if (!checkXError(env, getDisplay())) { glXDestroyContext(getDisplay(), display_context); XFree(vis_info); return false; } return true; } - -JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jobject this) { +*/ +JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetAvailableDisplayModes(JNIEnv *env, jclass clazz) { return getAvailableDisplayModes(env, getCurrentScreen()); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jobject this, jobject mode) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwitchDisplayMode(JNIEnv *env, jclass clazz, jobject mode) { switchDisplayMode(env, mode, getCurrentScreen()); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nResetDisplayMode(JNIEnv *env, jobject this) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nResetDisplayMode(JNIEnv *env, jclass clazz) { resetDisplayMode(env, getCurrentScreen(), false); } -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetGammaRampLength(JNIEnv *env, jobject this) { +JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetGammaRampLength(JNIEnv *env, jclass clazz) { return (jint)getGammaRampLength(env, getCurrentScreen()); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp(JNIEnv *env, jobject this, jobject gamma_buffer) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetGammaRamp(JNIEnv *env, jclass clazz, jobject gamma_buffer) { setGammaRamp(env, gamma_buffer, getCurrentScreen()); } -JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInit(JNIEnv *env, jobject this) { +JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInit(JNIEnv *env, jclass clazz) { return initDisplay(env, getCurrentScreen()); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateContext(JNIEnv *env, jobject this, jobject pixel_format) { +/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateContext(JNIEnv *env, jclass clazz, jobject pixel_format) { Display *disp = incDisplay(env); if (disp == NULL) { return; @@ -719,13 +610,13 @@ if (!result) decDisplay(); } - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyContext(JNIEnv *env, jobject this) { +*/ +/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyContext(JNIEnv *env, jclass clazz) { destroyContext(); decDisplay(); } - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jobject this, jobject mode, jboolean fullscreen, int x, int y) { +*/ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateWindow(JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject mode, jboolean fullscreen, jint x, jint y) { bool current_fullscreen = fullscreen == JNI_TRUE; if (current_fullscreen) { if (getCurrentDisplayModeExtension() == XRANDR && isNetWMFullscreenSupported(env)) { @@ -737,30 +628,37 @@ } } else current_window_mode = WINDOWED; + X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); + GLXFBConfig *fb_config = NULL; + if (peer_info->glx13) { + fb_config = getFBConfigFromPeerInfo(env, peer_info); + if (fb_config == NULL) + return; + } jclass cls_displayMode = (*env)->GetObjectClass(env, mode); jfieldID fid_width = (*env)->GetFieldID(env, cls_displayMode, "width", "I"); jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); int width = (*env)->GetIntField(env, mode, fid_width); int height = (*env)->GetIntField(env, mode, fid_height); - bool window_created = createWindow(env, x, y, width, height); + bool window_created = createWindow(env, peer_info, x, y, width, height); if (!window_created) { return; } - if (isDebugEnabled()) - dumpVisualInfo(env, vis_info); - if (USEGLX13) - glx_window = glXCreateWindow(getDisplay(), configs[0], getCurrentWindow(), NULL); - if (!checkXError(env)) { + if (peer_info->glx13) { + glx_window = glXCreateWindow(getDisplay(), *fb_config, getCurrentWindow(), NULL); + XFree(fb_config); + } + if (!checkXError(env, getDisplay())) { glXDestroyWindow(getDisplay(), glx_window); destroyWindow(env); } } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow(JNIEnv *env, jobject this) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyWindow(JNIEnv *env, jclass clazz) { destroyWindow(env); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwapBuffers(JNIEnv * env, jobject this) +/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSwapBuffers(JNIEnv * env, jclass clazz) { dirty = false; if (USEGLX13) @@ -768,33 +666,33 @@ else glXSwapBuffers(getDisplay(), getCurrentWindow()); } - +*/ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsDirty - (JNIEnv *env, jobject this) { + (JNIEnv *env, jclass clazz) { bool result = dirty; dirty = false; return result ? JNI_TRUE : JNI_FALSE; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsVisible - (JNIEnv *env, jobject this) { + (JNIEnv *env, jclass clazz) { return minimized ? JNI_FALSE : JNI_TRUE; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsCloseRequested - (JNIEnv *env, jobject this) { + (JNIEnv *env, jclass clazz) { bool saved = closerequested; closerequested = false; return saved; } JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nIsActive - (JNIEnv *env, jobject this) { + (JNIEnv *env, jclass clazz) { return focused || isLegacyFullscreen() ? JNI_TRUE : JNI_FALSE; } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetVSyncEnabled - (JNIEnv *env, jobject this, jboolean sync) +/*JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nSetVSyncEnabled + (JNIEnv *env, jclass clazz, jboolean sync) { if (extension_flags.GLX_SGI_swap_control) { bool vsync = sync == JNI_TRUE ? true : false; @@ -805,8 +703,8 @@ } } } - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_lockAWT(JNIEnv *env, jobject this) { +*/ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_lockAWT(JNIEnv *env, jclass clazz) { JAWT jawt; jawt.version = JAWT_VERSION_1_4; if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) { @@ -816,7 +714,7 @@ jawt.Lock(env); } -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_unlockAWT(JNIEnv *env, jobject this) { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_unlockAWT(JNIEnv *env, jclass clazz) { JAWT jawt; jawt.version = JAWT_VERSION_1_4; if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) { Index: Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/Window.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- Window.h 12 Jan 2005 12:20:52 -0000 1.25 +++ Window.h 20 Feb 2005 11:24:22 -0000 1.26 @@ -49,13 +49,12 @@ #include "extgl.h" #include "extgl_glx.h" - extern GLXFBConfig *chooseVisualGLX13(JNIEnv *env, jobject pixel_format, bool use_display_bpp, int drawable_type, bool double_buffer); /* * release input (keyboard, mouse) */ extern void handleMessages(JNIEnv *env); - extern bool checkXError(JNIEnv *env); + extern bool checkXError(JNIEnv *env, Display *display); extern Atom getWarpAtom(void); /* * Various functions to release/acquire keyboard and mouse @@ -82,19 +81,6 @@ extern int getWindowHeight(void); /* - * Increment display usage (and possible open it). - * Return the display handle. - * If the function fails, it will return NULL - * and throw a java exception through the env argument - */ - extern Display *incDisplay(JNIEnv *env); - - /* - * Decrement display usage and possibly release it - */ - extern void decDisplay(void); - - /* * get the current display */ extern Display *getDisplay(void); @@ -108,21 +94,6 @@ * get the current window */ extern Window getCurrentWindow(void); - - /* - * Release the context if it is current - */ - extern bool releaseContext(GLXContext context); - - /* - * get the current context - */ - extern GLXContext getDisplayContext(void); - - /* - * get the current GLXFBConfig for the current context - */ - extern GLXFBConfig getCurrentGLXFBConfig(void); /* * Return true if we are in fullscreen mode @@ -134,8 +105,4 @@ */ extern bool isLegacyFullscreen(void); - /* - * convert bit-per-pixel to bits-per-element - */ - extern int convertToBPE(int bpp); #endif /* _LWJGL_WINDOW_H_INCLUDED_ */ Index: org_lwjgl_opengl_Pbuffer.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- org_lwjgl_opengl_Pbuffer.c 18 Feb 2005 09:26:32 -0000 1.11 +++ org_lwjgl_opengl_Pbuffer.c 20 Feb 2005 11:24:22 -0000 1.12 @@ -40,38 +40,38 @@ */ #include <stdlib.h> -#include "org_lwjgl_opengl_LinuxDisplay.h" +#include "org_lwjgl_opengl_LinuxPbufferPeerInfo.h" #include "org_lwjgl_opengl_Pbuffer.h" #include "extgl.h" +#include "context.h" #include "Window.h" #include "common_tools.h" - +/* typedef struct _PbufferInfo { GLXPbuffer buffer; GLXContext context; } PbufferInfo; - +*/ static bool isPbuffersSupported() { // Only support the GLX 1.3 Pbuffers and ignore the GLX_SGIX_pbuffer extension return extension_flags.GLX13 ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetPbufferCapabilities - (JNIEnv *env, jobject this) + (JNIEnv *env, jclass clazz) { return isPbuffersSupported() ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0; } -static void destroyPbuffer(PbufferInfo *buffer_info) { +/*static void destroyPbuffer(PbufferInfo *buffer_info) { GLXPbuffer buffer = buffer_info->buffer; GLXContext context = buffer_info->context; glXDestroyPbuffer(getDisplay(), buffer); releaseContext(context); glXDestroyContext(getDisplay(), context); - decDisplay(); } - -static bool checkPbufferCaps(JNIEnv *env, GLXFBConfig config, int width, int height) { +*/ +/*static bool checkPbufferCaps(JNIEnv *env, GLXFBConfig config, int width, int height) { int max; int result = glXGetFBConfigAttrib(getDisplay(), config, GLX_MAX_PBUFFER_WIDTH, &max); if (result != Success) { @@ -95,7 +95,7 @@ } static bool createPbufferUsingUniqueContext(JNIEnv *env, PbufferInfo *pbuffer_info, jobject pixel_format, int width, int height, const int *buffer_attribs, GLXContext shared_context) { - GLXFBConfig *configs = chooseVisualGLX13(env, pixel_format, false, GLX_PBUFFER_BIT, false); + GLXFBConfig *configs = chooseVisualGLX13(env, getDisplay(), getCurrentScreen(), pixel_format, false, GLX_PBUFFER_BIT, false); if (configs == NULL) { throwException(env, "No matching pixel format"); return false; @@ -123,16 +123,43 @@ pbuffer_info->buffer = buffer; return true; } +*/ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle + (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint width, jint height, jobject pixel_format) { + if (!extgl_InitGLX(env, getDisplay(), getCurrentScreen()) || !isPbuffersSupported()) { + throwException(env, "No Pbuffer support"); + return; + } + bool result = initPeerInfo(env, peer_info_handle, getDisplay(), getCurrentScreen(), pixel_format, false, GLX_PBUFFER_BIT, false, true); + if (!result) + return; + const int buffer_attribs[] = {GLX_PBUFFER_WIDTH, width, + GLX_PBUFFER_HEIGHT, height, + GLX_PRESERVED_CONTENTS, True, + GLX_LARGEST_PBUFFER, False, + None, None}; -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreatePbuffer(JNIEnv *env, jobject this, jobject handle_buffer, jint width, jint height, jobject pixel_format, jobject pixelFormatCaps, jobject pBufferAttribs, jobject shared_context_handle_buffer) + X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + GLXFBConfig *config = getFBConfigFromPeerInfo(env, peer_info); + GLXPbuffer buffer = glXCreatePbuffer(peer_info->display, *config, buffer_attribs); + XFree(config); + peer_info->drawable = buffer; +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nDestroy + (JNIEnv *env, jclass clazz, jobject peer_info_handle) { + X11PeerInfo *peer_info = (X11PeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle); + glXDestroyPbuffer(peer_info->display, peer_info->drawable); +} +/* +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreatePbuffer(JNIEnv *env, jclass clazz, jobject handle_buffer, jint width, jint height, jobject pixel_format, jobject pixelFormatCaps, jobject pBufferAttribs, jobject shared_context_handle_buffer) { - Display *disp = incDisplay(env); - if (disp == NULL) { + if ((*env)->GetDirectBufferCapacity(env, handle_buffer) < sizeof(PbufferInfo)) { + throwException(env, "Handle buffer not large enough"); return; } int current_screen = getCurrentScreen(); - if (!extgl_InitGLX(env, disp, current_screen) || !isPbuffersSupported()) { - decDisplay(); + if (!extgl_InitGLX(env, getDisplay(), current_screen) || !isPbuffersSupported()) { throwException(env, "No Pbuffer support"); return; } @@ -143,11 +170,6 @@ GLX_LARGEST_PBUFFER, False, None, None}; - if ((*env)->GetDirectBufferCapacity(env, handle_buffer) < sizeof(PbufferInfo)) { - decDisplay(); - throwException(env, "Handle buffer not large enough"); - return; - } GLXContext shared_context = getDisplayContext(); if (shared_context_handle_buffer != NULL) { PbufferInfo *shared_buffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, shared_context_handle_buffer); @@ -156,18 +178,16 @@ PbufferInfo *buffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, handle_buffer); bool result; result = createPbufferUsingUniqueContext(env, buffer_info, pixel_format, width, height, buffer_attribs, shared_context); - if (!result) { - decDisplay(); + if (!result) return; - } - if (!checkXError(env)) { + if (!checkXError(env, getDisplay())) { destroyPbuffer(buffer_info); return; } } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nMakePbufferCurrent - (JNIEnv *env, jobject this, jobject handle_buffer) + (JNIEnv *env, jclass clazz, jobject handle_buffer) { PbufferInfo *buffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, handle_buffer); GLXPbuffer buffer = buffer_info->buffer; @@ -178,8 +198,8 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyPbuffer - (JNIEnv *env, jobject this, jobject handle_buffer) + (JNIEnv *env, jclass clazz, jobject handle_buffer) { PbufferInfo *buffer_info = (PbufferInfo *)(*env)->GetDirectBufferAddress(env, handle_buffer); destroyPbuffer(buffer_info); -} +}*/ Index: org_lwjgl_input_Cursor.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Cursor.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_input_Cursor.c 18 Jan 2005 12:34:35 -0000 1.6 +++ org_lwjgl_input_Cursor.c 20 Feb 2005 11:24:22 -0000 1.7 @@ -48,23 +48,19 @@ #include "common_tools.h" JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetNativeCursorCapabilities - (JNIEnv *env, jobject this) { + (JNIEnv *env, jclass clazz) { int caps = 0; - Display *disp = incDisplay(env); - if (disp == NULL) - return caps; XcursorBool argb_supported = XcursorSupportsARGB(getDisplay()); XcursorBool anim_supported = XcursorSupportsAnim(getDisplay()); if (argb_supported) caps |= org_lwjgl_input_Cursor_CURSOR_8_BIT_ALPHA | org_lwjgl_input_Cursor_CURSOR_ONE_BIT_TRANSPARENCY; if (anim_supported) caps |= org_lwjgl_input_Cursor_CURSOR_ANIMATION; - decDisplay(); return caps; } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetMinCursorSize - (JNIEnv *env, jobject this) + (JNIEnv *env, jclass clazz) { unsigned int width_return = 0; unsigned int height_return = 0; @@ -73,7 +69,7 @@ } JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetMaxCursorSize - (JNIEnv *env, jobject this) + (JNIEnv *env, jclass clazz) { unsigned int width_return = 0; unsigned int height_return = 0; @@ -82,15 +78,12 @@ } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nCreateCursor - (JNIEnv *env, jobject this, jobject handle_buffer, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) + (JNIEnv *env, jclass clazz, jobject handle_buffer, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset) { if ((*env)->GetDirectBufferCapacity(env, handle_buffer) < sizeof(Cursor)) { throwException(env, "Handle buffer not large enough"); return; } - Display *disp = incDisplay(env); - if (disp == NULL) - return; const int *delays = NULL; if (delay_buffer != NULL) delays = (const int *)(*env)->GetDirectBufferAddress(env, delay_buffer) + delays_offset; @@ -98,7 +91,6 @@ int stride = width*height; XcursorImages *cursor_images = XcursorImagesCreate(num_images); if (cursor_images == NULL) { - decDisplay(); throwException(env, "Could not allocate cursor."); return; } @@ -114,14 +106,13 @@ cursor_images->images[i] = cursor_image; } Cursor *cursor = (Cursor *)(*env)->GetDirectBufferAddress(env, handle_buffer); - *cursor = XcursorImagesLoadCursor(disp, cursor_images); + *cursor = XcursorImagesLoadCursor(getDisplay(), cursor_images); XcursorImagesDestroy(cursor_images); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nDestroyCursor - (JNIEnv *env, jobject this, jobject cursor_handle_buffer) + (JNIEnv *env, jclass clazz, jobject cursor_handle_buffer) { Cursor *cursor = (Cursor *)(*env)->GetDirectBufferAddress(env, cursor_handle_buffer); XFreeCursor(getDisplay(), *cursor); - decDisplay(); } --- NEW FILE: context.c --- /* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'LWJGL' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * $Id: context.c,v 1.1 2005/02/20 11:24:22 elias_naur Exp $ * * Include file to access public window features * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <jni.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include "extgl_glx.h" #include "context.h" XVisualInfo *getVisualInfoFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) { XVisualInfo *vis_info; if (!peer_info->glx13) { XVisualInfo template; template.visualid = peer_info->config.glx_config.visualid; template.depth = peer_info->config.glx_config.depth; template.screen = peer_info->screen; int num_infos; vis_info = XGetVisualInfo(peer_info->display, VisualIDMask | VisualScreenMask | VisualDepthMask, &template, &num_infos); if (vis_info == NULL) { throwException(env, "Could not find VisualInfo from peer info"); return NULL; } // Check the assumption from GLX 1.3 docs that a VisualInfo is uniquely identified by its // {VisualID, screen, depth} tuple if (num_infos != 1) { XFree(vis_info); throwException(env, "No unique VisualInfo matches peer info"); return NULL; } } else { GLXFBConfig *configs = getFBConfigFromPeerInfo(env, peer_info); if (configs == NULL) return NULL; vis_info = glXGetVisualFromFBConfig(peer_info->display, configs[0]); if (vis_info == NULL) throwException(env, "Could not get VisualInfo from GLX 1.3 config"); XFree(configs); } return vis_info; } GLXFBConfig *getFBConfigFromPeerInfo(JNIEnv *env, X11PeerInfo *peer_info) { int attribs[] = {GLX_FBCONFIG_ID, peer_info->config.glx13_config.config_id}; int num_elements; GLXFBConfig *configs = glXChooseFBConfig(peer_info->display, peer_info->screen, attribs, &num_elements); if (configs == NULL) { throwException(env, "Could not find GLX 1.3 config from peer info"); return NULL; } // Check that only one FBConfig matches the config id if (num_elements != 1) { XFree(configs); throwException(env, "No unique GLX 1.3 config matches peer info"); return NULL; } return configs; } static int convertToBPE(int bpp) { int bpe; switch (bpp) { case 32: case 24: bpe = 8; break; case 16: /* Fall through */ default: bpe = 4; break; } return bpe; } static GLXFBConfig *chooseVisualGLX13FromBPP(JNIEnv *env, Display *disp, int screen, jobject pixel_format, int bpp, int drawable_type, bool double_buffer) { jclass cls_pixel_format = (*env)->GetObjectClass(env, pixel_format); int alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "alpha", "I")); int depth = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "depth", "I")); int stencil = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "stencil", "I")); int samples = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "samples", "I")); int num_aux_buffers = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "num_aux_buffers", "I")); int accum_bpp = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_bpp", "I")); int accum_alpha = (int)(*env)->GetIntField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_format, "accum_alpha", "I")); bool stereo = (bool)(*env)->GetBooleanField(env, pixel_format, (*env)->GetFieldID(env, cls_pixel_... [truncated message content] |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:24:32
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/util Modified Files: Display.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/util/Display.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Display.java 20 Aug 2004 09:03:31 -0000 1.7 +++ Display.java 20 Feb 2005 11:24:21 -0000 1.8 @@ -37,6 +37,7 @@ import java.util.Comparator; import org.lwjgl.Sys; +import org.lwjgl.LWJGLException; import org.lwjgl.opengl.DisplayMode; /** @@ -65,7 +66,7 @@ * @return an array of matching display modes */ public static DisplayMode[] getAvailableDisplayModes(int minWidth, int minHeight, int maxWidth, int maxHeight, int minBPP, int maxBPP, - int minFreq, int maxFreq) + int minFreq, int maxFreq) throws LWJGLException { // First get the available display modes DisplayMode[] modes = org.lwjgl.opengl.Display.getAvailableDisplayModes(); |
|
From: Elias N. <eli...@us...> - 2005-02-20 11:24:32
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/shaders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10507/src/java/org/lwjgl/test/opengl/shaders Modified Files: ShadersTest.java Log Message: Linux support for AWTGLCanvas. Big refactor of context specific code into Context.java that is now shared between Display, Pbuffer and AWTGLCanvas. (Win32 and Mac OS X is now broken while I implement the same changes on those platforms) Index: ShadersTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ShadersTest.java 16 Feb 2005 12:58:40 -0000 1.7 +++ ShadersTest.java 20 Feb 2005 11:24:21 -0000 1.8 @@ -122,19 +122,19 @@ if ( args.length != 1 ) argsError(); - DisplayMode[] modes = Display.getAvailableDisplayModes(); + try { + DisplayMode[] modes = Display.getAvailableDisplayModes(); - DisplayMode displayMode; + DisplayMode displayMode; - displayMode = chooseMode(modes, 1024, 768); - if ( displayMode == null ) - displayMode = chooseMode(modes, 800, 600); - if ( displayMode == null ) - displayMode = chooseMode(modes, 640, 480); - if ( displayMode == null ) - kill("Failed to set an appropriate display mode."); + displayMode = chooseMode(modes, 1024, 768); + if ( displayMode == null ) + displayMode = chooseMode(modes, 800, 600); + if ( displayMode == null ) + displayMode = chooseMode(modes, 640, 480); + if ( displayMode == null ) + kill("Failed to set an appropriate display mode."); - try { System.out.println("Setting display mode to: " + displayMode); Display.setDisplayMode(displayMode); Display.create(new PixelFormat(8, 24, 0)); |