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
|
|
From: <ma...@us...> - 2011-04-16 18:38:54
|
Revision: 3516
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3516&view=rev
Author: matzon
Date: 2011-04-16 18:38:48 +0000 (Sat, 16 Apr 2011)
Log Message:
-----------
fixing icons as per dr_evil [http://lwjgl.org/forum/index.php/topic,3925.0.html]
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2011-04-16 16:41:19 UTC (rev 3515)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2011-04-16 18:38:48 UTC (rev 3516)
@@ -668,16 +668,16 @@
int size = icon.limit() / 4;
if ( (((int)Math.sqrt(size)) == small_icon_size) && (!done_small) ) {
- freeSmallIcon();
small_icon = createIcon(small_icon_size, small_icon_size, icon.asIntBuffer());
sendMessage(hwnd, WM_SETICON, ICON_SMALL, small_icon);
+ freeSmallIcon();
used++;
done_small = true;
}
if ( (((int)Math.sqrt(size)) == large_icon_size) && (!done_large) ) {
- freeLargeIcon();
large_icon = createIcon(large_icon_size, large_icon_size, icon.asIntBuffer());
sendMessage(hwnd, WM_SETICON, ICON_BIG, large_icon);
+ freeLargeIcon();
used++;
done_large = true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-04-16 16:41:25
|
Revision: 3515
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3515&view=rev
Author: kappa1
Date: 2011-04-16 16:41:19 +0000 (Sat, 16 Apr 2011)
Log Message:
-----------
ANT build : switch to using the 10.4 sdk instead of the 10.3 one for ppc builds
Modified Paths:
--------------
trunk/LWJGL/platform_build/macosx_ant/build.xml
Modified: trunk/LWJGL/platform_build/macosx_ant/build.xml
===================================================================
--- trunk/LWJGL/platform_build/macosx_ant/build.xml 2011-04-08 03:41:19 UTC (rev 3514)
+++ trunk/LWJGL/platform_build/macosx_ant/build.xml 2011-04-16 16:41:19 UTC (rev 3515)
@@ -43,7 +43,7 @@
<target name="nativelibrary" depends="init">
<property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/>
- <property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.3.9.sdk"/>
+ <property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/>
<property name="x86_64_sdkroot" location="/Developer/SDKs/MacOSX10.5.sdk"/>
<property name="universal_flags" value="-isysroot ${universal_sdkroot}"/>
<property name="ppc_flags" value="-isysroot ${ppc_sdkroot}"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-04-08 03:41:25
|
Revision: 3514
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3514&view=rev
Author: spasi
Date: 2011-04-08 03:41:19 +0000 (Fri, 08 Apr 2011)
Log Message:
-----------
Fixed JDK5 compilation issue and added SpriteShootout textures.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java
Added Paths:
-----------
trunk/LWJGL/res/ball.png
trunk/LWJGL/res/ball_sm.png
Added: trunk/LWJGL/res/ball.png
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/res/ball.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/res/ball_sm.png
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/res/ball_sm.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java 2011-04-07 21:36:19 UTC (rev 3513)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java 2011-04-08 03:41:19 UTC (rev 3514)
@@ -479,7 +479,7 @@
final FloatBuffer depths = BufferUtils.createFloatBuffer(count * 2);
final float depthStep = 1.9f / count;
- float depth = Math.nextAfter(1.0f, Float.MIN_VALUE);
+ float depth = Float.parseFloat("0x1.fffffep-1");
// Front-to-back
for ( int i = 0; i < count; i++ ) {
depths.put(depth);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2011-04-07 21:36:27
|
Revision: 3513
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3513&view=rev
Author: spasi
Date: 2011-04-07 21:36:19 +0000 (Thu, 07 Apr 2011)
Log Message:
-----------
Added support for AMD_blend_minmax_factor & NV_texture_multisample.
Added sprite rendering samples.
Fixed ContextAttribs version checking for GL41.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_blend_minmax_factor.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_texture_multisample.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2011-04-02 11:33:02 UTC (rev 3512)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2011-04-07 21:36:19 UTC (rev 3513)
@@ -87,7 +87,7 @@
public ContextAttribs(final int majorVersion, final int minorVersion) {
if ( majorVersion < 0 || 4 < majorVersion ||
minorVersion < 0 ||
- (majorVersion == 4 && 0 < minorVersion) ||
+ (majorVersion == 4 && 1 < minorVersion) ||
(majorVersion == 3 && 3 < minorVersion) ||
(majorVersion == 2 && 1 < minorVersion) ||
(majorVersion == 1 && 5 < minorVersion) )
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java 2011-04-02 11:33:02 UTC (rev 3512)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/shaders/ShadersTest.java 2011-04-07 21:36:19 UTC (rev 3513)
@@ -137,7 +137,7 @@
System.out.println("Setting display mode to: " + displayMode);
Display.setDisplayMode(displayMode);
- Display.create(new PixelFormat(8, 24, 0), "UNI".equalsIgnoreCase(args[0]) ? new ContextAttribs(3, 1) : null);
+ Display.create(new PixelFormat(8, 24, 0));
ShadersTest.displayMode = displayMode;
} catch (LWJGLException e) {
kill(e.getMessage());
Added: trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout.java 2011-04-07 21:36:19 UTC (rev 3513)
@@ -0,0 +1,714 @@
+package org.lwjgl.test.opengl.sprites;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.Sys;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.*;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.Raster;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
+import java.util.Random;
+import javax.imageio.ImageIO;
+
+import static org.lwjgl.opengl.EXTTransformFeedback.*;
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.opengl.GL12.*;
+import static org.lwjgl.opengl.GL15.*;
+import static org.lwjgl.opengl.GL20.*;
+import static org.lwjgl.opengl.GL30.*;
+
+/**
+ * Sprite rendering demo. Three implementations are supported:
+ * a) CPU animation + BufferData VBO update.
+ * b) CPU animation + MapBufferRange VBO update.
+ * c) GPU animation using transform feedback with a vertex shader.
+ *
+ * @author Spasi
+ * @since 18/3/2011
+ */
+public final class SpriteShootout {
+
+ private static final int SCREEN_WIDTH = 800;
+ private static final int SCREEN_HEIGHT = 600;
+
+ private static final int ANIMATION_TICKS = 60;
+
+ private boolean run = true;
+ private boolean render = true;
+ private boolean colorMask = true;
+ private boolean animate = true;
+ private boolean smooth;
+ private boolean vsync;
+
+ private int ballSize = 42;
+ private int ballCount = 100 * 1000;
+
+ private SpriteRenderer renderer;
+
+ // OpenGL stuff
+ private int texID;
+ private int texBigID;
+ private int texSmallID;
+
+ private SpriteShootout() {
+ }
+
+ public static void main(String[] args) {
+ try {
+ new SpriteShootout().start();
+ } catch (LWJGLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void start() throws LWJGLException {
+ try {
+ initGL();
+
+ final ContextCapabilities caps = GLContext.getCapabilities();
+ if ( caps.OpenGL30 || caps.GL_EXT_transform_feedback )
+ renderer = new SpriteRendererTF();
+ else if ( caps.GL_ARB_map_buffer_range )
+ renderer = new SpriteRendererMapped();
+ else
+ renderer = new SpriteRendererPlain();
+
+ updateBalls(ballCount);
+ run();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ } finally {
+ destroy();
+ }
+ }
+
+ private void initGL() throws LWJGLException {
+ Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2,
+ (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2);
+ Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT));
+ Display.setTitle("Sprite Shootout");
+ Display.create();
+ //Display.create(new PixelFormat(), new ContextAttribs(4, 1).withProfileCompatibility(true).withDebug(true));
+ //AMDDebugOutput.glDebugMessageCallbackAMD(new AMDDebugOutputCallback());
+
+ if ( !GLContext.getCapabilities().OpenGL20 )
+ throw new RuntimeException("OpenGL 2.0 is required for this demo.");
+
+ // Setup viewport
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+
+ glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
+
+ // Create textures
+
+ try {
+ texSmallID = createTexture("res/ball_sm.png");
+ texBigID = createTexture("res/ball.png");
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ texID = texBigID;
+
+ // Setup rendering state
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+ glEnable(GL_ALPHA_TEST);
+ glAlphaFunc(GL_GREATER, 0.0f);
+
+ glColorMask(colorMask, colorMask, colorMask, false);
+ glDepthMask(false);
+ glDisable(GL_DEPTH_TEST);
+
+ // Setup geometry
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
+ Util.checkGLError();
+ }
+
+ private static int createTexture(final String path) throws IOException {
+ final BufferedImage img = ImageIO.read(SpriteShootout.class.getClassLoader().getResource(path));
+
+ final int w = img.getWidth();
+ final int h = img.getHeight();
+
+ final ByteBuffer buffer = readImage(img);
+
+ final int texID = glGenTextures();
+
+ glBindTexture(GL_TEXTURE_2D, texID);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer);
+
+ return texID;
+ }
+
+ private static ByteBuffer readImage(final BufferedImage img) throws IOException {
+ final Raster raster = img.getRaster();
+
+ final int bands = raster.getNumBands();
+
+ final int w = img.getWidth();
+ final int h = img.getHeight();
+
+ final int size = w * h * bands;
+
+ final byte[] pixels = new byte[size];
+ raster.getDataElements(0, 0, w, h, pixels);
+
+ final ByteBuffer pbuffer = BufferUtils.createByteBuffer(size);
+
+ if ( bands == 4 ) {
+ for ( int i = 0; i < (w * h * 4); i += 4 ) {
+ // Pre-multiply alpha
+ final float a = unpackUByte01(pixels[i + 3]);
+ pbuffer.put(packUByte01(unpackUByte01(pixels[i + 2]) * a));
+ pbuffer.put(packUByte01(unpackUByte01(pixels[i + 1]) * a));
+ pbuffer.put(packUByte01(unpackUByte01(pixels[i + 0]) * a));
+ pbuffer.put(pixels[i + 3]);
+ }
+ } else if ( bands == 3 ) {
+ for ( int i = 0; i < (w * h * 3); i += 3 ) {
+ pbuffer.put(pixels[i + 2]);
+ pbuffer.put(pixels[i + 1]);
+ pbuffer.put(pixels[i + 0]);
+ }
+ } else
+ pbuffer.put(pixels, 0, size);
+
+ pbuffer.flip();
+
+ return pbuffer;
+ }
+
+ private static float unpackUByte01(final byte x) {
+ return (x & 0xFF) / 255.0f;
+ }
+
+ private static byte packUByte01(final float x) {
+ return (byte)(x * 255.0f);
+ }
+
+ private void updateBalls(final int count) {
+ System.out.println("NUMBER OF BALLS: " + count);
+ renderer.updateBalls(ballCount);
+ }
+
+ private void run() {
+ long startTime = System.currentTimeMillis() + 5000;
+ long fps = 0;
+
+ long time = Sys.getTime();
+ final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS);
+
+ renderer.render(false, true, 0);
+
+ while ( run ) {
+ Display.processMessages();
+ handleInput();
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ final long currTime = Sys.getTime();
+ final int delta = (int)(currTime - time);
+ if ( smooth || delta >= ticksPerUpdate ) {
+ renderer.render(render, animate, delta);
+ time = currTime;
+ } else
+ renderer.render(render, false, 0);
+
+ Display.update(false);
+ //Display.sync(60);
+
+ if ( startTime > System.currentTimeMillis() ) {
+ fps++;
+ } else {
+ long timeUsed = 5000 + (startTime - System.currentTimeMillis());
+ startTime = System.currentTimeMillis() + 5000;
+ System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount);
+ fps = 0;
+ }
+ }
+ }
+
+ private void handleInput() {
+ if ( Display.isCloseRequested() )
+ run = false;
+
+ while ( Keyboard.next() ) {
+ if ( Keyboard.getEventKeyState() )
+ continue;
+
+ switch ( Keyboard.getEventKey() ) {
+ case Keyboard.KEY_1:
+ case Keyboard.KEY_2:
+ case Keyboard.KEY_3:
+ case Keyboard.KEY_4:
+ case Keyboard.KEY_5:
+ case Keyboard.KEY_6:
+ case Keyboard.KEY_7:
+ case Keyboard.KEY_8:
+ case Keyboard.KEY_9:
+ case Keyboard.KEY_0:
+ ballCount = 1 << (Keyboard.getEventKey() - Keyboard.KEY_1);
+ updateBalls(ballCount);
+ break;
+ case Keyboard.KEY_ADD:
+ case Keyboard.KEY_SUBTRACT:
+ int mult;
+ if ( Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) )
+ mult = 1000;
+ else if ( Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU) )
+ mult = 100;
+ else if ( Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) )
+ mult = 10;
+ else
+ mult = 1;
+ if ( Keyboard.getEventKey() == Keyboard.KEY_SUBTRACT )
+ mult = -mult;
+ ballCount += mult * 100;
+ if ( ballCount <= 0 )
+ ballCount = 1;
+ updateBalls(ballCount);
+ break;
+ case Keyboard.KEY_ESCAPE:
+ run = false;
+ break;
+ case Keyboard.KEY_A:
+ animate = !animate;
+ System.out.println("Animation is now " + (animate ? "on" : "off") + ".");
+ break;
+ case Keyboard.KEY_C:
+ colorMask = !colorMask;
+ glColorMask(colorMask, colorMask, colorMask, false);
+ System.out.println("Color mask is now " + (colorMask ? "on" : "off") + ".");
+ // Disable alpha test when color mask is off, else we get no benefit.
+ if ( colorMask ) {
+ glEnable(GL_BLEND);
+ glEnable(GL_ALPHA_TEST);
+ } else {
+ glDisable(GL_BLEND);
+ glDisable(GL_ALPHA_TEST);
+ }
+ break;
+ case Keyboard.KEY_R:
+ render = !render;
+ System.out.println("Rendering is now " + (render ? "on" : "off") + ".");
+ break;
+ case Keyboard.KEY_S:
+ smooth = !smooth;
+ System.out.println("Smooth animation is now " + (smooth ? "on" : "off") + ".");
+ break;
+ case Keyboard.KEY_T:
+ if ( texID == texBigID ) {
+ texID = texSmallID;
+ ballSize = 16;
+ } else {
+ texID = texBigID;
+ ballSize = 42;
+ }
+ renderer.updateBallSize();
+ glBindTexture(GL_TEXTURE_2D, texID);
+ System.out.println("Now using the " + (texID == texBigID ? "big" : "small") + " texture.");
+ break;
+ case Keyboard.KEY_V:
+ vsync = !vsync;
+ Display.setVSyncEnabled(vsync);
+ System.out.println("VSYNC is now " + (vsync ? "enabled" : "disabled") + ".");
+ break;
+ }
+ }
+
+ while ( Mouse.next() ) ;
+ }
+
+ private void destroy() {
+ Display.destroy();
+ }
+
+ private abstract class SpriteRenderer {
+
+ protected float[] transform = { };
+
+ protected int vshID;
+ protected int progID;
+
+ protected void createProgram() {
+ final int fshID = glCreateShader(GL_FRAGMENT_SHADER);
+ glShaderSource(fshID, "uniform sampler2D COLOR_MAP;\n" +
+ "void main(void) {\n" +
+ " gl_FragColor = texture2D(COLOR_MAP, gl_PointCoord);\n" +
+ "}");
+ glCompileShader(fshID);
+ if ( glGetShader(fshID, GL_COMPILE_STATUS) == GL_FALSE ) {
+ System.out.println(glGetShaderInfoLog(fshID, glGetShader(fshID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to compile fragment shader.");
+ }
+
+ progID = glCreateProgram();
+ glAttachShader(progID, vshID);
+ glAttachShader(progID, fshID);
+ glLinkProgram(progID);
+ if ( glGetProgram(progID, GL_LINK_STATUS) == GL_FALSE ) {
+ System.out.println(glGetProgramInfoLog(progID, glGetProgram(progID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to link shader program.");
+ }
+
+ glUseProgram(progID);
+ glUniform1i(glGetUniformLocation(progID, "COLOR_MAP"), 0);
+
+ updateBallSize();
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ }
+
+ public void updateBallSize() {
+ glPointSize(ballSize);
+ }
+
+ public void updateBalls(final int count) {
+ final Random random = new Random();
+
+ final float[] newTransform = new float[count * 4];
+ System.arraycopy(transform, 0, newTransform, 0, Math.min(transform.length, newTransform.length));
+ if ( newTransform.length > transform.length ) {
+ for ( int i = transform.length; i < newTransform.length; ) {
+ newTransform[i++] = (int)(random.nextFloat() * (SCREEN_WIDTH - ballSize) + ballSize * 0.5f);
+ newTransform[i++] = (int)(random.nextFloat() * (SCREEN_HEIGHT - ballSize) + ballSize * 0.5f);
+ newTransform[i++] = random.nextFloat() * 0.4f - 0.2f;
+ newTransform[i++] = random.nextFloat() * 0.4f - 0.2f;
+ }
+ }
+ transform = newTransform;
+ }
+
+ protected void animate(final FloatBuffer geom, final int ballIndex, final int batchSize, final int delta) {
+ final float[] transform = this.transform;
+
+ final float ballRadius = ballSize * 0.5f;
+ final float boundW = SCREEN_WIDTH - ballRadius;
+ final float boundH = SCREEN_HEIGHT - ballRadius;
+
+ for ( int b = ballIndex * 4, len = (ballIndex + batchSize) * 4; b < len; b += 4 ) {
+ float x = transform[b + 0];
+ float dx = transform[b + 2];
+
+ x += dx * delta;
+ if ( x < ballRadius ) {
+ x = ballRadius;
+ transform[b + 2] = -dx;
+ } else if ( x > boundW ) {
+ x = boundW;
+ transform[b + 2] = -dx;
+ }
+ transform[b + 0] = x;
+
+ float y = transform[b + 1];
+ float dy = transform[b + 3];
+
+ y += dy * delta;
+ if ( y < ballRadius ) {
+ y = ballRadius;
+ transform[b + 3] = -dy;
+ } else if ( y > boundH ) {
+ y = boundH;
+ transform[b + 3] = -dy;
+ }
+ transform[b + 1] = y;
+
+ geom.put(x).put(y);
+ }
+ geom.clear();
+ }
+
+ protected abstract void render(boolean render, boolean animate, int delta);
+
+ }
+
+ private abstract class SpriteRendererBatched extends SpriteRenderer {
+
+ protected static final int BALLS_PER_BATCH = 10 * 1000;
+
+ SpriteRendererBatched() {
+ vshID = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(vshID, "void main(void) {\n" +
+ " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" +
+ "}");
+ glCompileShader(vshID);
+ if ( glGetShader(vshID, GL_COMPILE_STATUS) == GL_FALSE ) {
+ System.out.println(glGetShaderInfoLog(vshID, glGetShader(vshID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to compile vertex shader.");
+ }
+
+ createProgram();
+ }
+
+ }
+
+ private class SpriteRendererPlain extends SpriteRendererBatched {
+
+ private final FloatBuffer geom;
+
+ protected int[] animVBO;
+
+ SpriteRendererPlain() {
+ System.out.println("Shootout Implementation: CPU animation & BufferData");
+ geom = BufferUtils.createFloatBuffer(BALLS_PER_BATCH * 4 * 2);
+ }
+
+ public void updateBalls(final int count) {
+ super.updateBalls(count);
+
+ final int batchCount = count / BALLS_PER_BATCH + (count % BALLS_PER_BATCH == 0 ? 0 : 1);
+ if ( animVBO != null && batchCount == animVBO.length )
+ return;
+
+ final int[] newAnimVBO = new int[batchCount];
+ if ( animVBO != null ) {
+ System.arraycopy(animVBO, 0, newAnimVBO, 0, Math.min(animVBO.length, newAnimVBO.length));
+ for ( int i = newAnimVBO.length; i < animVBO.length; i++ )
+ glDeleteBuffers(animVBO[i]);
+ }
+ for ( int i = animVBO == null ? 0 : animVBO.length; i < newAnimVBO.length; i++ ) {
+ newAnimVBO[i] = glGenBuffers();
+ glBindBuffer(GL_ARRAY_BUFFER, newAnimVBO[i]);
+ }
+
+ animVBO = newAnimVBO;
+ }
+
+ public void render(final boolean render, final boolean animate, final int delta) {
+ int batchSize = Math.min(ballCount, BALLS_PER_BATCH);
+ int ballIndex = 0;
+ int vboIndex = 0;
+ while ( ballIndex < ballCount ) {
+ glBindBuffer(GL_ARRAY_BUFFER, animVBO[vboIndex++]);
+
+ if ( animate )
+ animate(ballIndex, batchSize, delta);
+
+ if ( render ) {
+ glVertexPointer(2, GL_FLOAT, 0, 0);
+ glDrawArrays(GL_POINTS, 0, batchSize);
+ }
+
+ ballIndex += batchSize;
+ batchSize = Math.min(ballCount - ballIndex, BALLS_PER_BATCH);
+ }
+ }
+
+ private void animate(final int ballIndex, final int batchSize, final int delta) {
+ animate(geom, ballIndex, batchSize, delta);
+
+ glBufferData(GL_ARRAY_BUFFER, geom.capacity() * 4, GL_STREAM_DRAW);
+ glBufferSubData(GL_ARRAY_BUFFER, 0, geom);
+ }
+ }
+
+ private class SpriteRendererMapped extends SpriteRendererBatched {
+
+ private ByteBuffer[] mapBuffer;
+ private FloatBuffer[] geomBuffer;
+
+ protected int animVBO;
+
+ SpriteRendererMapped() {
+ System.out.println("Shootout Implementation: CPU animation & MapBufferRange");
+ }
+
+ public void updateBalls(final int count) {
+ super.updateBalls(count);
+
+ final int batchCount = count / BALLS_PER_BATCH + (count % BALLS_PER_BATCH == 0 ? 0 : 1);
+ mapBuffer = new ByteBuffer[batchCount];
+ geomBuffer = new FloatBuffer[batchCount];
+
+ animVBO = glGenBuffers();
+ glBindBuffer(GL_ARRAY_BUFFER, animVBO);
+ glBufferData(GL_ARRAY_BUFFER, ballCount * (2 * 4), GL_DYNAMIC_DRAW);
+ glVertexPointer(2, GL_FLOAT, 0, 0);
+ }
+
+ public void render(final boolean render, final boolean animate, final int delta) {
+ int batchSize = Math.min(ballCount, BALLS_PER_BATCH);
+ int ballIndex = 0;
+ int batchIndex = 0;
+ while ( ballIndex < ballCount ) {
+ if ( animate ) {
+ final ByteBuffer buffer = glMapBufferRange(GL_ARRAY_BUFFER,
+ ballIndex * (2 * 4),
+ batchSize * (2 * 4),
+ GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT,
+ mapBuffer[batchIndex]);
+ if ( buffer != mapBuffer[batchIndex] ) {
+ mapBuffer[batchIndex] = buffer;
+ geomBuffer[batchIndex] = mapBuffer[batchIndex].asFloatBuffer();
+ }
+
+ animate(geomBuffer[batchIndex], ballIndex, batchSize, delta);
+
+ glUnmapBuffer(GL_ARRAY_BUFFER);
+ }
+
+ if ( render )
+ glDrawArrays(GL_POINTS, ballIndex, batchSize);
+
+ batchIndex++;
+ ballIndex += batchSize;
+ batchSize = Math.min(ballCount - ballIndex, BALLS_PER_BATCH);
+ }
+ }
+ }
+
+ private class SpriteRendererTF extends SpriteRenderer {
+
+ private int progIDTF;
+ private int ballSizeLoc;
+ private int deltaLoc;
+
+ private int[] tfVBO = new int[2];
+ private int currVBO;
+
+ SpriteRendererTF() {
+ System.out.println("Shootout Implementation: TF GPU animation");
+
+ // Transform-feedback program
+
+ final int vshID = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(vshID, "#version 130\n" +
+ "const float WIDTH = " + SCREEN_WIDTH + ";\n" +
+ "const float HEIGHT = " + SCREEN_HEIGHT + ";\n" +
+ "uniform float ballSize;\n" + // ballSize / 2
+ "uniform float delta;\n" +
+ "void main(void) {\n" +
+ " vec4 anim = gl_Vertex;\n" +
+ " anim.xy = anim.xy + anim.zw * delta;\n" +
+ " vec2 animC = clamp(anim.xy, vec2(ballSize), vec2(WIDTH - ballSize, HEIGHT - ballSize));\n" +
+ " if ( anim.x != animC.x ) anim.z = -anim.z;\n" +
+ " if ( anim.y != animC.y ) anim.w = -anim.w;\n" +
+ " gl_Position = vec4(animC, anim.zw);\n" +
+ "}");
+ glCompileShader(vshID);
+ if ( glGetShader(vshID, GL_COMPILE_STATUS) == GL_FALSE ) {
+ System.out.println(glGetShaderInfoLog(vshID, glGetShader(vshID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to compile vertex shader.");
+ }
+
+ progIDTF = glCreateProgram();
+ glAttachShader(progIDTF, vshID);
+ glTransformFeedbackVaryings(progIDTF, new CharSequence[] { "gl_Position" }, GL_SEPARATE_ATTRIBS);
+ glLinkProgram(progIDTF);
+ if ( glGetProgram(progIDTF, GL_LINK_STATUS) == GL_FALSE ) {
+ System.out.println(glGetProgramInfoLog(progIDTF, glGetProgram(progIDTF, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to link shader program.");
+ }
+
+ glUseProgram(progIDTF);
+
+ ballSizeLoc = glGetUniformLocation(progIDTF, "ballSize");
+ deltaLoc = glGetUniformLocation(progIDTF, "delta");
+
+ glUniform1f(ballSizeLoc, ballSize * 0.5f);
+
+ // -----------------
+
+ this.vshID = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(this.vshID, "void main(void) {\n" +
+ " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" +
+ "}");
+ glCompileShader(this.vshID);
+ if ( glGetShader(this.vshID, GL_COMPILE_STATUS) == GL_FALSE ) {
+ System.out.println(glGetShaderInfoLog(this.vshID, glGetShader(this.vshID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to compile vertex shader.");
+ }
+
+ createProgram();
+ }
+
+ public void updateBallSize() {
+ glUseProgram(progIDTF);
+ glUniform1f(ballSizeLoc, ballSize * 0.5f);
+
+ glUseProgram(progID);
+ super.updateBallSize();
+ }
+
+ public void updateBalls(final int count) {
+ super.updateBalls(count);
+
+ if ( tfVBO[0] != 0 ) {
+ for ( int i = 0; i < tfVBO.length; i++ )
+ glDeleteBuffers(tfVBO[i]);
+ }
+
+ final FloatBuffer transform = BufferUtils.createFloatBuffer(count * 4);
+ transform.put(this.transform);
+ transform.flip();
+
+ for ( int i = 0; i < tfVBO.length; i++ ) {
+ tfVBO[i] = glGenBuffers();
+ glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, tfVBO[i]);
+ glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, transform, GL_STATIC_DRAW);
+ }
+
+ glBindBuffer(GL_ARRAY_BUFFER, tfVBO[0]);
+ glVertexPointer(2, GL_FLOAT, (4 * 4), 0);
+ }
+
+ public void render(final boolean render, final boolean animate, final int delta) {
+ if ( animate ) {
+ glUseProgram(progIDTF);
+ glUniform1f(deltaLoc, delta);
+
+ final int vbo = currVBO;
+ currVBO = 1 - currVBO;
+
+ glBindBuffer(GL_ARRAY_BUFFER, tfVBO[vbo]);
+ glVertexPointer(4, GL_FLOAT, 0, 0);
+
+ glEnable(GL_RASTERIZER_DISCARD);
+ if ( GLContext.getCapabilities().OpenGL30 ) {
+ glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfVBO[1 - vbo]);
+
+ glBeginTransformFeedback(GL_POINTS);
+ glDrawArrays(GL_POINTS, 0, ballCount);
+ glEndTransformFeedback();
+ } else {
+ glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, tfVBO[1 - vbo]);
+
+ glBeginTransformFeedbackEXT(GL_POINTS);
+ glDrawArrays(GL_POINTS, 0, ballCount);
+ glEndTransformFeedbackEXT();
+ }
+ glDisable(GL_RASTERIZER_DISCARD);
+
+ glUseProgram(progID);
+ glVertexPointer(2, GL_FLOAT, (4 * 4), 0);
+ }
+
+ if ( render )
+ glDrawArrays(GL_POINTS, 0, ballCount);
+ }
+
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootout2P.java 2011-04-07 21:36:19 UTC (rev 3513)
@@ -0,0 +1,591 @@
+package org.lwjgl.test.opengl.sprites;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.Sys;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opengl.*;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.Raster;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
+import java.util.Random;
+import javax.imageio.ImageIO;
+
+import static org.lwjgl.opengl.EXTTransformFeedback.*;
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.opengl.GL15.*;
+import static org.lwjgl.opengl.GL20.*;
+import static org.lwjgl.opengl.GL30.*;
+import static org.lwjgl.opengl.GL32.*;
+
+/**
+ * Sprite rendering demo. In this version we're doing the animation
+ * computations on the GPU, using transform feedback and a vertex
+ * shader, then rendering is performed in 2 passes, with depth testing
+ * enabled:
+ * 1) Sprites are rendered front-to-back, opaque fragments only, blending is disabled.
+ * 2) Sprites are rendered back-to-front, transparent fragments only, blending is enabled.
+ * Sorting is free, because we're animating double the amount of sprites rendered, the
+ * first batch is sorted f2b, the second is sorted b2f. Ordering is achieved by modifying
+ * the z-axis position of the sprites in the vertex shader.
+ *
+ * @author Spasi
+ * @since 18/3/2011
+ */
+public final class SpriteShootout2P {
+
+ private static final int SCREEN_WIDTH = 800;
+ private static final int SCREEN_HEIGHT = 600;
+
+ private static final int ANIMATION_TICKS = 60;
+
+ private boolean run = true;
+ private boolean render = true;
+ private boolean colorMask = true;
+ private boolean animate = true;
+ private boolean smooth;
+ private boolean vsync;
+
+ private int ballSize = 42;
+ private int ballCount = 100 * 1000;
+
+ private SpriteRenderer renderer;
+
+ // OpenGL stuff
+ private int texID;
+ private int texBigID;
+ private int texSmallID;
+
+ private SpriteShootout2P() {
+ }
+
+ public static void main(String[] args) {
+ try {
+ new SpriteShootout2P().start();
+ } catch (LWJGLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void start() throws LWJGLException {
+ try {
+ initGL();
+
+ renderer = new SpriteRendererTF();
+
+ updateBalls(ballCount);
+ run();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ } finally {
+ destroy();
+ }
+ }
+
+ private void initGL() throws LWJGLException {
+ Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2,
+ (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2);
+ Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT));
+ Display.setTitle("Sprite Shootout 2-pass");
+ Display.create(new PixelFormat(0, 24, 0));
+ //Display.create(new PixelFormat(), new ContextAttribs(4, 1).withProfileCompatibility(true).withDebug(true));
+ //AMDDebugOutput.glDebugMessageCallbackAMD(new AMDDebugOutputCallback());
+
+ final ContextCapabilities caps = GLContext.getCapabilities();
+ if ( !(caps.OpenGL30 || (caps.OpenGL20 && caps.GL_EXT_transform_feedback)) )
+ throw new RuntimeException("OpenGL 3.0 or 2.0 + EXT_transform_feedback is required for this demo.");
+
+ // Setup viewport
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+
+ glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
+
+ // Create textures
+
+ try {
+ texSmallID = createTexture("res/ball_sm.png");
+ texBigID = createTexture("res/ball.png");
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ texID = texBigID;
+
+ // Setup rendering state
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+ glEnable(GL_ALPHA_TEST);
+
+ glColorMask(colorMask, colorMask, colorMask, false);
+ glDepthMask(true);
+ glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_LESS);
+ glClearDepth(1.0f);
+
+ // Setup geometry
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
+ Util.checkGLError();
+ }
+
+ private static int createTexture(final String path) throws IOException {
+ final BufferedImage img = ImageIO.read(SpriteShootout2P.class.getClassLoader().getResource(path));
+
+ final int w = img.getWidth();
+ final int h = img.getHeight();
+
+ final ByteBuffer buffer = readImage(img);
+
+ final int texID = glGenTextures();
+
+ glBindTexture(GL_TEXTURE_2D, texID);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer);
+
+ return texID;
+ }
+
+ private static ByteBuffer readImage(final BufferedImage img) throws IOException {
+ final Raster raster = img.getRaster();
+
+ final int bands = raster.getNumBands();
+
+ final int w = img.getWidth();
+ final int h = img.getHeight();
+
+ final int size = w * h * bands;
+
+ final byte[] pixels = new byte[size];
+ raster.getDataElements(0, 0, w, h, pixels);
+
+ final ByteBuffer pbuffer = BufferUtils.createByteBuffer(size);
+
+ if ( bands == 4 ) {
+ for ( int i = 0; i < (w * h * 4); i += 4 ) {
+ // Pre-multiply alpha
+ final float a = unpackUByte01(pixels[i + 3]);
+ pbuffer.put(packUByte01(unpackUByte01(pixels[i + 2]) * a));
+ pbuffer.put(packUByte01(unpackUByte01(pixels[i + 1]) * a));
+ pbuffer.put(packUByte01(unpackUByte01(pixels[i + 0]) * a));
+ pbuffer.put(pixels[i + 3]);
+ }
+ } else if ( bands == 3 ) {
+ for ( int i = 0; i < (w * h * 3); i += 3 ) {
+ pbuffer.put(pixels[i + 2]);
+ pbuffer.put(pixels[i + 1]);
+ pbuffer.put(pixels[i + 0]);
+ }
+ } else
+ pbuffer.put(pixels, 0, size);
+
+ pbuffer.flip();
+
+ return pbuffer;
+ }
+
+ private static float unpackUByte01(final byte x) {
+ return (x & 0xFF) / 255.0f;
+ }
+
+ private static byte packUByte01(final float x) {
+ return (byte)(x * 255.0f);
+ }
+
+ private void updateBalls(final int count) {
+ System.out.println("NUMBER OF BALLS: " + count);
+ renderer.updateBalls(ballCount);
+ }
+
+ private void run() {
+ long startTime = System.currentTimeMillis() + 5000;
+ long fps = 0;
+
+ long time = Sys.getTime();
+ final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS);
+
+ renderer.render(false, true, 0);
+
+ while ( run ) {
+ Display.processMessages();
+ handleInput();
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ final long currTime = Sys.getTime();
+ final int delta = (int)(currTime - time);
+ if ( smooth || delta >= ticksPerUpdate ) {
+ renderer.render(render, animate, delta);
+ time = currTime;
+ } else
+ renderer.render(render, false, 0);
+
+ Display.update(false);
+ //Display.sync(60);
+
+ if ( startTime > System.currentTimeMillis() ) {
+ fps++;
+ } else {
+ long timeUsed = 5000 + (startTime - System.currentTimeMillis());
+ startTime = System.currentTimeMillis() + 5000;
+ System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount);
+ fps = 0;
+ }
+ }
+ }
+
+ private void handleInput() {
+ if ( Display.isCloseRequested() )
+ run = false;
+
+ while ( Keyboard.next() ) {
+ if ( Keyboard.getEventKeyState() )
+ continue;
+
+ switch ( Keyboard.getEventKey() ) {
+ case Keyboard.KEY_1:
+ case Keyboard.KEY_2:
+ case Keyboard.KEY_3:
+ case Keyboard.KEY_4:
+ case Keyboard.KEY_5:
+ case Keyboard.KEY_6:
+ case Keyboard.KEY_7:
+ case Keyboard.KEY_8:
+ case Keyboard.KEY_9:
+ case Keyboard.KEY_0:
+ ballCount = 1 << (Keyboard.getEventKey() - Keyboard.KEY_1);
+ updateBalls(ballCount);
+ break;
+ case Keyboard.KEY_ADD:
+ case Keyboard.KEY_SUBTRACT:
+ int mult;
+ if ( Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) ) {
+ mult = 1000;
+ if ( Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) )
+ mult *= 5;
+ } else if ( Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU) )
+ mult = 100;
+ else if ( Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) )
+ mult = 10;
+ else
+ mult = 1;
+ if ( Keyboard.getEventKey() == Keyboard.KEY_SUBTRACT )
+ mult = -mult;
+ ballCount += mult * 100;
+ if ( ballCount <= 0 )
+ ballCount = 1;
+ updateBalls(ballCount);
+ break;
+ case Keyboard.KEY_ESCAPE:
+ run = false;
+ break;
+ case Keyboard.KEY_A:
+ animate = !animate;
+ System.out.println("Animation is now " + (animate ? "on" : "off") + ".");
+ break;
+ case Keyboard.KEY_C:
+ colorMask = !colorMask;
+ glColorMask(colorMask, colorMask, colorMask, false);
+ System.out.println("Color mask is now " + (colorMask ? "on" : "off") + ".");
+ // Disable alpha test when color mask is off, else we get no benefit.
+ if ( colorMask ) {
+ glEnable(GL_BLEND);
+ glEnable(GL_ALPHA_TEST);
+ } else {
+ glDisable(GL_BLEND);
+ glDisable(GL_ALPHA_TEST);
+ }
+ break;
+ case Keyboard.KEY_R:
+ render = !render;
+ System.out.println("Rendering is now " + (render ? "on" : "off") + ".");
+ break;
+ case Keyboard.KEY_S:
+ smooth = !smooth;
+ System.out.println("Smooth animation is now " + (smooth ? "on" : "off") + ".");
+ break;
+ case Keyboard.KEY_T:
+ if ( texID == texBigID ) {
+ texID = texSmallID;
+ ballSize = 16;
+ } else {
+ texID = texBigID;
+ ballSize = 42;
+ }
+ renderer.updateBallSize();
+ glBindTexture(GL_TEXTURE_2D, texID);
+ System.out.println("Now using the " + (texID == texBigID ? "big" : "small") + " texture.");
+ break;
+ case Keyboard.KEY_V:
+ vsync = !vsync;
+ Display.setVSyncEnabled(vsync);
+ System.out.println("VSYNC is now " + (vsync ? "enabled" : "disabled") + ".");
+ break;
+ }
+ }
+
+ while ( Mouse.next() ) ;
+ }
+
+ private void destroy() {
+ Display.destroy();
+ }
+
+ private abstract class SpriteRenderer {
+
+ protected int progID;
+
+ protected void createPrograms(final int vshID) {
+ // Opaque pass
+
+ final int fshID = glCreateShader(GL_FRAGMENT_SHADER);
+ glShaderSource(fshID, "uniform sampler2D COLOR_MAP;\n" +
+ "void main(void) {\n" +
+ " gl_FragColor = texture2D(COLOR_MAP, gl_PointCoord);\n" +
+ "}");
+ glCompileShader(fshID);
+ if ( glGetShader(fshID, GL_COMPILE_STATUS) == GL_FALSE ) {
+ System.out.println(glGetShaderInfoLog(fshID, glGetShader(fshID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to compile fragment shader.");
+ }
+
+ progID = glCreateProgram();
+ glAttachShader(progID, vshID);
+ glAttachShader(progID, fshID);
+ glLinkProgram(progID);
+ if ( glGetProgram(progID, GL_LINK_STATUS) == GL_FALSE ) {
+ System.out.println(glGetProgramInfoLog(progID, glGetProgram(progID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to link shader program.");
+ }
+
+ glUseProgram(progID);
+ glUniform1i(glGetUniformLocation(progID, "COLOR_MAP"), 0);
+
+ updateBallSize();
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ }
+
+ public void updateBallSize() {
+ glPointSize(ballSize);
+ }
+
+ protected abstract void updateBalls(final int count);
+
+ protected abstract void render(boolean render, boolean animate, int delta);
+
+ }
+
+ private class SpriteRendererTF extends SpriteRenderer {
+
+ private int progIDTF;
+ private int ballSizeLoc;
+ private int deltaLoc;
+
+ private int[] tfVBO = new int[2];
+ private int currVBO;
+
+ private int depthVBO;
+ private int depthLoc;
+
+ SpriteRendererTF() {
+ System.out.println("Shootout Implementation: TF GPU animation & 2-pass rendering");
+
+ // Transform-feedback program
+
+ int vshID = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(vshID, "#version 130\n" +
+ "const float WIDTH = " + SCREEN_WIDTH + ";\n" +
+ "const float HEIGHT = " + SCREEN_HEIGHT + ";\n" +
+ "uniform float ballSize;\n" + // ballSize / 2
+ "uniform float delta;\n" +
+ "void main(void) {\n" +
+ " vec4 anim = gl_Vertex;\n" +
+ " anim.xy = anim.xy + anim.zw * delta;\n" +
+ " vec2 animC = clamp(anim.xy, vec2(ballSize), vec2(WIDTH - ballSize, HEIGHT - ballSize));\n" +
+ " if ( anim.x != animC.x ) anim.z = -anim.z;\n" +
+ " if ( anim.y != animC.y ) anim.w = -anim.w;\n" +
+ " gl_Position = vec4(animC, anim.zw);\n" +
+ "}");
+ glCompileShader(vshID);
+ if ( glGetShader(vshID, GL_COMPILE_STATUS) == GL_FALSE ) {
+ System.out.println(glGetShaderInfoLog(vshID, glGetShader(vshID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to compile vertex shader.");
+ }
+
+ progIDTF = glCreateProgram();
+ glAttachShader(progIDTF, vshID);
+ glTransformFeedbackVaryings(progIDTF, new CharSequence[] { "gl_Position" }, GL_SEPARATE_ATTRIBS);
+ glLinkProgram(progIDTF);
+ if ( glGetProgram(progIDTF, GL_LINK_STATUS) == GL_FALSE ) {
+ System.out.println(glGetProgramInfoLog(progIDTF, glGetProgram(progIDTF, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to link shader program.");
+ }
+
+ glUseProgram(progIDTF);
+
+ ballSizeLoc = glGetUniformLocation(progIDTF, "ballSize");
+ deltaLoc = glGetUniformLocation(progIDTF, "delta");
+
+ glUniform1f(ballSizeLoc, ballSize * 0.5f);
+
+ // -----------------
+
+ vshID = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(vshID, "#version 130\n" +
+ "in float depth;\n" +
+ "void main(void) {\n" +
+ " gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xy, depth, gl_Vertex.w);\n" +
+ "}");
+ glCompileShader(vshID);
+ if ( glGetShader(vshID, GL_COMPILE_STATUS) == GL_FALSE ) {
+ System.out.println(glGetShaderInfoLog(vshID, glGetShader(vshID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to compile vertex shader.");
+ }
+
+ createPrograms(vshID);
+
+ depthLoc = glGetAttribLocation(progID, "depth");
+
+ // -----------------
+ }
+
+ public void updateBallSize() {
+ glUseProgram(progIDTF);
+ glUniform1f(ballSizeLoc, ballSize * 0.5f);
+
+ super.updateBallSize();
+ }
+
+ public void updateBalls(final int count) {
+ // Depth data
+
+ final FloatBuffer depths = BufferUtils.createFloatBuffer(count * 2);
+ final float depthStep = 1.9f / count;
+ float depth = Math.nextAfter(1.0f, Float.MIN_VALUE);
+ // Front-to-back
+ for ( int i = 0; i < count; i++ ) {
+ depths.put(depth);
+ depth -= depthStep;
+ }
+ // Back-to-front
+ for ( int i = 0; i < count; i++ )
+ depths.put(depths.get(count - 1 - i));
+ depths.flip();
+
+ if ( depthVBO != 0 )
+ glDeleteBuffers(depthVBO);
+
+ depthVBO = glGenBuffers();
+ glBindBuffer(GL_ARRAY_BUFFER, depthVBO);
+ glBufferData(GL_ARRAY_BUFFER, depths, GL_STATIC_DRAW);
+
+ glEnableVertexAttribArray(depthLoc);
+ glVertexAttribPointer(depthLoc, 1, GL_FLOAT, false, 0, 0);
+
+ // Animation data
+
+ final FloatBuffer transform = BufferUtils.createFloatBuffer(count * 2 * 4);
+ // Front-to-back
+ final Random random = new Random();
+ for ( int i = 0; i < count; i++ ) {
+ transform.put((int)(random.nextFloat() * (SCREEN_WIDTH - ballSize) + ballSize * 0.5f));
+ transform.put((int)(random.nextFloat() * (SCREEN_HEIGHT - ballSize) + ballSize * 0.5f));
+ transform.put(random.nextFloat() * 0.4f - 0.2f);
+ transform.put(random.nextFloat() * 0.4f - 0.2f);
+ }
+ // Back-to-front
+ for ( int i = 0; i < count; i++ ) {
+ final int offset = (count - 1 - i) * 4;
+ transform.put(transform.get(offset + 0));
+ transform.put(transform.get(offset + 1));
+ transform.put(transform.get(offset + 2));
+ transform.put(transform.get(offset + 3));
+ }
+ transform.flip();
+
+ if ( tfVBO[0] != 0 ) {
+ for ( int i = 0; i < tfVBO.length; i++ )
+ glDeleteBuffers(tfVBO[i]);
+ }
+
+ for ( int i = 0; i < tfVBO.length; i++ ) {
+ tfVBO[i] = glGenBuffers();
+ glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, tfVBO[i]);
+ glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, transform, GL_STATIC_DRAW);
+ }
+
+ glBindBuffer(GL_ARRAY_BUFFER, tfVBO[0]);
+ glVertexPointer(2, GL_FLOAT, (4 * 4), 0);
+ }
+
+ public void render(final boolean render, final boolean animate, final int delta) {
+ if ( animate ) {
+ glDisableVertexAttribArray(depthLoc);
+
+ final int vbo = currVBO;
+ currVBO = 1 - currVBO;
+
+ glUseProgram(progIDTF);
+ glUniform1f(deltaLoc, delta);
+
+ glBindBuffer(GL_ARRAY_BUFFER, tfVBO[vbo]);
+ glVertexPointer(4, GL_FLOAT, 0, 0);
+
+ glEnable(GL_RASTERIZER_DISCARD);
+ if ( GLContext.getCapabilities().OpenGL30 ) {
+ glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfVBO[1 - vbo]);
+
+ glBeginTransformFeedback(GL_POINTS);
+ glDrawArrays(GL_POINTS, 0, ballCount * 2);
+ glEndTransformFeedback();
+ } else {
+ glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, tfVBO[1 - vbo]);
+
+ glBeginTransformFeedbackEXT(GL_POINTS);
+ glDrawArrays(GL_POINTS, 0, ballCount * 2);
+ glEndTransformFeedbackEXT();
+ }
+ glDisable(GL_RASTERIZER_DISCARD);
+
+ glUseProgram(progID);
+ glVertexPointer(2, GL_FLOAT, (4 * 4), 0);
+
+ glEnableVertexAttribArray(depthLoc);
+ }
+
+ if ( render ) {
+ // Render front-to-back opaque pass
+ glAlphaFunc(GL_EQUAL, 1.0f);
+ glDisable(GL_BLEND);
+ glDrawArrays(GL_POINTS, 0, ballCount);
+ glEnable(GL_BLEND);
+
+ // Render back-to-front transparent pass
+ glAlphaFunc(GL_GREATER, 0.0f); // Fragments with alpha == 1.0 are early-depth-rejected.
+ glDepthMask(false);
+ glDrawArrays(GL_POINTS, ballCount, ballCount);
+ glDepthMask(true);
+ }
+ }
+
+ }
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/sprites/SpriteShootoutCL.java 2011-04-07 21:36:19 UTC (rev 3513)
@@ -0,0 +1,559 @@
+package org.lwjgl.test.opengl.sprites;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.PointerBuffer;
+import org.lwjgl.Sys;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.opencl.*;
+import org.lwjgl.opencl.api.Filter;
+import org.lwjgl.opengl.Display;
+import org.lwjgl.opengl.DisplayMode;
+import org.lwjgl.opengl.GLContext;
+import org.lwjgl.opengl.Util;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.Raster;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.util.List;
+import java.util.Random;
+import javax.imageio.ImageIO;
+
+import static org.lwjgl.opencl.CL10.*;
+import static org.lwjgl.opencl.CL10GL.*;
+import static org.lwjgl.opengl.GL11.*;
+import static org.lwjgl.opengl.GL12.*;
+import static org.lwjgl.opengl.GL15.*;
+import static org.lwjgl.opengl.GL20.*;
+
+/**
+ * Sprite rendering demo. In this version OpenCL is used for the animation
+ * computations. CL_KHR_gl_sharing is required for sharing the animation
+ * data with OpenGL for rendering.
+ *
+ * @author Spasi
+ * @since 18/3/2011
+ */
+public final class SpriteShootoutCL {
+
+ private static final int SCREEN_WIDTH = 800;
+ private static final int SCREEN_HEIGHT = 600;
+
+ private static final int ANIMATION_TICKS = 60;
+
+ private boolean run = true;
+ private boolean render = true;
+ private boolean colorMask = true;
+ private boolean animate = true;
+ private boolean smooth;
+ private boolean vsync;
+
+ private int ballSize = 42;
+ private int ballCount = 100 * 1000;
+
+ private SpriteRenderer renderer;
+
+ // OpenGL stuff
+ private int texID;
+ private int texBigID;
+ private int texSmallID;
+
+ // OpenCL stuff
+
+ private IntBuffer errorCode = BufferUtils.createIntBuffer(1);
+
+ private CLDevice clDevice;
+ private CLContext clContext;
+ private CLCommandQueue queue;
+ private CLProgram program;
+ private CLKernel kernel;
+ private CLMem clTransform;
+
+ private PointerBuffer kernelGlobalWorkSize;
+
+ private SpriteShootoutCL() {
+ }
+
+ public static void main(String[] args) {
+ try {
+ new SpriteShootoutCL().start();
+ } catch (LWJGLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void start() throws LWJGLException {
+ try {
+ initGL();
+ initCL();
+
+ renderer = new SpriteRendererDefault();
+
+ updateBalls(ballCount);
+ run();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ } finally {
+ destroy();
+ }
+ }
+
+ private void initCL() throws LWJGLException {
+ CL.create();
+
+ final List<CLPlatform> platforms = CLPlatform.getPlatforms();
+ if ( platforms == null )
+ throw new RuntimeException("No OpenCL platforms found.");
+
+ final CLPlatform platform = platforms.get(0);
+
+ final PointerBuffer ctxProps = BufferUtils.createPointerBuffer(3);
+ ctxProps.put(CL_CONTEXT_PLATFORM).put(platform.getPointer()).put(0).flip();
+
+ // Find devices with GL sharing support
+ final Filter<CLDevice> glSharingFilter = new Filter<CLDevice>() {
+ public boolean accept(final CLDevice device) {
+ final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
+ return caps.CL_KHR_gl_sharing;
+ }
+ };
+ final List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_GPU, glSharingFilter);
+
+ if ( devices == null )
+ throw new RuntimeException("No OpenCL GPU device found.");
+
+ clDevice = devices.get(0);
+ // Make sure we use only 1 device
+ devices.clear();
+ devices.add(clDevice);
+
+ clContext = CLContext.create(platform, devices, new CLContextCallback() {
+ protected void handleMessage(final String errinfo, final ByteBuffer private_info) {
+ System.out.println("[CONTEXT MESSAGE] " + errinfo);
+ }
+ }, Display.getDrawable(), errorCode);
+ checkCLError(errorCode);
+
+ queue = clCreateCommandQueue(clContext, clDevice, 0, errorCode);
+ checkCLError(errorCode);
+ }
+
+ private void initGL() throws LWJGLException {
+ Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2,
+ (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2);
+ Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT));
+ Display.setTitle("Sprite Shootout - CL");
+ Display.create();
+
+ if ( !GLContext.getCapabilities().OpenGL20 )
+ throw new RuntimeException("OpenGL 2.0 is required for this demo.");
+
+ // Setup viewport
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+
+ glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
+
+ // Create textures
+
+ try {
+ texSmallID = createTexture("res/ball_sm.png");
+ texBigID = createTexture("res/ball.png");
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ texID = texBigID;
+
+ // Setup rendering state
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+ glEnable(GL_ALPHA_TEST);
+ glAlphaFunc(GL_GREATER, 0.0f);
+
+ glColorMask(colorMask, colorMask, colorMask, false);
+ glDepthMask(false);
+ glDisable(GL_DEPTH_TEST);
+
+ // Setup geometry
+
+ Util.checkGLError();
+ }
+
+ private static int createTexture(final String path) throws IOException {
+ final BufferedImage img = ImageIO.read(SpriteShootoutCL.class.getClassLoader().getResource(path));
+
+ final int w = img.getWidth();
+ final int h = img.getHeight();
+
+ final ByteBuffer buffer = readImage(img);
+
+ final int texID = glGenTextures();
+
+ glBindTexture(GL_TEXTURE_2D, texID);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer);
+
+ return texID;
+ }
+
+ private static ByteBuffer readImage(final BufferedImage img) throws IOException {
+ final Raster raster = img.getRaster();
+
+ final int bands = raster.getNumBands();
+
+ final int w = img.getWidth();
+ final int h = img.getHeight();
+
+ final int size = w * h * bands;
+
+ final byte[] pixels = new byte[size];
+ raster.getDataElements(0, 0, w, h, pixels);
+
+ final ByteBuffer pbuffer = BufferUtils.createByteBuffer(size);
+
+ if ( bands == 4 ) {
+ for ( int i = 0; i < (w * h * 4); i += 4 ) {
+ // Pre-multiply alpha
+ final float a = unpackUByte01(pixels[i + 3]);
+ pbuffer.put(packUByte01(unpackUByte01(pixels[i + 2]) * a));
+ pbuffer.put(packUByte01(unpackUByte01(pixels[i + 1]) * a));
+ pbuffer.put(packUByte01(unpackUByte01(pixels[i + 0]) * a));
+ pbuffer.put(pixels[i + 3]);
+ }
+ } else if ( bands == 3 ) {
+ for ( int i = 0; i < (w * h * 3); i += 3 ) {
+ pbuffer.put(pixels[i + 2]);
+ pbuffer.put(pixels[i + 1]);
+ pbuffer.put(pixels[i + 0]);
+ }
+ } else
+ pbuffer.put(pixels, 0, size);
+
+ pbuffer.flip();
+
+ return pbuffer;
+ }
+
+ private static float unpackUByte01(final byte x) {
+ return (x & 0xFF) / 255.0f;
+ }
+
+ private static byte packUByte01(final float x) {
+ return (byte)(x * 255.0f);
+ }
+
+ private void updateBalls(final int count) {
+ System.out.println("NUMBER OF BALLS: " + count);
+ renderer.updateBalls(ballCount);
+ }
+
+ private void run() {
+ long startTime = System.currentTimeMillis() + 5000;
+ long fps = 0;
+
+ long time = Sys.getTime();
+ final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS);
+
+ renderer.render(false, true, 0);
+
+ while ( run ) {
+ Display.processMessages();
+ handleInput();
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ final long currTime = Sys.getTime();
+ final int delta = (int)(currTime - time);
+ if ( smooth || delta >= ticksPerUpdate ) {
+ renderer.render(render, animate, delta);
+ time = currTime;
+ } else
+ renderer.render(render, false, 0);
+
+ Display.update(false);
+
+ if ( startTime > System.currentTimeMillis() ) {
+ fps++;
+ } else {
+ long timeUsed = 5000 + (startTime - System.currentTimeMillis());
+ startTime = System.currentTimeMillis() + 5000;
+ System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount);
+ fps = 0;
+ }
+ }
+ }
+
+ private void handleInput() {
+ if ( Display.isCloseRequested() )
+ run = false;
+
+ while ( Keyboard.next() ) {
+ if ( Keyboard.getEventKeyState() )
+ continue;
+
+ switch ( Keyboard.getEventKey() ) {
+ case Keyboard.KEY_1:
+ case Keyboard.KEY_2:
+ case Keyboard.KEY_3:
+ case Keyboard.KEY_4:
+ case Keyboard.KEY_5:
+ case Keyboard.KEY_6:
+ case Keyboard.KEY_7:
+ case Keyboard.KEY_8:
+ case Keyboard.KEY_9:
+ case Keyboard.KEY_0:
+ ballCount = 1 << (Keyboard.getEventKey() - Keyboard.KEY_1);
+ updateBalls(ballCount);
+ break;
+ case Keyboard.KEY_ADD:
+ case Keyboard.KEY_SUBTRACT:
+ int mult;
+ if ( Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) )
+ mult = 1000;
+ else if ( Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU) )
+ mult = 100;
+ else if ( Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) )
+ mult = 10;
+ else
+ mult = 1;
+ if ( Keyboard.getEventKey() == Keyboard.KEY_SUBTRACT )
+ mult = -mult;
+ ballCount += mult * 100;
+ if ( ballCount <= 0 )
+ ballCount = 1;
+ updateBalls(ballCount);
+ break;
+ case Keyboard.KEY_ESCAPE:
+ run = false;
+ break;
+ case Keyboard.KEY_A:
+ animate = !animate;
+ System.out.println("Animation is now " + (animate ? "on" : "off") + ".");
+ break;
+ case Keyboard.KEY_C:
+ colorMask = !colorMask;
+ glColorMask(colorMask, colorMask, colorMask, false);
+ System.out.println("Color mask is now " + (colorMask ? "on" : "off") + ".");
+ // Disable alpha test when color mask is off, else we get no benefit.
+ if ( colorMask ) {
+ glEnable(GL_BLEND);
+ glEnable(GL_ALPHA_TEST);
+ } else {
+ glDisable(GL_BLEND);
+ glDisable(GL_ALPHA_TEST);
+ }
+ break;
+ case Keyboard.KEY_R:
+ render = !render;
+ System.out.println("Rendering is now " + (render ? "on" : "off") + ".");
+ break;
+ case Keyboard.KEY_S:
+ smooth = !smooth;
+ System.out.println("Smooth animation is now " + (smooth ? "on" : "off") + ".");
+ break;
+ case Keyboard.KEY_T:
+ if ( texID == texBigID ) {
+ texID = texSmallID;
+ ballSize = 16;
+ } else {
+ texID = texBigID;
+ ballSize = 42;
+ }
+ renderer.updateBallSize();
+ glBindTexture(GL_TEXTURE_2D, texID);
+ System.out.println("Now using the " + (texID == texBigID ? "big" : "small") + " texture.");
+ break;
+ case Keyboard.KEY_V:
+ vsync = !vsync;
+ Display.setVSyncEnabled(vsync);
+ System.out.println("VSYNC is now " + (vsync ? "enabled" : "disabled") + ".");
+ break;
+ }
+ }
+
+ while ( Mouse.next() ) ;
+ }
+
+ private static void checkCLError(IntBuffer buffer) {
+ org.lwjgl.opencl.Util.checkCLError(buffer.get(0));
+ }
+
+ private void destroy() {
+ clReleaseContext(clContext);
+ Display.destroy();
+ System.exit(0);
+ }
+
+ private abstract class SpriteRenderer {
+
+ protected int progID;
+ protected int animVBO;
+
+ protected void createKernel(final String source) {
+ program = clCreateProgramWithSource(clContext, source, errorCode);
+ checkCLError(errorCode);
+ final int build = clBuildProgram(program, clDevice, "", null);
+ if ( build != CL_SUCCESS ) {
+ System.out.println("BUILD LOG: " + program.getBuildInfoString(clDevice, CL_PROGRAM_BUILD_LOG));
+ throw new RuntimeException("Failed to build CL program, status: " + build);
+ }
+
+ kernel = clCreateKernel(program, "animate", errorCode);
+ checkCLError(errorCode);
+
+ kernelGlobalWorkSize = BufferUtils.createPointerBuffer(1);
+ kernelGlobalWorkSize.put(0, ballCount);
+
+ kernel.setArg(0, SCREEN_WIDTH);
+ kernel.setArg(1, SCREEN_HEIGHT);
+ kernel.setArg(2, ballSize * 0.5f);
+ }
+
+ protected void createProgram(final int vshID) {
+ final int fshID = glCreateShader(GL_FRAGMENT_SHADER);
+ glShaderSource(fshID, "#version 110\n" +
+ "uniform sampler2D COLOR_MAP;" +
+ "void main(void) {\n" +
+ " gl_FragColor = texture2D(COLOR_MAP, gl_PointCoord);\n" +
+ "}");
+ glCompileShader(fshID);
+ if ( glGetShader(fshID, GL_COMPILE_STATUS) == GL_FALSE ) {
+ System.out.println(glGetShaderInfoLog(fshID, glGetShader(fshID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to compile fragment shader.");
+ }
+
+ progID = glCreateProgram();
+ glAttachShader(progID, vshID);
+ glAttachShader(progID, fshID);
+ glLinkProgram(progID);
+ if ( glGetProgram(progID, GL_LINK_STATUS) == GL_FALSE ) {
+ System.out.println(glGetProgramInfoLog(progID, glGetProgram(progID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to link shader program.");
+ }
+
+ glUseProgram(progID);
+ glUniform1i(glGetUniformLocation(progID, "COLOR_MAP"), 0);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ }
+
+ public void updateBallSize() {
+ glPointSize(ballSize);
+ kernel.setArg(2, ballSize * 0.5f);
+ }
+
+ public void updateBalls(final int count) {
+ kernelGlobalWorkSize.put(0, ballCount);
+
+ final FloatBuffer transform = BufferUtils.createFloatBuffer(count * 4);
+
+ final Random random = new Random();
+ for ( int i = 0; i < count; i++ ) {
+ transform.put((int)(random.nextFloat() * (SCREEN_WIDTH - ballSize)) + ballSize * 0.5f);
+ transform.put((int)(random.nextFloat() * (SCREEN_HEIGHT - ballSize)) + ballSize * 0.5f);
+ transform.put(random.nextFloat() * 0.4f - 0.2f);
+ transform.put(random.nextFloat() * 0.4f - 0.2f);
+ }
+ transform.flip();
+
+ if ( animVBO != 0 ) {
+ clReleaseMemObject(clTransform);
+ glDeleteBuffers(animVBO);
+ }
+
+ animVBO = glGenBuffers();
+
+ glBindBuffer(GL_ARRAY_BUFFER, animVBO);
+ glBufferData(GL_ARRAY_BUFFER, transform, GL_STATIC_DRAW);
+ glVertexPointer(2, GL_FLOAT, (4 * 4), 0);
+
+ clTransform = clCreateFromGLBuffer(clContext, CL_MEM_READ_WRITE, animVBO, errorCode);
+ checkCLError(errorCode);
+ kernel.setArg(4, clTransform);
+ }
+
+ protected abstract void render(boolean render, boolean animate, int delta);
+
+ }
+
+ private class SpriteRendererDefault extends SpriteRenderer {
+
+ SpriteRendererDefault() {
+ System.out.println("Shootout Implementation: OpenCL GPU animation");
+
+ final int vshID = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(vshID, "#version 150\n" +
+ "void main(void) {\n" +
+ " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" +
+ "}");
+ glCompileShader(vshID);
+ if ( glGetShader(vshID, GL_COMPILE_STATUS) == GL_FALSE ) {
+ System.out.println(glGetShaderInfoLog(vshID, glGetShader(vshID, GL_INFO_LOG_LENGTH)));
+ throw new RuntimeException("Failed to compile vertex shader.");
+ }
+
+ createProgram(vshID);
+
+ Util.checkGLError();
+
+ createKernel("kernel void animate(\n" +
+ " const int WIDTH,\n" +
+ " const int HEIGHT,\n" +
+ " const float radius,\n" +
+ " const int delta,\n" +
+ " global float4 *balls\n" +
+ ") {\n" +
+ " unsigned int b = get_global_id(0);\n" +
+ "\n" +
+ " float4 anim = balls[b];\n" +
+ " anim.xy = anim.xy + anim.zw * delta;\n" +
+ " float2 animC = clamp(anim.xy, (float2)radius, (float2)(WIDTH - radius, HEIGHT - radius));\n" +
+ " if ( anim.x != animC.x ) anim.z = -anim.z;\n" +
+ " if ( anim.y != animC.y ) anim.w = -anim.w;\n" +
+ "\n" +
+ " balls[b] = (float4)(animC, anim.zw);\n" +
+ "}");
+
+ updateBallSize();
+ }
+
+ publ...
[truncated message content] |
|
From: <sp...@us...> - 2011-04-02 11:33:08
|
Revision: 3512
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3512&view=rev
Author: spasi
Date: 2011-04-02 11:33:02 +0000 (Sat, 02 Apr 2011)
Log Message:
-----------
Attempt to fix NV compilation issue.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2011-03-30 09:35:14 UTC (rev 3511)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/DemoFractal.java 2011-04-02 11:33:02 UTC (rev 3512)
@@ -518,12 +518,9 @@
glDeleteBuffers(glIDs);
}
- if ( useTextures )
+ if ( useTextures ) {
glGenTextures(glIDs);
- else
- glGenBuffers(glIDs);
- if ( useTextures ) {
// Init textures
for ( int i = 0; i < slices; i++ ) {
glBindTexture(GL_TEXTURE_2D, glIDs.get(i));
@@ -535,6 +532,8 @@
}
glBindTexture(GL_TEXTURE_2D, 0);
} else {
+ glGenBuffers(glIDs);
+
// setup one empty PBO per slice
for ( int i = 0; i < slices; i++ ) {
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, glIDs.get(i));
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl 2011-03-30 09:35:14 UTC (rev 3511)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opencl/gl/Mandelbrot.cl 2011-04-02 11:33:02 UTC (rev 3512)
@@ -57,7 +57,7 @@
output[iy * width + ix] = 0;
#endif
} else {
- varfloat alpha = (varfloat)iteration / maxIterations;
+ float alpha = (float)iteration / maxIterations;
int colorIndex = (int)(alpha * colorMapSize);
#ifdef USE_TEXTURE
// We could have changed colorMap to a texture + sampler, but the
@@ -69,9 +69,9 @@
(c & 0xFF) >> 0,
(c & 0xFF00) >> 8,
(c & 0xFF0000) >> 16,
- _255
+ 255.0f
);
- write_imagef(output, (int2)(ix, iy), oc / _255);
+ write_imagef(output, (int2)(ix, iy), oc / 255.0f);
#else
output[iy * width + ix] = colorMap[colorIndex];
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jpi...@us...> - 2011-03-30 09:35:25
|
Revision: 3511
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3511&view=rev
Author: jpilgrim
Date: 2011-03-30 09:35:14 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
Initial import of eclipse plugins. Note: The plugins are only skeletons, the actual plugins are to be build with the Ant script found in org.lwjgl.build/build.xml. See org.lwjgl.build/READ.ME for details.
Plugin lwjgl.org contains a binary version of LWJGL for development purposes (of this plugin) only. This binary version is ignored by the build script.
Added Paths:
-----------
trunk/LWJGL/eclipse-update/org.lwjgl/.classpath
trunk/LWJGL/eclipse-update/org.lwjgl/.project
trunk/LWJGL/eclipse-update/org.lwjgl/.settings/
trunk/LWJGL/eclipse-update/org.lwjgl/.settings/org.eclipse.jdt.core.prefs
trunk/LWJGL/eclipse-update/org.lwjgl/AppleJavaExtensions.jar
trunk/LWJGL/eclipse-update/org.lwjgl/META-INF/
trunk/LWJGL/eclipse-update/org.lwjgl/META-INF/MANIFEST.MF
trunk/LWJGL/eclipse-update/org.lwjgl/build/
trunk/LWJGL/eclipse-update/org.lwjgl/build.properties
trunk/LWJGL/eclipse-update/org.lwjgl/jinput.jar
trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl.jar
trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl_test.jar
trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl_util.jar
trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl_util_applet.jar
trunk/LWJGL/eclipse-update/org.lwjgl/lzma.jar
trunk/LWJGL/eclipse-update/org.lwjgl/native/
trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/
trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libjinput-linux.so
trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libjinput-linux64.so
trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/liblwjgl.so
trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/liblwjgl64.so
trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libopenal.so
trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libopenal64.so
trunk/LWJGL/eclipse-update/org.lwjgl/native/macosx/
trunk/LWJGL/eclipse-update/org.lwjgl/native/macosx/libjinput-osx.jnilib
trunk/LWJGL/eclipse-update/org.lwjgl/native/macosx/liblwjgl.jnilib
trunk/LWJGL/eclipse-update/org.lwjgl/native/macosx/openal.dylib
trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/
trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/liblwjgl.so
trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/liblwjgl64.so
trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/libopenal.so
trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/libopenal64.so
trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/
trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/OpenAL32.dll
trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/OpenAL64.dll
trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-dx8.dll
trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-dx8_64.dll
trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-raw.dll
trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-raw_64.dll
trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/lwjgl.dll
trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/lwjgl64.dll
trunk/LWJGL/eclipse-update/org.lwjgl/src/
trunk/LWJGL/eclipse-update/org.lwjgl/src/java/
trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/
trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/
trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/Activator.java
trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/LibraryPathUtil.java
trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/OSNotSupportedException.java
trunk/LWJGL/eclipse-update/org.lwjgl.build/.classpath
trunk/LWJGL/eclipse-update/org.lwjgl.build/.project
trunk/LWJGL/eclipse-update/org.lwjgl.build/META-INF/
trunk/LWJGL/eclipse-update/org.lwjgl.build/META-INF/MANIFEST.MF
trunk/LWJGL/eclipse-update/org.lwjgl.build/READ.ME
trunk/LWJGL/eclipse-update/org.lwjgl.build/anttasks/
trunk/LWJGL/eclipse-update/org.lwjgl.build/build.properties
trunk/LWJGL/eclipse-update/org.lwjgl.build/build.xml
trunk/LWJGL/eclipse-update/org.lwjgl.build/lwjgl-archives/
trunk/LWJGL/eclipse-update/org.lwjgl.build/src/
trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/
trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/org/
trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/org/lwjgl/
trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/org/lwjgl/ant/
trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/org/lwjgl/ant/NormalizeVersion.java
trunk/LWJGL/eclipse-update/org.lwjgl.build/src/java/org/lwjgl/ant/PackageList.java
trunk/LWJGL/eclipse-update/org.lwjgl.build/test/
trunk/LWJGL/eclipse-update/org.lwjgl.build/test/buildtest/
trunk/LWJGL/eclipse-update/org.lwjgl.build/test/buildtest/build.xml
trunk/LWJGL/eclipse-update/org.lwjgl.build/test/java/
trunk/LWJGL/eclipse-update/org.lwjgl.build/test/java/org/
trunk/LWJGL/eclipse-update/org.lwjgl.build/test/java/org/lwjgl/
trunk/LWJGL/eclipse-update/org.lwjgl.build/test/java/org/lwjgl/ant/
trunk/LWJGL/eclipse-update/org.lwjgl.build/test/java/org/lwjgl/ant/NormalizeVersionTest.java
trunk/LWJGL/eclipse-update/org.lwjgl.build/teststore
trunk/LWJGL/eclipse-update/org.lwjgl.doc/.project
trunk/LWJGL/eclipse-update/org.lwjgl.doc/META-INF/
trunk/LWJGL/eclipse-update/org.lwjgl.doc/META-INF/MANIFEST.MF
trunk/LWJGL/eclipse-update/org.lwjgl.doc/about.html
trunk/LWJGL/eclipse-update/org.lwjgl.doc/build.properties
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/addLib_1.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/addLib_2.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/addLib_3.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/addLib_4.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/logo.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/lwjgl_logo.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/mesh.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/openView_1.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/openView_2.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/openView_Info.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/fig/openView_Test.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/overview.html
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/plugins.html
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/tools.html
trunk/LWJGL/eclipse-update/org.lwjgl.doc/html/views.html
trunk/LWJGL/eclipse-update/org.lwjgl.doc/lwjgl_logo.png
trunk/LWJGL/eclipse-update/org.lwjgl.doc/plugin.xml
trunk/LWJGL/eclipse-update/org.lwjgl.doc/toc.xml
trunk/LWJGL/eclipse-update/org.lwjgl.feature/.project
trunk/LWJGL/eclipse-update/org.lwjgl.feature/build.properties
trunk/LWJGL/eclipse-update/org.lwjgl.feature/feature.xml
trunk/LWJGL/eclipse-update/org.lwjgl.feature/feature.xml.template
trunk/LWJGL/eclipse-update/org.lwjgl.feature/lwjgl_logo.png
trunk/LWJGL/eclipse-update/org.lwjgl.feature.sdk/.project
trunk/LWJGL/eclipse-update/org.lwjgl.feature.sdk/build.properties
trunk/LWJGL/eclipse-update/org.lwjgl.feature.sdk/feature.xml
trunk/LWJGL/eclipse-update/org.lwjgl.feature.sdk/feature.xml.template
trunk/LWJGL/eclipse-update/org.lwjgl.info/.classpath
trunk/LWJGL/eclipse-update/org.lwjgl.info/.project
trunk/LWJGL/eclipse-update/org.lwjgl.info/.settings/
trunk/LWJGL/eclipse-update/org.lwjgl.info/.settings/org.eclipse.jdt.core.prefs
trunk/LWJGL/eclipse-update/org.lwjgl.info/META-INF/
trunk/LWJGL/eclipse-update/org.lwjgl.info/META-INF/MANIFEST.MF
trunk/LWJGL/eclipse-update/org.lwjgl.info/about.html
trunk/LWJGL/eclipse-update/org.lwjgl.info/build/
trunk/LWJGL/eclipse-update/org.lwjgl.info/build/classes/
trunk/LWJGL/eclipse-update/org.lwjgl.info/build.properties
trunk/LWJGL/eclipse-update/org.lwjgl.info/icons/
trunk/LWJGL/eclipse-update/org.lwjgl.info/icons/lwjgl_logo_16.gif
trunk/LWJGL/eclipse-update/org.lwjgl.info/lwjgl_logo.png
trunk/LWJGL/eclipse-update/org.lwjgl.info/plugin.xml
trunk/LWJGL/eclipse-update/org.lwjgl.info/src/
trunk/LWJGL/eclipse-update/org.lwjgl.info/src/java/
trunk/LWJGL/eclipse-update/org.lwjgl.info/src/java/org/
trunk/LWJGL/eclipse-update/org.lwjgl.info/src/java/org/lwjgl/
trunk/LWJGL/eclipse-update/org.lwjgl.info/src/java/org/lwjgl/info/
trunk/LWJGL/eclipse-update/org.lwjgl.info/src/java/org/lwjgl/info/FpsStatusLineItem.java
trunk/LWJGL/eclipse-update/org.lwjgl.info/src/java/org/lwjgl/info/LWJGLInfoView.java
trunk/LWJGL/eclipse-update/org.lwjgl.info/src/java/org/lwjgl/info/LWJGLTestView.java
trunk/LWJGL/eclipse-update/org.lwjgl.source/.project
trunk/LWJGL/eclipse-update/org.lwjgl.source/META-INF/
trunk/LWJGL/eclipse-update/org.lwjgl.source/META-INF/MANIFEST.MF
trunk/LWJGL/eclipse-update/org.lwjgl.source/about.html
trunk/LWJGL/eclipse-update/org.lwjgl.source/build.properties
trunk/LWJGL/eclipse-update/org.lwjgl.source/lwjgl_logo.png
trunk/LWJGL/eclipse-update/org.lwjgl.source/plugin.xml
trunk/LWJGL/eclipse-update/org.lwjgl.source/src/
trunk/LWJGL/eclipse-update/org.lwjgl.tools/.classpath
trunk/LWJGL/eclipse-update/org.lwjgl.tools/.project
trunk/LWJGL/eclipse-update/org.lwjgl.tools/.settings/
trunk/LWJGL/eclipse-update/org.lwjgl.tools/.settings/org.eclipse.jdt.core.prefs
trunk/LWJGL/eclipse-update/org.lwjgl.tools/META-INF/
trunk/LWJGL/eclipse-update/org.lwjgl.tools/META-INF/MANIFEST.MF
trunk/LWJGL/eclipse-update/org.lwjgl.tools/about.html
trunk/LWJGL/eclipse-update/org.lwjgl.tools/build/
trunk/LWJGL/eclipse-update/org.lwjgl.tools/build/classes/
trunk/LWJGL/eclipse-update/org.lwjgl.tools/build.properties
trunk/LWJGL/eclipse-update/org.lwjgl.tools/plugin.xml
trunk/LWJGL/eclipse-update/org.lwjgl.tools/src/
trunk/LWJGL/eclipse-update/org.lwjgl.tools/src/java/
trunk/LWJGL/eclipse-update/org.lwjgl.tools/src/java/org/
trunk/LWJGL/eclipse-update/org.lwjgl.tools/src/java/org/lwjgl/
trunk/LWJGL/eclipse-update/org.lwjgl.tools/src/java/org/lwjgl/tools/
trunk/LWJGL/eclipse-update/org.lwjgl.tools/src/java/org/lwjgl/tools/Activator.java
trunk/LWJGL/eclipse-update/org.lwjgl.tools/src/java/org/lwjgl/tools/BuildPathSupport.java
trunk/LWJGL/eclipse-update/org.lwjgl.tools/src/java/org/lwjgl/tools/LWJGLClasspathContainerInitializer.java
trunk/LWJGL/eclipse-update/org.lwjgl.tools/src/java/org/lwjgl/tools/LWJGLClasspathContainerPage.java
trunk/LWJGL/eclipse-update/org.lwjgl.updatesite/.project
trunk/LWJGL/eclipse-update/org.lwjgl.updatesite/about.html
trunk/LWJGL/eclipse-update/org.lwjgl.updatesite/index.html
trunk/LWJGL/eclipse-update/org.lwjgl.updatesite/site.xml
trunk/LWJGL/eclipse-update/org.lwjgl.updatesite/site.xml.template
trunk/LWJGL/eclipse-update/org.lwjgl.updatesite/web/
trunk/LWJGL/eclipse-update/org.lwjgl.updatesite/web/site.css
trunk/LWJGL/eclipse-update/org.lwjgl.updatesite/web/site.xsl
Added: trunk/LWJGL/eclipse-update/org.lwjgl/.classpath
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl/.classpath (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl/.classpath 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry exported="true" kind="lib" path="AppleJavaExtensions.jar"/>
+ <classpathentry exported="true" kind="lib" path="jinput.jar"/>
+ <classpathentry exported="true" kind="lib" path="lwjgl.jar"/>
+ <classpathentry exported="true" kind="lib" path="lwjgl_test.jar"/>
+ <classpathentry exported="true" kind="lib" path="lwjgl_util.jar"/>
+ <classpathentry exported="true" kind="lib" path="lwjgl_util_applet.jar"/>
+ <classpathentry exported="true" kind="lib" path="lzma.jar"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
Added: trunk/LWJGL/eclipse-update/org.lwjgl/.project
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl/.project (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl/.project 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.lwjgl</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/LWJGL/eclipse-update/org.lwjgl/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl/.settings/org.eclipse.jdt.core.prefs 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,12 @@
+#Tue Nov 23 14:49:20 CET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/LWJGL/eclipse-update/org.lwjgl/AppleJavaExtensions.jar
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/AppleJavaExtensions.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/META-INF/MANIFEST.MF
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl/META-INF/MANIFEST.MF (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl/META-INF/MANIFEST.MF 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,38 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: LWJGL Lightweight Java Game Library
+Bundle-SymbolicName: org.lwjgl
+Bundle-Version: 2.0.0
+Bundle-Vendor: Lightweight Java Game Library Project
+Bundle-Activator: org.lwjgl.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Export-Package: LZMA,
+ com.apple.eawt,
+ com.apple.eio,
+ net.java.games.input,
+ net.java.games.util,
+ net.java.games.util.plugins,
+ org.lwjgl,
+ org.lwjgl.input,
+ org.lwjgl.openal,
+ org.lwjgl.opencl,
+ org.lwjgl.opencl.api,
+ org.lwjgl.opengl,
+ org.lwjgl.util,
+ org.lwjgl.util.applet,
+ org.lwjgl.util.glu,
+ org.lwjgl.util.glu.tessellation,
+ org.lwjgl.util.input,
+ org.lwjgl.util.jinput,
+ org.lwjgl.util.vector
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: .,
+ lwjgl.jar,
+ lwjgl_util.jar,
+ lwjgl_util_applet.jar,
+ lwjgl_test.jar,
+ AppleJavaExtensions.jar,
+ jinput.jar,
+ lzma.jar
Added: trunk/LWJGL/eclipse-update/org.lwjgl/build.properties
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl/build.properties (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl/build.properties 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,11 @@
+source.. = src/java/
+output.. = build/classes/
+bin.includes = META-INF/,\
+ .,\
+ lzma.jar,\
+ jinput.jar,\
+ lwjgl.jar,\
+ lwjgl_test.jar,\
+ lwjgl_util.jar,\
+ lwjgl_util_applet.jar,\
+ native/
Added: trunk/LWJGL/eclipse-update/org.lwjgl/jinput.jar
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/jinput.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl.jar
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl_test.jar
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl_test.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl_util.jar
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl_util.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl_util_applet.jar
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/lwjgl_util_applet.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/lzma.jar
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/lzma.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libjinput-linux.so
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libjinput-linux.so
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libjinput-linux64.so
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libjinput-linux64.so
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/liblwjgl.so
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/liblwjgl.so
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/liblwjgl64.so
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/liblwjgl64.so
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libopenal.so
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libopenal.so
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libopenal64.so
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/linux/libopenal64.so
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/macosx/libjinput-osx.jnilib
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/macosx/libjinput-osx.jnilib
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/macosx/liblwjgl.jnilib
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/macosx/liblwjgl.jnilib
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/macosx/openal.dylib
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/macosx/openal.dylib
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/liblwjgl.so
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/liblwjgl.so
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/liblwjgl64.so
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/liblwjgl64.so
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/libopenal.so
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/libopenal.so
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/libopenal64.so
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/solaris/libopenal64.so
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/OpenAL32.dll
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/OpenAL32.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/OpenAL64.dll
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/OpenAL64.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-dx8.dll
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-dx8.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-dx8_64.dll
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-dx8_64.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-raw.dll
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-raw.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-raw_64.dll
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/jinput-raw_64.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/lwjgl.dll
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/lwjgl.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/lwjgl64.dll
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/native/windows/lwjgl64.dll
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/Activator.java
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/Activator.java (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/Activator.java 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2011 LWJGL Project and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
+ * BSD license, see http://lwjgl.org/license.php for details.
+ *
+ * Contributors:
+ * Jens von Pilgrim - initial implementation
+ ******************************************************************************/
+package org.lwjgl;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ *
+ * @author Jens von Pilgrim (dev...@je...)
+ * @since Mar 30, 2011
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.lwjgl";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+
+ super.start(context);
+
+ try {
+ String path = LibraryPathUtil.getLWJGLLibraryPath(context);
+ Status status = new Status(Status.INFO, PLUGIN_ID, Status.INFO,
+ "Set org.lwjgl.librarypath to " + path, null);
+ getLog().log(status);
+
+ } catch (Throwable ex) {
+ Status status = new Status(Status.ERROR, PLUGIN_ID, Status.ERROR,
+ "Error setting native LWJGL libraries path: " + ex.toString(), ex);
+ getLog().log(status);
+ throw new BundleException(status.getMessage(), ex);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/Activator.java
___________________________________________________________________
Added: svn:keywords
+ Date Revision Author HeadURL Id
Added: trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/LibraryPathUtil.java
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/LibraryPathUtil.java (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/LibraryPathUtil.java 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2011 LWJGL Project and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
+ * BSD license, see http://lwjgl.org/license.php for details.
+ *
+ * Contributors:
+ * Jens von Pilgrim - initial implementation
+ ******************************************************************************/
+package org.lwjgl;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Helper class for retrieving plugin relative path of native LWJGL
+ * libraries and setting the path in the system properties.
+ *
+ * @author Jens von Pilgrim
+ * @since Jan 30, 2011
+ */
+public class LibraryPathUtil {
+
+ public static final String LWJGL_SYSTEM_PROPERTY = "org.lwjgl.librarypath";
+
+ public static String[] NATIVEPATH = new String[] { "windows", "macosx",
+ "linux", "solaris" };
+
+ /**
+ * Returns plugin relative path to native libraries according to
+ * current operating system.
+ *
+ * @return
+ * @throws OSNotSupportedException
+ */
+ public static String getRelativeLWJGLLibraryPath()
+ throws OSNotSupportedException {
+ int iOS = -1;
+ String osname = System.getProperty("os.name").toLowerCase();
+ String osarch = System.getProperty("os.arch").toLowerCase();
+
+ // applied patch by Carlo Salinari: ignore osarch on windows
+ // see http://lwjgl.org/forum/index.php/topic,3726.0.html
+ if (osname.startsWith("windows")) {
+ iOS = 0;
+ } else if (osname.startsWith("mac")) {
+ iOS = 1;
+ } else if (osname.startsWith("linux")) {
+ iOS = 2;
+ } else if (osname.startsWith("solaris")) {
+ iOS = 3;
+ }
+
+ if (iOS >= 0 && iOS < NATIVEPATH.length) {
+ String base = "native" + File.separator + NATIVEPATH[iOS];
+ return base;
+ } else {
+ throw new OSNotSupportedException(osname, osarch);
+ }
+ }
+
+ /**
+ * Returns absolute path of native LWJGL libraries according to
+ * current operating system, this path is also set as
+ * system property.
+ *
+ * @param context
+ * @return
+ * @throws OSNotSupportedException
+ * @throws IOException
+ */
+ public static String getLWJGLLibraryPath(BundleContext context)
+ throws OSNotSupportedException, IOException {
+ String base = getRelativeLWJGLLibraryPath();
+ Bundle fragment = context.getBundle();
+
+ URL url = FileLocator.resolve(fragment.getEntry(base));
+ File fileDir = new File(url.getPath());
+ String path = fileDir.getPath();
+
+ System.setProperty(LWJGL_SYSTEM_PROPERTY, path);
+ return path;
+ }
+
+}
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/LibraryPathUtil.java
___________________________________________________________________
Added: svn:keywords
+ Date Revision Author HeadURL Id
Added: trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/OSNotSupportedException.java
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/OSNotSupportedException.java (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/OSNotSupportedException.java 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2011 LWJGL Project and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html, and under the terms of the
+ * BSD license, see http://lwjgl.org/license.php for details.
+ *
+ * Contributors:
+ * Jens von Pilgrim - initial implementation
+ ******************************************************************************/
+package org.lwjgl;
+
+/**
+ * Exception thrown by library loader if operating system is not supported.
+ *
+ * @author Jens von Pilgrim (dev...@je...)
+ * @since Jan 30, 2011
+ */
+public class OSNotSupportedException extends Exception {
+
+ String strOSName;
+ String strOSArch;
+ /**
+ * @param i_strOSName
+ * @param i_strOSArch
+ */
+ public OSNotSupportedException(String i_strOSName, String i_strOSArch) {
+ super();
+ strOSName = i_strOSName;
+ strOSArch = i_strOSArch;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see java.lang.Throwable#getMessage()
+ */
+ @Override
+ public String getMessage() {
+ return strOSName + " (" + strOSArch + ") not supported by LWJGL.";
+ }
+
+ /**
+ * {@inheritDoc}
+ * @see java.lang.Throwable#toString()
+ */
+ @Override
+ public String toString() {
+ return getMessage();
+ }
+
+
+}
Property changes on: trunk/LWJGL/eclipse-update/org.lwjgl/src/java/org/lwjgl/OSNotSupportedException.java
___________________________________________________________________
Added: svn:keywords
+ Date Revision Author HeadURL Id
Added: trunk/LWJGL/eclipse-update/org.lwjgl.build/.classpath
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl.build/.classpath (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl.build/.classpath 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="src" path="test/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="anttasks"/>
+</classpath>
Added: trunk/LWJGL/eclipse-update/org.lwjgl.build/.project
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl.build/.project (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl.build/.project 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.lwjgl.build</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/LWJGL/eclipse-update/org.lwjgl.build/META-INF/MANIFEST.MF
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl.build/META-INF/MANIFEST.MF (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl.build/META-INF/MANIFEST.MF 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: LWJGL Updatesite Build
+Bundle-SymbolicName: org.lwjgl.build
+Bundle-Version: 1.0.0
+Export-Package: org.lwjgl.ant
+Import-Package: org.apache.tools.ant,
+ org.apache.tools.ant.taskdefs,
+ org.apache.tools.ant.types,
+ org.apache.tools.ant.types.selectors,
+ org.apache.tools.ant.util,
+ org.junit;version="4.8.1"
+Bundle-Vendor: Lightweight Java Game Library Project
Added: trunk/LWJGL/eclipse-update/org.lwjgl.build/READ.ME
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl.build/READ.ME (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl.build/READ.ME 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,88 @@
+The build plugin is part of the LWJGL Eclipse plugins. The following plugins are
+required:
+
+org.lwjgl
+ Skeleton plugin, that is it contains the Eclipse Activator for setting up the
+ native library path, but the lwjgl jars are missing. These jars are added by
+ the build script later on
+
+org.lwjgl.source
+ Skeleton plugin for sources, plugin.xml etc are already configured, but again
+ the sources itself are only added by the build script later on
+
+org.lwjgl.doc
+ Skeleton plugin for documentation, Javadoc is added by build script, however
+ some Eclipse help files are already in place
+
+org.lwjgl.info
+ This plugin was called org.lwjgl.test in the elder version. I renamed it as it
+ does not really contain a test but Eclipse views. Besides the spinning torus
+ test view, I added an info view printing out current version of driver etc.
+ and capabilities of user's OpenGL system
+
+org.lwjgl.tools
+ This plugin contains a library set up for plain Java projects, in order to get
+ rid of defining additional parameters in the run configuration. It is
+ documented in the help files. I have sent you this plugin once, but it never
+ made it into the update site. Well, now it is in place
+
+org.lwjgl.feature
+ Feature plugin referencing the core lwjgl plugin. It contains two
+ feature.xml definitions, one used for playing around in Eclipse, and a
+ template which is used by the build script. If you ever change something
+ here, pay attention to also change the template file.
+
+org.lwjgl.feature.sdk
+ Feature plugin referencing the src, doc, tools and info lwjgl plugin.
+ It contains two feature.xml definitions, one used for playing around in
+ Eclipse, and a template which is used by the build script. If you ever change
+ something here, pay attention to also change the template file.
+
+org.lwjgl.updatesite
+ Well, this is the updatesite. As in the feature project, site.xml comes
+ together with a template version used by the build script.
+
+org.lwjgl.build -- THIS Plugin
+ This is the build script project. Although it is an Eclipse project, you can
+ simply run the build script with ant from command line. See later on.
+
+Everything is created in org.lwjgl.build/build.
+Here is how to build the update site:
+
+1) Create a new folder in org.lwjgl.build/lwjgl-archives , use the version
+ number as folder name. E.g., for version 2.6 create a folder "2.6",
+ for version 2.6.1 "2.6.1" and so on.
+2) Copy the lwjgl, lwjgl-docs and lwjgl-source zips into that folder. E.g.,
+ for version 2.6, this folder must contain the following files:
+ org.lwjgl.build/lwjgl-archives
+ + 2.6
+ - lwjgl-2.6.zip
+ - lwjgl-docs-2.6.zip
+ - lwjgl-source-2.6.zip
+3) In order to run the build script, change to folder org.lwjgl.build and run
+ ant with a parameter indicating the appropriate LWJGL version, e.g.
+ ant -Dversion=2.6 dist
+
+You will find the updatesite in
+ org.lwjgl.build/build/plugins/org.lwjgl.updatesite
+
+You may note that the jars are all signed. I have added a temporary keystore
+with a dummy alias. In order to use your key, simply edit the properties
+(line 11-14) in the build script. If you do not want to store the password in
+the build script, simply define it via "-Dstorepass=****" in the command line.
+
+Some additional remarks:
+- The version number is automatically "normalized" to Eclipse standards,
+ that is 2.6 will become 2.6.0. You do not have to rename the initial archives,
+ you can use 2.6. Or 2.6.1 ;-)
+- The lwjgl-debug.jar is not added to the org.lwjgl plugin, as I do not know
+ how to select one or the other. But I have not further investigated in
+ that direction.
+- Note that only the created plugin and feature jars are signed, and not the
+ nested lwjgl.jar etc., as I figure that you will sign these jars yourself
+ when creating the zip files.
+- When testing the update site and the installation of plugins, pay attention
+ to the Eclipse P2 system, which caches a lot of things. Simply uninstalling
+ a plugin does not remove the plugins from the Eclipse installation. When
+ the very same version is re-installed, instead of loading new files from the
+ update site these pre-installed versions are reused!
\ No newline at end of file
Added: trunk/LWJGL/eclipse-update/org.lwjgl.build/build.properties
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl.build/build.properties (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl.build/build.properties 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,3 @@
+source.. = src/java/
+bin.includes = META-INF/,\
+ .
Added: trunk/LWJGL/eclipse-update/org.lwjgl.build/build.xml
===================================================================
--- trunk/LWJGL/eclipse-update/org.lwjgl.build/build.xml (rev 0)
+++ trunk/LWJGL/eclipse-update/org.lwjgl.build/build.xml 2011-03-30 09:35:14 UTC (rev 3511)
@@ -0,0 +1,444 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Call with
+ ant -Dversion=1.9.1 dist
+(C) 2011 LWJGL-Project
+Author: Jens von Pilgrim, dev...@je...
+-->
+
+<project default="help" basedir="." name="" xmlns:ant4eclipse="antlib:org.ant4eclipse" xmlns:antcontrib="antlib:net.sf.antcontrib">
+
+ <property name="keystore" value="teststore" />
+ <property name="alias" value="tester" />
+ <property name="storepass" value="tester" />
+ <property name="keypass" value="${storepass}" />
+
+ <property name="eclipse.updatesite" value="http://www.lwjgl.org/update/" />
+ <property name="bundle.vendor" value="lwjgl.org" />
+
+ <taskdef name="packagelist" classname="org.lwjgl.ant.PackageList">
+ <classpath>
+ <pathelement location="./anttasks" />
+ </classpath>
+ </taskdef>
+ <taskdef name="normalizeversion" classname="org.lwjgl.ant.NormalizeVersion">
+ <classpath>
+ <pathelement location="./anttasks" />
+ </classpath>
+ </taskdef>
+
+ <property name="version" value="unknown" />
+ <property name="archives.dir" value="lwjgl-archives/${version}" />
+ <property name="skeletons.dir" value=".." />
+
+ <property name="build.path" value="build" />
+ <property name="build.temp" value="${build.path}/temp" />
+ <property name="build.plugins" value="${build.path}/plugins" />
+
+ <property name="lwjgl.zip" value="lwjgl-${version}.zip" />
+ <property name="lwjgl_docs.zip" value="lwjgl-docs-${version}.zip" />
+ <property name="lwjgl_source.zip" value="lwjgl-source-${version}.zip" />
+
+ <property name="lwjgl.dir" value="${build.temp}/lwjgl-${version}" />
+ <property name="lwjgl_docs.dir" value="${build.temp}/javadoc" />
+ <property name="lwjgl_source.dir" value="${build.temp}/src" />
+
+ <property name="NL" value=" " />
+
+
+
+ <!--
+<property name="" value="" />
+-->
+
+
+ <target name="init">
+ <normalizeversion version="${version}" property="normversion" />
+ <echo>Building plugins for version ${version}, normalized version ${normversion}</echo>
+ </target>
+
+
+ <target name="dist" depends="init">
+ <mkdir dir="${build.temp}" />
+
+
+ <!-- *******************************************************************
+ *
+ * Copy original plugins to build folder. Copy source to source plugin
+ * only, move classes into place.
+ *
+ ******************************************************************** -->
+ <mkdir dir="${build.plugins}" />
+ <copy todir="${build.plugins}/org.lwjgl">
+ <fileset dir="${skeletons.dir}/org.lwjgl" casesensitive="yes">
+ <exclude name="**/src/**" />
+ <exclude name="**/*.jar" />
+ <!-- do not copy jars used for development -->
+ <exclude name="**/build/**" />
+ <exclude name="**/build.properties" />
+ <!-- do not copy development settings -->
+ <exclude name="**/.settings/**" />
+ <exclude name="**/.classpath" />
+ <exclude name="**/.project" />
+ </fileset>
+ </copy>
+ <copy todir="${build.plugins}/org.lwjgl">
+ <fileset dir="${skeletons.dir}/org.lwjgl/build/classes" casesensitive="yes">
+ </fileset>
+ </copy>
+
+ <copy todir="${build.plugins}/org.lwjgl.source">
+ <fileset dir="${skeletons.dir}/org.lwjgl.source" casesensitive="yes">
+ <exclude name="**/build.properties" />
+ <exclude name="**/.settings/**" />
+ <exclude name="**/.classpath" />
+ <exclude name="**/.project" />
+ </fileset>
+ </copy>
+ <copy todir="${build.plugins}/org.lwjgl.doc">
+ <fileset dir="${skeletons.dir}/org.lwjgl.doc" casesensitive="yes">
+ <exclude name="**/build.properties" />
+ <exclude name="**/.settings/**" />
+ <exclude name="**/.classpath" />
+ <exclude name="**/.project" />
+ </fileset>
+ </copy>
+
+ <copy todir="${build.plugins}/org.lwjgl.info">
+ <fileset dir="${skeletons.dir}/org.lwjgl.info" casesensitive="yes">
+ <exclude name="**/src/**" />
+ <exclude name="**/build/**" />
+ <exclude name="**/build.properties" />
+ <exclude name="**/.settings/**" />
+ <exclude name="**/.classpath" />
+ <exclude name="**/.project" />
+ </fileset>
+ </copy>
+ <copy todir="${build.plugins}/org.lwjgl.info">
+ <fileset dir="${skeletons.dir}/org.lwjgl.info/build/classes" casesensitive="yes">
+ </fileset>
+ </copy>
+
+ <copy todir="${build.plugins}/org.lwjgl.tools">
+ <fileset dir="${skeletons.dir}/org.lwjgl.tools" casesensitive="yes">
+ <exclude name="**/src/**" />
+ <exclude name="**/build/**" />
+ <exclude name="**/build.properties" />
+ <exclude name="**/.settings/**" />
+ <exclude name="**/.classpath" />
+ <exclude name="**/.project" />
+ </fileset>
+ </copy>
+ <copy todir="${build.plugins}/org.lwjgl.tools">
+ <fileset dir="${skeletons.dir}/org.lwjgl.tools/build/classes" casesensitive="yes">
+ </fileset>
+ </copy>
+
+ <copy todir="${build.plugins}/org.lwjgl.feature">
+ <fileset dir="${skeletons.dir}/org.lwjgl.feature" casesensitive="yes">
+ <exclude name="**/build.properties" />
+ <exclude name="**/.settings/**" />
+ <exclude name="**/.classpath" />
+ <exclude name="**/.project" />
+ <exclude name="**/*.template" />
+ </fileset>
+ </copy>
+ <copy todir="${build.plugins}/org.lwjgl.updatesite">
+ <fileset dir="${skeletons.dir}/org.lwjgl.updatesite" casesensitive="yes">
+ <exclude name="**/.settings/**" />
+ <exclude name="**/.classpath" />
+ <exclude name="**/.project" />
+ <exclude name="**/*.template" />
+ </fileset>
+ </copy>
+
+
+ <!-- *******************************************************************
+ *
+ * Unzip archives and move content into approriate plugins
+ *
+ ******************************************************************** -->
+ <unzip src="${archives.dir}/${lwjgl.zip}" dest="${build.temp}" />
+ <copy todir="${build.plugins}/org.lwjgl/native">
+ <fileset dir="${lwjgl.dir}/native" />
+ </copy>
+ <copy todir="${build.plugins}/org.lwjgl/">
+ <fileset dir="${lwjgl.dir}/jar">
+ <exclude name="**/lwjgl-debug.jar" />
+ </fileset>
+ </copy>
+ <copy todir="${build.plugins}/org.lwjgl/doc">
+ <fileset dir="${lwjgl.dir}/doc" />
+ </copy>
+ <packagelist property="bundle.export-package" pathsep=",${NL} ">
+ <fileset dir="${lwjgl.dir}/jar">
+ <exclude name="**/lwjgl-debug.jar" />
+ </fileset>
+ <patternset>
+ <exclude name="**/test/**" />
+ <exclude name="**/examples/**" />
+ </patternset>
+ </packagelist>
+ <pathconvert property="bundle.classpath.jars" pathsep=",${NL} ">
+ <map from="${basedir}/${lwjgl.dir}/jar/" to="" />
+ <fileset dir="${lwjgl.dir}/jar">
+ <exclude name="**/lwjgl-debug.jar" />
+ <exclude name="**/lwjgl_test.jar" />
+ </fileset>
+ </pathconvert>
+
+
+ <!-- *******************************************************************
+ *
+ * Build plugins
+ *
+ ******************************************************************** -->
+
+ <!-- *******************************************************************
+ *
+ * org.lwjgl
+ *
+ * Build manifest files, not using manifest task, since manifest wraps
+ * at the wrong positions (at least ant 1.7)
+ *
+ ******************************************************************** -->
+ <echo file="${build.plugins}/org.lwjgl/META-INF/MANIFEST.MF" encoding="UTF-8">Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: LWJGL Lightweight Java Game Library
+Bundle-SymbolicName: org.lwjgl
+Bundle-Version: ${normversion}
+Bundle-Vendor: ${bundle.vendor}
+Bundle-Activator: org.lwjgl.eclipse.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Export-Package: org.lwjgl.eclipse,${NL} ${bundle.export-package}
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: .,${NL} ${bundle.classpath.jars}
+</echo>
+
+ <!-- *******************************************************************
+ *
+ * org.lwjgl.doc
+ *
+ * Build manifest files, not using manifest task, since manifest wraps
+ * at the wrong positions (at least ant 1.7)
+ *
+ ******************************************************************** -->
+ <copy file="${archives.dir}/${lwjgl_docs.zip}" tofile="${build.plugins}/org.lwjgl.doc/doc.zip" />
+ <echo file="${build.plugins}/org.lwjgl.doc/META-INF/MANIFEST.MF" encoding="UTF-8">Manifest-Version: 1.0
+Bundle-Vendor: ${bundle.vendor}
+Bundle-Version: ${normversion}
+Bundle-SymbolicName: org.lwjgl.doc;singleton:=true
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.help;bundle-version="3.2.0"
+Eclipse-LazyStart: true
+</echo>
+
+
+ <!-- *******************************************************************
+ *
+ * org.lwjgl.source
+ *
+ * Build manifest files, not using manifest task, since manifest wraps
+ * at the wrong positions (at least ant 1.7)
+ *
+ ******************************************************************** -->
+ <unzip src="${archives.dir}/${lwjgl_source.zip}" dest="${build.temp}" />
+ <!-- Build src zips for plugin org.lwjgl -->
+ <property name="org.lwjgl.src.dir" value="${build.plugins}/org.lwjgl.source/src/org.lwjgl_${normversion}" />
+ <mkdir dir="${org.lwjgl.src.dir}" />
+ <zip destfile="${org.lwjgl.src.dir}/lwjglsrc.zip">
+ <fileset dir="${lwjgl_source.dir}/generated" />
+ <fileset dir="${lwjgl_source.dir}/java">
+ <exclude name="org/lwjgl/util/**" />
+ </fileset>
+ </zip>
+ <zip destfile="${org.lwjgl.src.dir}/lwjgl_utilsrc.zip">
+ <fileset dir="${lwjgl_source.dir}/java">
+ <include name="org/lwjgl/util/**" />
+ <exclude name="org/lwjgl/util/applet/**" />
+ </fileset>
+ </zip>
+ <!--
+ <zip destfile="${org.lwjgl.src.dir}/lwjgl_util_applet.zip">
+ <fileset dir="${lwjgl_source.dir}/java">
+ <include name="org/lwjgl/util/applet/**" />
+ </fileset>
+ </zip>
+ -->
+ <zip destfile="${org.lwjgl.src.dir}/lwjgl_eclipse.zip">
+ <fileset dir="${skeletons.dir}/org.lwjgl/src/java" casesensitive="yes">
+ <include name="org/lwjgl/**" />
+ </fileset>
+ </zip>
+ <zip destfile="${org.lwjgl.src.dir}/lwjgl_tools.zip">
+ <fileset dir="${skeletons.dir}/org.lwjgl.tools/src/java" casesensitive="yes">
+ <include name="org/lwjgl/**" />
+ </fileset>
+ </zip>
+ <zip destfile="${org.lwjgl.src.dir}/lwjgl_info.zip">
+ <fileset dir="${skeletons.dir}/org.lwjgl.info/src/java" casesensitive="yes">
+ <include name="org/lwjgl/**" />
+ </fileset>
+ </zip>
+
+ <!-- Build manfest -->
+ <!-- not using manifest task, since manifest wraps at the wrong positions -->
+ <echo file="${build.plugins}/org.lwjgl.source/META-INF/MANIFEST.MF" encoding="UTF-8">Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: LWJGL Sources
+Bundle-Vendor: ${bundle.vendor}
+Bundle-Version: ${normversion}
+Bundle-SymbolicName: org.lwjgl.source;singleton:=true
+Bundle-Localization: plugin
+</echo>
+
+ <!-- *******************************************************************
+ *
+ * org.lwjgl.info
+ *
+ * Build manifest files, not using manifest task, since manifest wraps
+ * at the wrong positions (at least ant 1.7)
+ *
+ ******************************************************************** -->
+ <echo file="${build.plugins}/org.lwjgl.info/META-INF/MANIFEST.MF" encoding="UTF-8">Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: LWJGL Test and Info View
+Bundle-Vendor: ${bundle.vendor}
+Bundle-Version: ${normversion}
+Bundle-SymbolicName: org.lwjgl.info;singleton:=true
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.views,
+ org.eclipse.core.resources,
+ org.lwjgl
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+</echo>
+ <!-- Files are already in place -->
+
+ <!-- *******************************************************************
+ *
+ * org.lwjgl.tools
+ *
+ * Build manifest files, not using manifest task, since manifest wraps
+ * at the wrong positions (at least ant 1.7)
+ *
+ ******************************************************************** -->
+ <!-- Build plugin org.lwjgl.tools -->
+ <echo file="${build.plugins}/org.lwjgl.tools/META-INF/MANIFEST.MF" encoding="UTF-8">Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: LWJGL Tools Plug-in
+Bundle-SymbolicName: org.lwjgl.tools;singleton:=true
+Bundle-Version: ${normversion}
+Bundle-Vendor: ${bundle.vendor}
+Bundle-Activator: org.lwjgl.tools.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources;bundle-version="3.4.0",
+ org.eclipse.jdt.core;bundle-version="3.4.0",
+ org.eclipse.jdt.ui;bundle-version="3.4.0",
+ org.lwjgl;bundle-version="${normversion}",
+ org.eclipse.jdt.launching;bundle-version="3.4.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+</echo>
+ <!-- Files are already in place -->
+
+ <!-- *******************************************************************
+ *
+ * org.lwjgl.feature
+ *
+ ******************************************************************** -->
+ <!-- Build org.lwjgl.feature -->
+ <copy file="${skeletons.dir}/org.lwjgl.feature/feature.xml.template" tofile="${build.plugins}/org.lwjgl.feature/feature.xml" encoding="UTF-8" overwrite="true">
+ <filterset>
+ <filter token="VERSION" value="${normversion}" />
+ <filter token="PROVIDERNAME" value="${bundle.vendor}" />
+ <filter token="UPDATEURL" value="${eclipse.updatesite}" />
+ </filterset>
+ </copy>
+
+
+
+ <!-- *******************************************************************
+ *
+ * org.lwjgl.feature.sdk
+ *
+ *
+ ******************************************************************** -->
+ <!-- Build org.lwjgl.feature -->
+ <copy file="${skeletons.dir}/org.lwjgl.feature.sdk/feature.xml.template" tofile="${build.plugins}/org.lwjgl.feature.sdk/feature.xml" encoding="UTF-8" overwrite="true">
+ <filterset>
+ <filter token="VERSION" value="${normversion}" />
+ <filter token="PROVIDERNAME" value="${bundle.vendor}" />
+ <filter token="UPDATEURL" value="${eclipse.updatesite}" />
+ </filterset>
+ </copy>
+
+ <!-- *******************************************************************
+ *
+ * Build update site, i.e. zip all plugins and feature with version
+ * number to appropriate place
+ *
+ ******************************************************************** -->
+ <!-- Build update site -->
+ <copy file="${skeletons.dir}/org.lwjgl.updatesite/site.xml.template" tofile="${build.plugins}/org.lwjgl.updatesite/site.xml" encoding="UTF-8" overwrite="true">
+ <filterset>
+ <filter token="VERSION" value="${normversion}" />
+ <filter token="PROVIDERNAME" value="${bundle.vendor}" />
+ <filter token="UPDATEURL" value="${eclipse.updatesite}" />
+ </filterset>
+ </copy>
+ <mkdir dir="${build.plugins}/org.lwjgl.updatesite/plugins" />
+ <mkdir dir="${build.plugins}/org.lwjgl.updatesite/features" />
+ <jar destfile="${build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl_${normversion}.jar" manifest="${build.plugins}/org.lwjgl/META-INF/MANIFEST.MF">
+ <fileset dir="${build.plugins}/org.lwjgl" casesensitive="yes" />
+ </jar>
+ <jar destfile="${build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.doc_${normversion}.jar" manifest="${build.plugins}/org.lwjgl.doc/META-INF/MANIFEST.MF">
+ <fileset dir="${build.plugins}/org.lwjgl.doc" casesensitive="yes" />
+ </jar>
+ <jar destfile="${build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.source_${normversion}.jar" manifest="${build.plugins}/org.lwjgl.source/META-INF/MANIFEST.MF">
+ <fileset dir="${build.plugins}/org.lwjgl.source" casesensitive="yes" />
+ </jar>
+ <jar destfile="${build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.info_${normversion}.jar" manifest="${build.plugins}/org.lwjgl.info/META-INF/MANIFEST.MF">
+ <fileset dir="${build.plugins}/org.lwjgl.info" casesensitive="yes" />
+ </jar>
+ <jar destfile="${build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.tools_${normversion}.jar" manifest="${build.plugins}/org.lwjgl.tools/META-INF/MANIFEST.MF">
+ <fileset dir="${build.plugins}/org.lwjgl.tools" casesensitive="yes" />
+ </jar>
+ <jar destfile="${build.plugins}/org.lwjgl.updatesite/features/org.lwjgl_${normversion}.jar">
+ <fileset dir="${build.plugins}/org.lwjgl.feature" casesensitive="yes" />
+ </jar>
+ <jar destfile="${build.plugins}/org.lwjgl.updatesite/features/org.lwjgl.sdk_${normversion}.jar">
+ <fileset dir="${build.plugins}/org.lwjgl.feature.sdk" casesensitive="yes" />
+ </jar>
+
+ <!-- *******************************************************************
+ *
+ * Sign plugins and feature
+ *
+ ******************************************************************** -->
+
+ <signjar jar="${build.plugins}/org.lwjgl.updatesite/features/org.lwjgl_${normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${storepass}" keypass="${keypass}" />
+ <signjar jar="${build.plugins}/org.lwjgl.updatesite/features/org.lwjgl.sdk_${normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${storepass}" keypass="${keypass}" />
+ <signjar jar="${build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl_${normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${storepass}" keypass="${keypass}" />
+ <signjar jar="${build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.doc_${normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${storepass}" keypass="${keypass}" />
+ <signjar jar="${build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.source_${normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${storepass}" keypass="${keypass}" />
+ <signjar jar="${build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl.info_${normversion}.jar" keystore="${keystore}" alias="${alias}" storepass="${storepass}" keypass="${keypass}" />
+ <signjar jar="${build.plugins}/org.lwjgl.updatesite/plugins/org.lwjgl....
[truncated message content] |
|
From: <jpi...@us...> - 2011-03-30 09:18:50
|
Revision: 3510
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3510&view=rev
Author: jpilgrim
Date: 2011-03-30 09:18:44 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
Initial import of eclipse plugins.
Added Paths:
-----------
trunk/LWJGL/eclipse-update/org.lwjgl.updatesite/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jpi...@us...> - 2011-03-30 09:16:37
|
Revision: 3509
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3509&view=rev
Author: jpilgrim
Date: 2011-03-30 09:16:31 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
Initial import of eclipse plugins.
Added Paths:
-----------
trunk/LWJGL/eclipse-update/org.lwjgl.tools/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jpi...@us...> - 2011-03-30 09:14:37
|
Revision: 3508
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3508&view=rev
Author: jpilgrim
Date: 2011-03-30 09:14:31 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
Initial import of eclipse plugins.
Added Paths:
-----------
trunk/LWJGL/eclipse-update/org.lwjgl.source/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jpi...@us...> - 2011-03-30 09:12:34
|
Revision: 3507
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3507&view=rev
Author: jpilgrim
Date: 2011-03-30 09:12:28 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
Initial import of eclipse plugins.
Added Paths:
-----------
trunk/LWJGL/eclipse-update/org.lwjgl.info/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jpi...@us...> - 2011-03-30 09:10:52
|
Revision: 3506
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3506&view=rev
Author: jpilgrim
Date: 2011-03-30 09:10:46 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
Initial import of eclipse plugins.
Added Paths:
-----------
trunk/LWJGL/eclipse-update/org.lwjgl.feature.sdk/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jpi...@us...> - 2011-03-30 09:08:54
|
Revision: 3505
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3505&view=rev
Author: jpilgrim
Date: 2011-03-30 09:08:48 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
Initial import of eclipse plugins.
Added Paths:
-----------
trunk/LWJGL/eclipse-update/org.lwjgl.feature/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jpi...@us...> - 2011-03-30 09:07:35
|
Revision: 3504
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3504&view=rev
Author: jpilgrim
Date: 2011-03-30 09:07:27 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
Initial import of eclipse plugins.
Added Paths:
-----------
trunk/LWJGL/eclipse-update/org.lwjgl.doc/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jpi...@us...> - 2011-03-30 09:06:20
|
Revision: 3503
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3503&view=rev
Author: jpilgrim
Date: 2011-03-30 09:06:14 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
Initial import of eclipse plugins.
Added Paths:
-----------
trunk/LWJGL/eclipse-update/org.lwjgl.build/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jpi...@us...> - 2011-03-30 09:04:43
|
Revision: 3502
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3502&view=rev
Author: jpilgrim
Date: 2011-03-30 09:04:35 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
Initial import of eclipse plugins.
Added Paths:
-----------
trunk/LWJGL/eclipse-update/org.lwjgl/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jpi...@us...> - 2011-03-30 09:02:58
|
Revision: 3501
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3501&view=rev
Author: jpilgrim
Date: 2011-03-30 09:02:50 +0000 (Wed, 30 Mar 2011)
Log Message:
-----------
removed old eclipse bundle build
Removed Paths:
-------------
trunk/LWJGL/eclipse-update/org.lwjgl.eclipseplugins/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-03-26 15:58:28
|
Revision: 3500
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3500&view=rev
Author: kappa1
Date: 2011-03-26 15:58:21 +0000 (Sat, 26 Mar 2011)
Log Message:
-----------
AppletLoader: minor javadoc credits update.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-26 15:54:52 UTC (rev 3499)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-26 15:58:21 UTC (rev 3500)
@@ -137,11 +137,13 @@
* <li>Arielsan</li>
* <li>Bobjob</li>
* <li>Dashiva</li>
- * <li>Kevglass</li>
- * <li>MatthiasM</li>
+ * <li>Kevin Glass</li>
+ * <li>Matthias Mann</li>
* <li>Mickelukas</li>
* <li>NateS</li>
* <li>Ruben01</li>
+ * <li>Shannon Smith</li>
+ * <li>pjohnsen</li>
* </ul>
*
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-03-26 15:54:58
|
Revision: 3499
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3499&view=rev
Author: kappa1
Date: 2011-03-26 15:54:52 +0000 (Sat, 26 Mar 2011)
Log Message:
-----------
AppletLoader: fix bug with al_version (should work correctly now). Thx to pjohnsen for spotting it.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-13 14:54:36 UTC (rev 3498)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-26 15:54:52 UTC (rev 3499)
@@ -801,7 +801,7 @@
// if version file exists
if (versionFile.exists()) {
// compare to new version
- if (latestVersion != readFloatFile(versionFile)) {
+ if (latestVersion == readFloatFile(versionFile)) {
versionAvailable = true;
percentage = 90;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-03-13 14:54:42
|
Revision: 3498
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3498&view=rev
Author: kappa1
Date: 2011-03-13 14:54:36 +0000 (Sun, 13 Mar 2011)
Log Message:
-----------
AppletLoader: fix JVM bug where '!' is not escaped on the URL, thanks to NateS for spotting it and special thanks to MatthiasM for the fix.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-12 21:16:22 UTC (rev 3497)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-13 14:54:36 UTC (rev 3498)
@@ -1009,7 +1009,10 @@
URL[] urls = new URL[urlList.length];
for (int i = 0; i < urlList.length; i++) {
- urls[i] = new URL("file:" + path + getJarName(urlList[i]));
+ String file = new File(path, getJarName(urlList[i])).toURI().toString();
+ // fix JVM bug where ! is not escaped
+ file = file.replaceAll("!", "%21");
+ urls[i] = new URL(file);
}
// add downloaded jars to the classpath with required permissions
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-03-12 21:16:29
|
Revision: 3497
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3497&view=rev
Author: kappa1
Date: 2011-03-12 21:16:22 +0000 (Sat, 12 Mar 2011)
Log Message:
-----------
AppletLoader: implemented headless mode. Use the "al_headless" parameter to enable it. Use liveconnect to access the getStatus() and getMessages() methods to obtain the progress of the AppletLoader.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-10 21:49:01 UTC (rev 3496)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-12 21:16:22 UTC (rev 3497)
@@ -257,7 +257,16 @@
/** whether pack200 is supported */
protected boolean pack200Supported;
+
+ /** whether to run in headless mode */
+ protected boolean headless = false;
+
+ /** whether to switch applets in headless mode or wait longer */
+ protected boolean headlessWaiting = true;
+ /** messages to be passed via liveconnect in headless mode */
+ protected String[] headlessMessage;
+
/** generic error message to display on error */
protected String[] genericErrorMessage = { "An error occured while loading the applet.",
"Please contact support to resolve this issue.",
@@ -273,7 +282,7 @@
/** have natives been loaded by another instance of this applet */
protected static boolean natives_loaded;
-
+
/*
* @see java.applet.Applet#init()
*/
@@ -298,14 +307,19 @@
// whether to prepend host to cache path
prependHost = getBooleanParameter("al_prepend_host", true);
+ // whether to run in headless mode
+ headless = getBooleanParameter("al_headless", false);
+
// get colors of applet
bgColor = getColor("boxbgcolor", Color.white);
setBackground(bgColor);
fgColor = getColor("boxfgcolor", Color.black);
- // load logos, if value is "" then an image is not loaded
- logo = getImage(getStringParameter("al_logo", "appletlogo.gif"));
- progressbar = getImage(getStringParameter("al_progressbar", "appletprogress.gif"));
+ if (!headless) {
+ // load logos
+ logo = getImage(getStringParameter("al_logo", "appletlogo.gif"));
+ progressbar = getImage(getStringParameter("al_progressbar", "appletprogress.gif"));
+ }
// check for lzma support
try {
@@ -349,17 +363,19 @@
loaderThread.setName("AppletLoader.loaderThread");
loaderThread.start();
- animationThread = new Thread() {
- public void run() {
- while(loaderThread != null) {
- repaint();
- AppletLoader.this.sleep(100);
+ if (!headless) {
+ animationThread = new Thread() {
+ public void run() {
+ while(loaderThread != null) {
+ repaint();
+ AppletLoader.this.sleep(100);
+ }
+ animationThread = null;
}
- animationThread = null;
- }
- };
- animationThread.setName("AppletLoader.animationthread");
- animationThread.start();
+ };
+ animationThread.setName("AppletLoader.animationthread");
+ animationThread.start();
+ }
}
}
}
@@ -403,6 +419,48 @@
}
/**
+ * Retrieves the current status of the AppletLoader and is
+ * used by liveconnect when running in headless mode.
+ *
+ * This method will return the current progress of the AppletLoader
+ * as a value from 0-100. In the case of a fatal error it will
+ * return -1. If the certificate is refused it will return -2.
+ *
+ * When method returns 100 the AppletLoader will sleep until the
+ * method is called again. When called again it will switch to the
+ * LWJGL Applet. This is a useful trigger to start the LWJGL applet
+ * when needed.
+ */
+ public int getStatus() {
+ if (fatalError) {
+ if (certificateRefused) return -2;
+ headlessMessage = (certificateRefused) ? certificateRefusedMessage : genericErrorMessage;
+ return -1;
+ }
+
+ if (percentage == 100 && headlessWaiting) {
+ headlessWaiting = false;
+ }
+
+ if (percentage == 95) {
+ percentage = 100; // ready to switch applet
+ }
+
+ String[] message = {getDescriptionForState(), subtaskMessage};
+ headlessMessage = message;
+
+ return percentage;
+ }
+
+ /**
+ * Retrieves the current message for the current status.
+ * Used by liveconnect when running in headless mode.
+ */
+ public String[] getMessages() {
+ return headlessMessage;
+ }
+
+ /**
* Transfers the call of AppletResize from the stub to the lwjglApplet.
*/
public void appletResize(int width, int height) {
@@ -471,7 +529,7 @@
og.drawString(errorMessage[i], messageX, messageY + i*fm.getHeight());
}
}
- } else {
+ } else if (!headless) {
og.setColor(fgColor);
painting = true;
@@ -785,6 +843,13 @@
// set lwjgl properties
setLWJGLProperties();
+ // if headless mode then sleep, until told to continue
+ if (headless) {
+ while(headlessWaiting) {
+ Thread.sleep(100);
+ }
+ }
+
// make applet switch on the EDT as an AWT/Swing permission dialog could be called
EventQueue.invokeAndWait(new Runnable() {
public void run() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-03-10 21:49:08
|
Revision: 3496
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3496&view=rev
Author: kappa1
Date: 2011-03-10 21:49:01 +0000 (Thu, 10 Mar 2011)
Log Message:
-----------
AppletLoader: clean up and simplify code relating to reading and writing cache/version files.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-07 22:22:08 UTC (rev 3495)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-10 21:49:01 UTC (rev 3496)
@@ -41,8 +41,6 @@
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.image.ImageObserver;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -745,7 +743,7 @@
// if version file exists
if (versionFile.exists()) {
// compare to new version
- if (latestVersion != readVersionFile(versionFile)) {
+ if (latestVersion != readFloatFile(versionFile)) {
versionAvailable = true;
percentage = 90;
@@ -774,11 +772,11 @@
// save version information once jars downloaded successfully
if (version != null) {
percentage = 90;
- writeVersionFile(versionFile, latestVersion);
+ writeObjectFile(versionFile, latestVersion);
}
// save file names with last modified info once downloaded successfully
- writeCacheFile(new File(dir, "cache"), filesLastModified);
+ writeObjectFile(new File(dir, "timestamps"), filesLastModified);
}
// add the downloaded jars and natives to classpath
@@ -850,83 +848,81 @@
}
/**
- * read the current version file
+ * read float from File
*
- * @param file the file to read
- * @return the version value of saved file
- * @throws Exception if it fails to read value
+ * @param file to be read
+ * @return the float stored in the file or 0 if it fails
*/
- protected float readVersionFile(File file) throws Exception {
- FileInputStream fis = new FileInputStream(file);
+ protected float readFloatFile(File file) {
try {
- DataInputStream dis = new DataInputStream(fis);
- float version = dis.readFloat();
- dis.close();
- return version;
+ Float version = (Float)readObjectFile(file);
+ return version.floatValue();
} catch (Exception e) {
// failed to read version file
e.printStackTrace();
}
- finally {
- fis.close();
- }
// return 0 if failed to read file
return 0;
}
-
+
/**
- * write out version file of applet
+ * read the HashMap from File
*
- * @param file the file to write out to
- * @param version the version of the applet as a float
- * @throws Exception if it fails to write file
+ * @param file the file to read
+ * @return the hashmap stored in the file or an empty hashmap if it fails
*/
- protected void writeVersionFile(File file, float version) throws Exception {
- FileOutputStream fos = new FileOutputStream(file);
- DataOutputStream dos = new DataOutputStream(fos);
- dos.writeFloat(version);
- dos.close();
- fos.close();
+ @SuppressWarnings("unchecked")
+ protected HashMap<String, Long> readHashMapFile(File file) {
+
+ try {
+ return (HashMap<String, Long>) readObjectFile(file);
+ } catch (Exception e) {
+ // failed to read hashmap from file
+ e.printStackTrace();
+ }
+
+ // return an empty map if failed to read file
+ return new HashMap<String, Long>();
}
-
+
/**
- * read the current cache file
- *
+ * read the object from the File
+ *
* @param file the file to read
- * @return the hashmap containing the files names and lastModified times
- * @throws Exception if it fails to read hashmap
+ * @return the object contained in the file or null if it fails
+ * @throws Exception if it fails to read object from file
*/
- @SuppressWarnings("unchecked")
- protected HashMap<String, Long> readCacheFile(File file) throws Exception {
+ protected Object readObjectFile(File file) throws Exception {
FileInputStream fis = new FileInputStream(file);
+
try {
ObjectInputStream dis = new ObjectInputStream(fis);
- HashMap<String, Long> hashMap = (HashMap<String, Long>) dis.readObject();
+ Object object = dis.readObject();
dis.close();
- return hashMap;
+ return object;
} catch (Exception e) {
- // failed to read cache file
+ // failed to read file
e.printStackTrace();
} finally {
fis.close();
}
- // return an empty map if failed to read file
- return new HashMap<String, Long>();
+ // return null if failed to read file
+ return null;
}
-
+
/**
- * write out cache file of applet
+ * write object to specified File
*
* @param file the file to write out to
- * @param filesLastModified the hashmap containing files names and lastModified times
+ * @param object the contents of the file
* @throws Exception if it fails to write file
*/
- protected void writeCacheFile(File file, HashMap<String, Long> filesLastModified) throws Exception {
+ protected void writeObjectFile(File file, Object object) throws Exception {
FileOutputStream fos = new FileOutputStream(file);
ObjectOutputStream dos = new ObjectOutputStream(fos);
- dos.writeObject(filesLastModified);
+ dos.writeObject(object);
dos.close();
fos.close();
}
@@ -1103,11 +1099,11 @@
URLConnection urlconnection;
- File cacheFile = new File(dir, "cache");
+ File timestampsFile = new File(dir, "timestamps");
- // if cache file exists, load it
- if (cacheFile.exists()) {
- filesLastModified = readCacheFile(cacheFile);
+ // if timestamps file exists, load it
+ if (timestampsFile.exists()) {
+ filesLastModified = readHashMapFile(timestampsFile);
}
// calculate total size of jars to download
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-03-07 22:22:15
|
Revision: 3495
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3495&view=rev
Author: kappa1
Date: 2011-03-07 22:22:08 +0000 (Mon, 07 Mar 2011)
Log Message:
-----------
AppletLoader: Add better checks/protection to reading cache/version files in case of corruption. Close resources properly when writing cache/version files. Add preliminary list of contributors. Thx to Arielsan for finding issue and providing patch.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-06 01:34:06 UTC (rev 3494)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-07 22:22:08 UTC (rev 3495)
@@ -129,10 +129,23 @@
* <li>lwjgl_arguments - </li> [String] used to pass the hidden LWJGL parameters to LWJGL e.g. ("-Dorg.lwjgl.input.Mouse.allowNegativeMouseCoords=true -Dorg.lwjgl.util.Debug=true").</li>
* </ul>
* </p>
- * @author kappaOne
+ * @author kappaOne <one...@gm...>
* @author Brian Matzon <br...@ma...>
* @version $Revision$
* $Id$
+ *
+ * Contributors:
+ * <ul>
+ * <li>Arielsan</li>
+ * <li>Bobjob</li>
+ * <li>Dashiva</li>
+ * <li>Kevglass</li>
+ * <li>MatthiasM</li>
+ * <li>Mickelukas</li>
+ * <li>NateS</li>
+ * <li>Ruben01</li>
+ * </ul>
+ *
*/
public class AppletLoader extends Applet implements Runnable, AppletStub {
@@ -844,10 +857,22 @@
* @throws Exception if it fails to read value
*/
protected float readVersionFile(File file) throws Exception {
- DataInputStream dis = new DataInputStream(new FileInputStream(file));
- float version = dis.readFloat();
- dis.close();
- return version;
+ FileInputStream fis = new FileInputStream(file);
+ try {
+ DataInputStream dis = new DataInputStream(fis);
+ float version = dis.readFloat();
+ dis.close();
+ return version;
+ } catch (Exception e) {
+ // failed to read version file
+ e.printStackTrace();
+ }
+ finally {
+ fis.close();
+ }
+
+ // return 0 if failed to read file
+ return 0;
}
/**
@@ -858,9 +883,11 @@
* @throws Exception if it fails to write file
*/
protected void writeVersionFile(File file, float version) throws Exception {
- DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
+ FileOutputStream fos = new FileOutputStream(file);
+ DataOutputStream dos = new DataOutputStream(fos);
dos.writeFloat(version);
dos.close();
+ fos.close();
}
/**
@@ -872,10 +899,21 @@
*/
@SuppressWarnings("unchecked")
protected HashMap<String, Long> readCacheFile(File file) throws Exception {
- ObjectInputStream dis = new ObjectInputStream(new FileInputStream(file));
- HashMap<String, Long> hashMap = (HashMap<String, Long>)dis.readObject();
- dis.close();
- return hashMap;
+ FileInputStream fis = new FileInputStream(file);
+ try {
+ ObjectInputStream dis = new ObjectInputStream(fis);
+ HashMap<String, Long> hashMap = (HashMap<String, Long>) dis.readObject();
+ dis.close();
+ return hashMap;
+ } catch (Exception e) {
+ // failed to read cache file
+ e.printStackTrace();
+ } finally {
+ fis.close();
+ }
+
+ // return an empty map if failed to read file
+ return new HashMap<String, Long>();
}
/**
@@ -886,9 +924,11 @@
* @throws Exception if it fails to write file
*/
protected void writeCacheFile(File file, HashMap<String, Long> filesLastModified) throws Exception {
- ObjectOutputStream dos = new ObjectOutputStream(new FileOutputStream(file));
+ FileOutputStream fos = new FileOutputStream(file);
+ ObjectOutputStream dos = new ObjectOutputStream(fos);
dos.writeObject(filesLastModified);
dos.close();
+ fos.close();
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-03-06 01:34:12
|
Revision: 3494
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3494&view=rev
Author: kappa1
Date: 2011-03-06 01:34:06 +0000 (Sun, 06 Mar 2011)
Log Message:
-----------
AppletLoader: "al_logo" and "al_progress" are now optional parameters, they default to "appletlogo.gif" and "appletprogress.gif". Credit to arielsan for patch.
Modified Paths:
--------------
trunk/LWJGL/applet/advance/appletloader.html
trunk/LWJGL/applet/basic/basicapplet.html
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/applet/advance/appletloader.html
===================================================================
--- trunk/LWJGL/applet/advance/appletloader.html 2011-02-20 20:26:17 UTC (rev 3493)
+++ trunk/LWJGL/applet/advance/appletloader.html 2011-03-06 01:34:06 UTC (rev 3494)
@@ -15,12 +15,6 @@
<!-- Main Applet Class -->
<param name="al_main" value="org.lwjgl.test.applet.GearsApplet">
- <!-- logo to paint while loading, will be centered -->
- <param name="al_logo" value="appletlogo.gif">
-
- <!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
- <param name="al_progressbar" value="appletprogress.gif">
-
<!-- List of Jars to add to classpath -->
<param name="al_jars" value="lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma">
@@ -50,6 +44,12 @@
<!-- foreground color to paint with, defaults to black -->
<!-- <param name="boxfgcolor" value="#ffffff"> -->
+ <!-- logo to paint while loading, will be centered, defaults to "appletlogo.gif" -->
+ <!-- <param name="al_logo" value="appletlogo.gif"> -->
+
+ <!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done, defaults to "appletprogress.gif" -->
+ <!-- <param name="al_progressbar" value="appletprogress.gif"> -->
+
<!-- whether to run in debug mode -->
<!-- <param name="al_debug" value="true"> -->
Modified: trunk/LWJGL/applet/basic/basicapplet.html
===================================================================
--- trunk/LWJGL/applet/basic/basicapplet.html 2011-02-20 20:26:17 UTC (rev 3493)
+++ trunk/LWJGL/applet/basic/basicapplet.html 2011-03-06 01:34:06 UTC (rev 3494)
@@ -15,12 +15,6 @@
<!-- Main Applet Class -->
<param name="al_main" value="org.lwjgl.test.applet.GearsApplet">
- <!-- logo to paint while loading, will be centered -->
- <param name="al_logo" value="appletlogo.gif">
-
- <!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
- <param name="al_progressbar" value="appletprogress.gif">
-
<!-- List of Jars to add to classpath -->
<param name="al_jars" value="lwjgl_applet.jar, lwjgl.jar, jinput.jar, lwjgl_util.jar">
@@ -50,6 +44,12 @@
<!-- foreground color to paint with, defaults to black -->
<!-- <param name="boxfgcolor" value="#ffffff"> -->
+ <!-- logo to paint while loading, will be centered, defaults to "appletlogo.gif" -->
+ <!-- <param name="al_logo" value="appletlogo.gif"> -->
+
+ <!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done, defaults to "appletprogress.gif" -->
+ <!-- <param name="al_progressbar" value="appletprogress.gif"> -->
+
<!-- whether to run in debug mode -->
<!-- <param name="al_debug" value="true"> -->
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-02-20 20:26:17 UTC (rev 3493)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-03-06 01:34:06 UTC (rev 3494)
@@ -99,9 +99,6 @@
* <li>al_main - [String] Full package and class the applet to instantiate and display when loaded.</li>
* <li>al_jars - [String] Comma seperated list of jars to download.</li>
* <p>
- * <li>al_logo - [String Path of of the logo resource to paint while loading.</li>
- * <li>al_progressbar - [String] Path of the progressbar resource to paint on top of the logo, width clipped by percentage.</li>
- * <p>
* <li>al_windows - [String] Jar containing native files for windows.</li>
* <li>al_linux - [String] Jar containing native files for linux.</li>
* <li>al_mac - [String] Jar containing native files for mac.</li>
@@ -126,6 +123,9 @@
* <li>boxbgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as background. <i>Default: #ffffff</i>.</li>
* <li>boxfgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as foreground. <i>Default: #000000</i>.</li>
* <p>
+ * <li>al_logo - [String Path of of the logo resource to paint while loading.<i>Default: "appletlogo.gif"</i>.</li>
+ * <li>al_progressbar - [String] Path of the progressbar resource to paint on top of the logo, width clipped by percentage.<i>Default: "appletprogress.gif"</i>.</li>
+ * <p>
* <li>lwjgl_arguments - </li> [String] used to pass the hidden LWJGL parameters to LWJGL e.g. ("-Dorg.lwjgl.input.Mouse.allowNegativeMouseCoords=true -Dorg.lwjgl.util.Debug=true").</li>
* </ul>
* </p>
@@ -270,7 +270,7 @@
setState(STATE_INIT);
// sanity check
- String[] requiredArgs = {"al_main", "al_logo", "al_progressbar", "al_jars"};
+ String[] requiredArgs = {"al_main", "al_jars"};
for ( String requiredArg : requiredArgs ) {
if ( getParameter(requiredArg) == null ) {
fatalErrorOccured("missing required applet parameter: " + requiredArg, null);
@@ -292,13 +292,9 @@
setBackground(bgColor);
fgColor = getColor("boxfgcolor", Color.black);
- // load logos, if value is "" then skip
- if (getParameter("al_logo").length() > 0) {
- logo = getImage(getParameter("al_logo"));
- }
- if (getParameter("al_progressbar").length() > 0) {
- progressbar = getImage(getParameter("al_progressbar"));
- }
+ // load logos, if value is "" then an image is not loaded
+ logo = getImage(getStringParameter("al_logo", "appletlogo.gif"));
+ progressbar = getImage(getStringParameter("al_progressbar", "appletprogress.gif"));
// check for lzma support
try {
@@ -1563,6 +1559,9 @@
*/
protected Image getImage(String s) {
+ // if s is "" then don't load an image
+ if (s.length() == 0) return null;
+
Image image = null;
try {
@@ -1688,9 +1687,23 @@
return defaultColor;
}
}
+
+ /**
+ * Retrieves the String value for the parameter
+ * @param name Name of parameter
+ * @param defaultValue default value to return if no such parameter
+ * @return value of parameter or defaultValue
+ */
+ protected String getStringParameter(String name, String defaultValue) {
+ String parameter = getParameter(name);
+ if (parameter != null) {
+ return parameter;
+ }
+ return defaultValue;
+ }
/**
- * Retrieves the boolean value for the applet
+ * Retrieves the boolean value for the parameter
* @param name Name of parameter
* @param defaultValue default value to return if no such parameter
* @return value of parameter or defaultValue
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-02-20 20:26:23
|
Revision: 3493
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3493&view=rev
Author: kappa1
Date: 2011-02-20 20:26:17 +0000 (Sun, 20 Feb 2011)
Log Message:
-----------
AppletLoader: replace appletlogo.png with appletlogo.gif (43% smaller)
Modified Paths:
--------------
trunk/LWJGL/applet/advance/appletloader.html
trunk/LWJGL/applet/basic/basicapplet.html
Added Paths:
-----------
trunk/LWJGL/res/appletlogo.gif
Removed Paths:
-------------
trunk/LWJGL/res/appletlogo.png
Modified: trunk/LWJGL/applet/advance/appletloader.html
===================================================================
--- trunk/LWJGL/applet/advance/appletloader.html 2011-02-17 19:43:33 UTC (rev 3492)
+++ trunk/LWJGL/applet/advance/appletloader.html 2011-02-20 20:26:17 UTC (rev 3493)
@@ -16,7 +16,7 @@
<param name="al_main" value="org.lwjgl.test.applet.GearsApplet">
<!-- logo to paint while loading, will be centered -->
- <param name="al_logo" value="appletlogo.png">
+ <param name="al_logo" value="appletlogo.gif">
<!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
<param name="al_progressbar" value="appletprogress.gif">
Modified: trunk/LWJGL/applet/basic/basicapplet.html
===================================================================
--- trunk/LWJGL/applet/basic/basicapplet.html 2011-02-17 19:43:33 UTC (rev 3492)
+++ trunk/LWJGL/applet/basic/basicapplet.html 2011-02-20 20:26:17 UTC (rev 3493)
@@ -16,7 +16,7 @@
<param name="al_main" value="org.lwjgl.test.applet.GearsApplet">
<!-- logo to paint while loading, will be centered -->
- <param name="al_logo" value="appletlogo.png">
+ <param name="al_logo" value="appletlogo.gif">
<!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
<param name="al_progressbar" value="appletprogress.gif">
Added: trunk/LWJGL/res/appletlogo.gif
===================================================================
(Binary files differ)
Property changes on: trunk/LWJGL/res/appletlogo.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted: trunk/LWJGL/res/appletlogo.png
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2011-02-17 19:43:40
|
Revision: 3492
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3492&view=rev
Author: kappa1
Date: 2011-02-17 19:43:33 +0000 (Thu, 17 Feb 2011)
Log Message:
-----------
AppletLoader: add missing javadoc for the "lwjgl_arguments" parameter.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-02-17 19:09:59 UTC (rev 3491)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2011-02-17 19:43:33 UTC (rev 3492)
@@ -97,9 +97,11 @@
* The following applet parameters are required:
* <ul>
* <li>al_main - [String] Full package and class the applet to instantiate and display when loaded.</li>
+ * <li>al_jars - [String] Comma seperated list of jars to download.</li>
+ * <p>
* <li>al_logo - [String Path of of the logo resource to paint while loading.</li>
* <li>al_progressbar - [String] Path of the progressbar resource to paint on top of the logo, width clipped by percentage.</li>
- * <li>al_jars - [String] Comma seperated list of jars to download.</li>
+ * <p>
* <li>al_windows - [String] Jar containing native files for windows.</li>
* <li>al_linux - [String] Jar containing native files for linux.</li>
* <li>al_mac - [String] Jar containing native files for mac.</li>
@@ -115,14 +117,16 @@
* <li>al_cache - [boolean] Whether to use cache system. <i>Default: true</i>.</li>
* <li>al_debug - [boolean] Whether to enable debug mode. <i>Default: false</i>.</li>
* <li>al_prepend_host - [boolean] Whether to limit caching to this domain, disable if your applet is hosted on multple domains and needs to share the cache. <i>Default: true</i>.</li>
- * <ul>
+ * <p>
* <li>al_windows64 - [String] If specified it will be used instead of al_windows on 64bit windows systems.</li>
* <li>al_windows32 - [String] If specifed it will be used instead of al_windows on 32bit windows systems.</li>
* <li>al_linux64 - [String] If specifed it will be used instead of al_linux on 64bit linux systems.</li>
* <li>al_linux32 - [String] If specifed it will be used instead of al_linux on 32bit linux systems.</li>
- * <ul>
+ * <p>
* <li>boxbgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as background. <i>Default: #ffffff</i>.</li>
* <li>boxfgcolor - [String] any String AWT color ("red", "blue", etc), RGB (0-255) or hex formated color (#RRGGBB) to use as foreground. <i>Default: #000000</i>.</li>
+ * <p>
+ * <li>lwjgl_arguments - </li> [String] used to pass the hidden LWJGL parameters to LWJGL e.g. ("-Dorg.lwjgl.input.Mouse.allowNegativeMouseCoords=true -Dorg.lwjgl.util.Debug=true").</li>
* </ul>
* </p>
* @author kappaOne
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|