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: <ka...@us...> - 2012-04-26 13:19:29
|
Revision: 3766
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3766&view=rev
Author: kappa1
Date: 2012-04-26 13:19:18 +0000 (Thu, 26 Apr 2012)
Log Message:
-----------
AppletLoader: add further checks to prevent Java default caching
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 2012-04-22 23:05:10 UTC (rev 3765)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2012-04-26 13:19:18 UTC (rev 3766)
@@ -1460,7 +1460,7 @@
urlconnection.setUseCaches(false);
if (urlconnection instanceof HttpURLConnection) {
- urlconnection.setRequestProperty("Cache-Control", "no-cache");
+ urlconnection.setRequestProperty("Cache-Control", "no-store,max-age=0,no-cache");
urlconnection.connect();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-04-22 23:05:16
|
Revision: 3765
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3765&view=rev
Author: kappa1
Date: 2012-04-22 23:05:10 +0000 (Sun, 22 Apr 2012)
Log Message:
-----------
AppletLoader: set all streams that are open to use try/finally blocks to close the streams
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 2012-04-22 22:51:47 UTC (rev 3764)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2012-04-22 23:05:10 UTC (rev 3765)
@@ -1143,10 +1143,13 @@
*/
protected void writeObjectFile(File file, Object object) throws Exception {
FileOutputStream fos = new FileOutputStream(file);
- ObjectOutputStream dos = new ObjectOutputStream(fos);
- dos.writeObject(object);
- dos.close();
- fos.close();
+ try {
+ ObjectOutputStream dos = new ObjectOutputStream(fos);
+ dos.writeObject(object);
+ dos.close();
+ } finally {
+ fos.close();
+ }
}
/**
@@ -1602,15 +1605,17 @@
byte [] buffer = new byte [1<<14];
- int ret = inputHandle.read(buffer);
- while (ret >= 1) {
- outputHandle.write(buffer,0,ret);
- ret = inputHandle.read(buffer);
+ try {
+ int ret = inputHandle.read(buffer);
+ while (ret >= 1) {
+ outputHandle.write(buffer,0,ret);
+ ret = inputHandle.read(buffer);
+ }
+ } finally {
+ inputHandle.close();
+ outputHandle.close();
}
- inputHandle.close();
- outputHandle.close();
-
// delete LZMA file, as it is no longer needed
f.delete();
}
@@ -1630,17 +1635,19 @@
OutputStream outputHandle = new FileOutputStream(out);
- byte [] buffer = new byte [1<<14];
-
- int ret = inputHandle.read(buffer);
- while (ret >= 1) {
- outputHandle.write(buffer,0,ret);
- ret = inputHandle.read(buffer);
+ try {
+ byte [] buffer = new byte [1<<14];
+
+ int ret = inputHandle.read(buffer);
+ while (ret >= 1) {
+ outputHandle.write(buffer,0,ret);
+ ret = inputHandle.read(buffer);
+ }
+ } finally {
+ inputHandle.close();
+ outputHandle.close();
}
- inputHandle.close();
- outputHandle.close();
-
// delete GZip file, as it is no longer needed
f.delete();
}
@@ -1655,12 +1662,15 @@
File f = new File(in);
FileOutputStream fostream = new FileOutputStream(out);
JarOutputStream jostream = new JarOutputStream(fostream);
+
+ try {
+ Pack200.Unpacker unpacker = Pack200.newUnpacker();
+ unpacker.unpack(f, jostream);
+ } finally {
+ jostream.close();
+ fostream.close();
+ }
- Pack200.Unpacker unpacker = Pack200.newUnpacker();
- unpacker.unpack(f, jostream);
- jostream.close();
- fostream.close();
-
// delete pack file as its no longer needed
f.delete();
}
@@ -1803,21 +1813,23 @@
InputStream in = jarFile.getInputStream(jarFile.getEntry(entry.getName()));
OutputStream out = new FileOutputStream(path + "natives" + File.separator + entry.getName());
- int bufferSize;
- byte buffer[] = new byte[65536];
-
- while ((bufferSize = in.read(buffer, 0, buffer.length)) != -1) {
- debug_sleep(10);
- out.write(buffer, 0, bufferSize);
- currentSizeExtract += bufferSize;
-
- // update progress bar
- percentage = 65 + (int)(percentageParts * (jarNum + currentSizeExtract/(float)totalSizeExtract));
- subtaskMessage = "Extracting: " + entry.getName() + " " + ((currentSizeExtract * 100) / totalSizeExtract) + "%";
+ try {
+ int bufferSize;
+ byte buffer[] = new byte[65536];
+
+ while ((bufferSize = in.read(buffer, 0, buffer.length)) != -1) {
+ debug_sleep(10);
+ out.write(buffer, 0, bufferSize);
+ currentSizeExtract += bufferSize;
+
+ // update progress bar
+ percentage = 65 + (int)(percentageParts * (jarNum + currentSizeExtract/(float)totalSizeExtract));
+ subtaskMessage = "Extracting: " + entry.getName() + " " + ((currentSizeExtract * 100) / totalSizeExtract) + "%";
+ }
+ } finally {
+ in.close();
+ out.close();
}
-
- in.close();
- out.close();
// validate the certificate for the native file being extracted
if (!certificatesMatch(certificate, entry.getCertificates())) {
@@ -1881,6 +1893,7 @@
JarURLConnection jurl = (JarURLConnection) (new URL("jar:" + location.toString() + "!/org/lwjgl/util/applet/AppletLoader.class").openConnection());
jurl.setDefaultUseCaches(true);
certificate = jurl.getCertificates();
+ jurl.setDefaultUseCaches(false);
}
return certificate;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-04-22 22:51:54
|
Revision: 3764
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3764&view=rev
Author: kappa1
Date: 2012-04-22 22:51:47 +0000 (Sun, 22 Apr 2012)
Log Message:
-----------
AppletLoader: add try/finally block to ensure file is closed on exception in the downloadJars(), thx to MatthiasM for pointing it out.
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 2012-04-22 22:21:41 UTC (rev 3763)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2012-04-22 22:51:47 UTC (rev 3764)
@@ -1464,44 +1464,47 @@
String currentFile = getFileName(urlList[i]);
InputStream inputstream = getJarInputStream(currentFile, urlconnection);
FileOutputStream fos = new FileOutputStream(path + currentFile);
-
-
+
+
int bufferSize;
long downloadStartTime = System.currentTimeMillis();
int downloadedAmount = 0;
int fileSize = 0;
String downloadSpeedMessage = "";
-
- while ((bufferSize = inputstream.read(buffer, 0, buffer.length)) != -1) {
- debug_sleep(10);
- fos.write(buffer, 0, bufferSize);
- currentSizeDownload += bufferSize;
- fileSize += bufferSize;
- percentage = initialPercentage + ((currentSizeDownload * 45) / totalSizeDownload);
- subtaskMessage = "Retrieving: " + currentFile + " " + ((currentSizeDownload * 100) / totalSizeDownload) + "%";
-
- downloadedAmount += bufferSize;
- long timeLapse = System.currentTimeMillis() - downloadStartTime;
- // update only if a second or more has passed
- if (timeLapse >= 1000) {
- // get kb/s, nice that bytes/millis is same as kilobytes/seconds
- float downloadSpeed = (float) downloadedAmount / timeLapse;
- // round to two decimal places
- downloadSpeed = ((int)(downloadSpeed*100))/100f;
- // set current speed message
- downloadSpeedMessage = " - " + downloadSpeed + " KB/sec";
- // reset downloaded amount
- downloadedAmount = 0;
- // reset start time
- downloadStartTime = System.currentTimeMillis();
+
+ try {
+ while ((bufferSize = inputstream.read(buffer, 0, buffer.length)) != -1) {
+ debug_sleep(10);
+ fos.write(buffer, 0, bufferSize);
+ currentSizeDownload += bufferSize;
+ fileSize += bufferSize;
+ percentage = initialPercentage + ((currentSizeDownload * 45) / totalSizeDownload);
+ subtaskMessage = "Retrieving: " + currentFile + " " + ((currentSizeDownload * 100) / totalSizeDownload) + "%";
+
+ downloadedAmount += bufferSize;
+ long timeLapse = System.currentTimeMillis() - downloadStartTime;
+ // update only if a second or more has passed
+ if (timeLapse >= 1000) {
+ // get kb/s, nice that bytes/millis is same as kilobytes/seconds
+ float downloadSpeed = (float) downloadedAmount / timeLapse;
+ // round to two decimal places
+ downloadSpeed = ((int)(downloadSpeed*100))/100f;
+ // set current speed message
+ downloadSpeedMessage = " - " + downloadSpeed + " KB/sec";
+ // reset downloaded amount
+ downloadedAmount = 0;
+ // reset start time
+ downloadStartTime = System.currentTimeMillis();
+ }
+
+ subtaskMessage += downloadSpeedMessage;
}
-
- subtaskMessage += downloadSpeedMessage;
+
+ } finally {
+ inputstream.close();
+ fos.close();
}
-
- inputstream.close();
- fos.close();
-
+
// download complete, verify if it was successful
if (urlconnection instanceof HttpURLConnection) {
if (fileSize == fileSizes[i]) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-04-22 22:21:47
|
Revision: 3763
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3763&view=rev
Author: kappa1
Date: 2012-04-22 22:21:41 +0000 (Sun, 22 Apr 2012)
Log Message:
-----------
AppletLoader: add extra urlconnections.setUseCaches(false) as an extra precaution to make sure caching is disabled.
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 2012-04-18 16:50:40 UTC (rev 3762)
+++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2012-04-22 22:21:41 UTC (rev 3763)
@@ -1454,6 +1454,7 @@
debug_sleep(2000);
urlconnection = urlList[i].openConnection();
+ urlconnection.setUseCaches(false);
if (urlconnection instanceof HttpURLConnection) {
urlconnection.setRequestProperty("Cache-Control", "no-cache");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2012-04-18 16:50:50
|
Revision: 3762
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3762&view=rev
Author: spasi
Date: 2012-04-18 16:50:40 +0000 (Wed, 18 Apr 2012)
Log Message:
-----------
Added INTEL_thread_local_exec OpenCL extension.
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opencl/INTEL_thread_local_exec.java
Added: trunk/LWJGL/src/templates/org/lwjgl/opencl/INTEL_thread_local_exec.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/INTEL_thread_local_exec.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/INTEL_thread_local_exec.java 2012-04-18 16:50:40 UTC (rev 3762)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002-2012 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opencl;
+
+import org.lwjgl.util.generator.opencl.CLDeviceExtension;
+
+@CLDeviceExtension
+public interface INTEL_thread_local_exec {
+
+ /**
+ * Allows the user to execute OpenCL tasks and kernels with
+ * the user application's threads. This token that can
+ * be passed to clCreateCommandQueue, creating a queue with the "thread
+ * local exec" capability.
+ * <p/>
+ * All enqueue APIs (e.g., clEnqueueRead) submitted to such a queue
+ * never enqueue commands. An Enqueue API call is executed by the
+ * caller host-thread itself without involving any of the OpenCL
+ * runtime threads, much like function calls.
+ */
+ int CL_QUEUE_THREAD_LOCAL_EXEC_ENABLE_INTEL = (1 << 31);
+
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-04-14 18:55:48
|
Revision: 3761
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3761&view=rev
Author: kappa1
Date: 2012-04-14 18:55:40 +0000 (Sat, 14 Apr 2012)
Log Message:
-----------
Fix Display.getWidth() and Display.getHeight() to return the correct values on OS X when the window has been resized.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java 2012-04-10 13:23:08 UTC (rev 3760)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXFrame.java 2012-04-14 18:55:40 UTC (rev 3761)
@@ -110,7 +110,17 @@
Insets insets = getInsets();
setBounds(x, y, width + insets.left + insets.right, height + insets.top + insets.bottom);
}
+
+ public int getWidth() {
+ Insets insets = getInsets();
+ return super.getWidth() - insets.left - insets.right;
+ }
+ public int getHeight() {
+ Insets insets = getInsets();
+ return super.getHeight() - insets.top - insets.bottom;
+ }
+
public Rectangle syncGetBounds() {
synchronized ( this ) {
return bounds;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-04-10 13:23:15
|
Revision: 3760
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3760&view=rev
Author: kappa1
Date: 2012-04-10 13:23:08 +0000 (Tue, 10 Apr 2012)
Log Message:
-----------
Update ControllerAdapter in util package to reflect new changes in the Controller interface class (should fix broken build)
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/input/Controller.java
trunk/LWJGL/src/java/org/lwjgl/input/JInputController.java
trunk/LWJGL/src/java/org/lwjgl/util/input/ControllerAdapter.java
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Controller.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Controller.java 2012-04-10 11:44:50 UTC (rev 3759)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Controller.java 2012-04-10 13:23:08 UTC (rev 3760)
@@ -279,12 +279,12 @@
*
* @param index The rumbler index
*/
- String getRumblerName(final int index);
+ String getRumblerName(int index);
/** Sets the vibration strength of the specified rumbler
*
* @param index The index of the rumbler
* @param strength The strength to vibrate at
*/
- void setRumblerStrength(final int index, final float strength);
+ void setRumblerStrength(int index, float strength);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/input/JInputController.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/JInputController.java 2012-04-10 11:44:50 UTC (rev 3759)
+++ trunk/LWJGL/src/java/org/lwjgl/input/JInputController.java 2012-04-10 13:23:08 UTC (rev 3760)
@@ -89,7 +89,7 @@
* @param index The index this controller has been assigned to
* @param target The target JInput controller this class is wrapping
*/
- JInputController(final int index, net.java.games.input.Controller target) {
+ JInputController(int index, net.java.games.input.Controller target) {
this.target = target;
this.index = index;
@@ -515,11 +515,11 @@
return rumblers.length;
}
- public String getRumblerName(final int index) {
+ public String getRumblerName(int index) {
return rumblers[index].getAxisName();
}
- public void setRumblerStrength(final int index, final float strength) {
+ public void setRumblerStrength(int index, float strength) {
rumblers[index].rumble(strength);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/input/ControllerAdapter.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/input/ControllerAdapter.java 2012-04-10 11:44:50 UTC (rev 3759)
+++ trunk/LWJGL/src/java/org/lwjgl/util/input/ControllerAdapter.java 2012-04-10 13:23:08 UTC (rev 3760)
@@ -326,4 +326,15 @@
*/
public void setRZAxisDeadZone(float zone) {
}
+
+ public int getRumblerCount() {
+ return 0;
+ }
+
+ public String getRumblerName(int index) {
+ return "rumber n/a";
+ }
+
+ public void setRumblerStrength(int index, float strength) {
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-04-10 11:44:56
|
Revision: 3759
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3759&view=rev
Author: kappa1
Date: 2012-04-10 11:44:50 +0000 (Tue, 10 Apr 2012)
Log Message:
-----------
Apply patch by OrangyTang to expose JInput's rumble functionality in LWJGL's Controller class.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/input/Controller.java
trunk/LWJGL/src/java/org/lwjgl/input/JInputController.java
Modified: trunk/LWJGL/src/java/org/lwjgl/input/Controller.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/Controller.java 2012-03-27 13:12:30 UTC (rev 3758)
+++ trunk/LWJGL/src/java/org/lwjgl/input/Controller.java 2012-04-10 11:44:50 UTC (rev 3759)
@@ -270,4 +270,21 @@
* @param zone The dead zone to use for the RZ axis
*/
void setRZAxisDeadZone(float zone);
+
+
+ /** Returns the number of rumblers this controller supports */
+ int getRumblerCount();
+
+ /** Returns the name of the specified rumbler
+ *
+ * @param index The rumbler index
+ */
+ String getRumblerName(final int index);
+
+ /** Sets the vibration strength of the specified rumbler
+ *
+ * @param index The index of the rumbler
+ * @param strength The strength to vibrate at
+ */
+ void setRumblerStrength(final int index, final float strength);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/input/JInputController.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/input/JInputController.java 2012-03-27 13:12:30 UTC (rev 3758)
+++ trunk/LWJGL/src/java/org/lwjgl/input/JInputController.java 2012-04-10 11:44:50 UTC (rev 3759)
@@ -38,6 +38,7 @@
import net.java.games.input.Component.Identifier.Button;
import net.java.games.input.Event;
import net.java.games.input.EventQueue;
+import net.java.games.input.Rumbler;
/**
* A wrapper round a JInput controller that attempts to make the interface
@@ -56,6 +57,8 @@
private ArrayList<Component> axes = new ArrayList<Component>();
/** The POVs that have been detected on the JInput controller */
private ArrayList<Component> pov = new ArrayList<Component>();
+ /** The rumblers exposed by the controller */
+ private Rumbler[] rumblers;
/** The state of the buttons last check */
private boolean[] buttonState;
/** The values that were read from the pov last check */
@@ -86,7 +89,7 @@
* @param index The index this controller has been assigned to
* @param target The target JInput controller this class is wrapping
*/
- JInputController(int index,net.java.games.input.Controller target) {
+ JInputController(final int index, net.java.games.input.Controller target) {
this.target = target;
this.index = index;
@@ -148,6 +151,8 @@
axesMax[i] = 1.0f;
deadZones[i] = 0.05f;
}
+
+ rumblers = target.getRumblers();
}
/*
@@ -506,5 +511,16 @@
return 0;
}
+ public int getRumblerCount() {
+ return rumblers.length;
+ }
+
+ public String getRumblerName(final int index) {
+ return rumblers[index].getAxisName();
+ }
+
+ public void setRumblerStrength(final int index, final float strength) {
+ rumblers[index].rumble(strength);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2012-03-27 13:12:36
|
Revision: 3758
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3758&view=rev
Author: spasi
Date: 2012-03-27 13:12:30 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
Added support for: AMD_vertex_shader_viewport_index, AMD_vertex_shader_layer, NV_bindless_texture, NV_shader_atomic_float.
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_layer.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_viewport_index.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_bindless_texture.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_atomic_float.java
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_layer.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_layer.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_layer.java 2012-03-27 13:12:30 UTC (rev 3758)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2002-2012 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface AMD_vertex_shader_layer {
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_viewport_index.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_viewport_index.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_vertex_shader_viewport_index.java 2012-03-27 13:12:30 UTC (rev 3758)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2002-2012 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface AMD_vertex_shader_viewport_index {
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_bindless_texture.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_bindless_texture.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_bindless_texture.java 2012-03-27 13:12:30 UTC (rev 3758)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2002-2012 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.util.generator.AutoSize;
+import org.lwjgl.util.generator.Const;
+import org.lwjgl.util.generator.StripPostfix;
+import org.lwjgl.util.generator.opengl.GLenum;
+import org.lwjgl.util.generator.opengl.GLsizei;
+import org.lwjgl.util.generator.opengl.GLuint;
+import org.lwjgl.util.generator.opengl.GLuint64;
+
+import java.nio.LongBuffer;
+
+public interface NV_bindless_texture {
+
+ @GLuint64
+ long glGetTextureHandleNV(@GLuint int texture);
+
+ @GLuint64
+ long glGetTextureSamplerHandleNV(@GLuint int texture, @GLuint int sampler);
+
+ void glMakeTextureHandleResidentNV(@GLuint64 long handle);
+
+ void glMakeTextureHandleNonResidentNV(@GLuint64 long handle);
+
+ @GLuint64
+ long glGetImageHandleNV(@GLuint int texture, int level, boolean layered,
+ int layer, @GLenum int format);
+
+ void glMakeImageHandleResidentNV(@GLuint64 long handle, @GLenum int access);
+
+ void glMakeImageHandleNonResidentNV(@GLuint64 long handle);
+
+ void glUniformHandleui64NV(int location, @GLuint64 long value);
+
+ @StripPostfix("value")
+ void glUniformHandleui64vNV(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64 LongBuffer value);
+
+ void glProgramUniformHandleui64NV(@GLuint int program, int location,
+ @GLuint64 long value);
+
+ @StripPostfix("values")
+ void glProgramUniformHandleui64vNV(@GLuint int program, int location,
+ @AutoSize("values") @GLsizei int count, @Const @GLuint64 LongBuffer values);
+
+ boolean glIsTextureHandleResidentNV(@GLuint64 long handle);
+
+ boolean glIsImageHandleResidentNV(@GLuint64 long handle);
+
+}
\ No newline at end of file
Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_atomic_float.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_atomic_float.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_shader_atomic_float.java 2012-03-27 13:12:30 UTC (rev 3758)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002-2012 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+public interface NV_shader_atomic_float {
+
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-24 00:39:12
|
Revision: 3757
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3757&view=rev
Author: kappa1
Date: 2012-03-24 00:39:05 +0000 (Sat, 24 Mar 2012)
Log Message:
-----------
remove non-existing import.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java 2012-03-24 00:20:02 UTC (rev 3756)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java 2012-03-24 00:39:05 UTC (rev 3757)
@@ -32,7 +32,6 @@
package org.lwjgl.opengl;
import org.lwjgl.Sys;
-import org.ninjacave.framework.Sync.RunningAvg;
/**
* A highly accurate sync method that continually adapts to the system
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-24 00:20:09
|
Revision: 3756
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3756&view=rev
Author: kappa1
Date: 2012-03-24 00:20:02 +0000 (Sat, 24 Mar 2012)
Log Message:
-----------
fix minor javadoc typo's
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-03-24 00:04:52 UTC (rev 3755)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-03-24 00:20:02 UTC (rev 3756)
@@ -399,9 +399,7 @@
}
/**
- * An accurate sync method that will attempt to run an application loop
- * at a constant frame rate.
- *
+ * An accurate sync method that will attempt to run at a constant frame rate.
* It should be called once every frame.
*
* @param fps - the desired frame rate, in frames per second
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java 2012-03-24 00:04:52 UTC (rev 3755)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java 2012-03-24 00:20:02 UTC (rev 3756)
@@ -32,6 +32,7 @@
package org.lwjgl.opengl;
import org.lwjgl.Sys;
+import org.ninjacave.framework.Sync.RunningAvg;
/**
* A highly accurate sync method that continually adapts to the system
@@ -51,15 +52,13 @@
/** whether the initialisation code has run */
private static boolean initialised = false;
- /** stored results of how long sleep/yields took to calculate averages */
+ /** for calculating the averages the previous sleep/yield times are stored */
private static RunningAvg sleepDurations = new RunningAvg(10);
private static RunningAvg yieldDurations = new RunningAvg(10);
/**
- * An accurate sync method that will attempt to run an application loop
- * at a constant frame rate.
- *
+ * An accurate sync method that will attempt to run at a constant frame rate.
* It should be called once every frame.
*
* @param fps - the desired frame rate, in frames per second
@@ -75,7 +74,7 @@
sleepDurations.add((t1 = getTime()) - t0); // update average sleep time
}
- // slowly dampen sleep average if too high to avoid over yielding
+ // slowly dampen sleep average if too high to avoid yielding too much
sleepDurations.dampenForLowResTicker();
// yield until the average yield time is greater than the time remaining till nextFrame
@@ -93,9 +92,9 @@
/**
* This method will initialise the sync method by setting initial
- * values for sleepDurations/yieldDurations and nextFrame variables.
+ * values for sleepDurations/yieldDurations and nextFrame.
*
- * If running windows on windows it will start the sleep timer fix.
+ * If running on windows it will start the sleep timer fix.
*/
private static void initialise() {
initialised = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-24 00:05:05
|
Revision: 3755
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3755&view=rev
Author: kappa1
Date: 2012-03-24 00:04:52 +0000 (Sat, 24 Mar 2012)
Log Message:
-----------
Replace Display.sync(int fps) with an even better implementation, special thanks to Riven.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-03-21 19:34:51 UTC (rev 3754)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-03-24 00:04:52 UTC (rev 3755)
@@ -79,18 +79,6 @@
/** The current display mode, if created */
private static DisplayMode current_mode;
- /** time at last sync() */
- private static long lastTime;
-
- /** Whether the sync() method has been initiated */
- private static boolean syncInitiated;
-
- /** whether to disable adaptive yield time in sync() method */
- private static boolean adaptiveTimeDisabled;
-
- /** adaptive time to yield instead of sleeping in sync()*/
- private static long adaptiveYieldTime;
-
/** X coordinate of the window */
private static int x = -1;
@@ -411,98 +399,16 @@
}
/**
- * An accurate sync method that adapts automatically
- * to the system it runs on to provide reliable results.
+ * An accurate sync method that will attempt to run an application loop
+ * at a constant frame rate.
*
- * @param fps The desired frame rate, in frames per second
+ * It should be called once every frame.
+ *
+ * @param fps - the desired frame rate, in frames per second
*/
public static void sync(int fps) {
- if (fps <= 0) return;
- if (!syncInitiated) initiateSyncTimer();
-
- long sleepTime = 1000000000 / fps; // nanoseconds to sleep this frame
- // adaptiveYieldTime + remainder micro & nano seconds if smaller than sleepTime
- long yieldTime = adaptiveTimeDisabled ? 0 : Math.min(sleepTime, adaptiveYieldTime + sleepTime % (1000*1000));
- long overSleep = 0; // time the sync goes over by
-
- try {
- while (true) {
- long t = getTime() - lastTime;
-
- if (t < sleepTime - yieldTime) {
- Thread.sleep(1);
- }
- else if (t < sleepTime) {
- // burn the last few CPU cycles to ensure accuracy
- Thread.yield();
- }
- else {
- overSleep = t - sleepTime;
- break; // exit while loop
- }
- }
- } catch (InterruptedException e) {}
-
- lastTime = getTime() - Math.min(overSleep, sleepTime);
-
- if (!adaptiveTimeDisabled) {
- // auto tune the amount of time to yield
- if (overSleep > adaptiveYieldTime) {
- // increase by 200 microseconds (1/5 a ms)
- adaptiveYieldTime = Math.min(adaptiveYieldTime + 200*1000, sleepTime);
- }
- else if (overSleep < adaptiveYieldTime - 2*1000*1000) {
- // fast decrease by 50 microseconds for large under sleeps
- adaptiveYieldTime = Math.max(adaptiveYieldTime - 50*1000, 0);
- }
- else if (overSleep < adaptiveYieldTime - 200*1000) {
- // slower but finer decrease by 2 microseconds
- adaptiveYieldTime = Math.max(adaptiveYieldTime - 2*1000, 0);
- }
- }
+ Sync.sync(fps);
}
-
- /**
- * Get System Nano Time
- * @return will return the current time in nano's
- */
- private static long getTime() {
- return (Sys.getTime() * 1000000000) / Sys.getTimerResolution();
- }
-
- /**
- * Initialise the sync(fps) method.
- */
- private static void initiateSyncTimer() {
- syncInitiated = true;
- lastTime = getTime();
-
- String osName = System.getProperty("os.name");
-
- if (osName.startsWith("Mac") || osName.startsWith("Darwin")) {
- // disabled on mac as it uses too much cpu, besides
- // Thread.sleep is pretty accurate on mac by default
- adaptiveTimeDisabled = true;
- return;
- }
-
- if (osName.startsWith("Win")) {
- // On windows the sleep functions can be highly inaccurate by
- // over 10ms making in unusable. However it can be forced to
- // be a bit more accurate by running a separate sleeping daemon
- // thread.
- Thread timerAccuracyThread = new Thread(new Runnable() {
- public void run() {
- try {
- Thread.sleep(Long.MAX_VALUE);
- } catch (Exception e) {}
- }
- });
-
- timerAccuracyThread.setDaemon(true);
- timerAccuracyThread.start();
- }
- }
/** @return the title of the window */
public static String getTitle() {
Added: trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Sync.java 2012-03-24 00:04:52 UTC (rev 3755)
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2002-2012 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.lwjgl.opengl;
+
+import org.lwjgl.Sys;
+
+/**
+* A highly accurate sync method that continually adapts to the system
+* it runs on to provide reliable results.
+*
+* @author Riven
+* @author kappaOne
+*/
+class Sync {
+
+ /** number of nano seconds in a second */
+ private static final long NANOS_IN_SECOND = 1000L * 1000L * 1000L;
+
+ /** The time to sleep/yield until the next frame */
+ private static long nextFrame = 0;
+
+ /** whether the initialisation code has run */
+ private static boolean initialised = false;
+
+ /** stored results of how long sleep/yields took to calculate averages */
+ private static RunningAvg sleepDurations = new RunningAvg(10);
+ private static RunningAvg yieldDurations = new RunningAvg(10);
+
+
+ /**
+ * An accurate sync method that will attempt to run an application loop
+ * at a constant frame rate.
+ *
+ * It should be called once every frame.
+ *
+ * @param fps - the desired frame rate, in frames per second
+ */
+ public static void sync(int fps) {
+ if (fps <= 0) return;
+ if (!initialised) initialise();
+
+ try {
+ // sleep until the average sleep time is greater than the time remaining till nextFrame
+ for (long t0 = getTime(), t1; (nextFrame - t0) > sleepDurations.avg(); t0 = t1) {
+ Thread.sleep(1);
+ sleepDurations.add((t1 = getTime()) - t0); // update average sleep time
+ }
+
+ // slowly dampen sleep average if too high to avoid over yielding
+ sleepDurations.dampenForLowResTicker();
+
+ // yield until the average yield time is greater than the time remaining till nextFrame
+ for (long t0 = getTime(), t1; (nextFrame - t0) > yieldDurations.avg(); t0 = t1) {
+ Thread.yield();
+ yieldDurations.add((t1 = getTime()) - t0); // update average yield time
+ }
+ } catch (InterruptedException e) {
+
+ }
+
+ // schedule next frame, drop frame(s) if already too late for next frame
+ nextFrame = Math.max(nextFrame + NANOS_IN_SECOND / fps, getTime());
+ }
+
+ /**
+ * This method will initialise the sync method by setting initial
+ * values for sleepDurations/yieldDurations and nextFrame variables.
+ *
+ * If running windows on windows it will start the sleep timer fix.
+ */
+ private static void initialise() {
+ initialised = true;
+
+ sleepDurations.init(1000 * 1000);
+ yieldDurations.init((int) (-(getTime() - getTime()) * 1.333));
+
+ nextFrame = getTime();
+
+ String osName = System.getProperty("os.name");
+
+ if (osName.startsWith("Win")) {
+ // On windows the sleep functions can be highly inaccurate by
+ // over 10ms making in unusable. However it can be forced to
+ // be a bit more accurate by running a separate sleeping daemon
+ // thread.
+ Thread timerAccuracyThread = new Thread(new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(Long.MAX_VALUE);
+ } catch (Exception e) {}
+ }
+ });
+
+ timerAccuracyThread.setDaemon(true);
+ timerAccuracyThread.start();
+ }
+ }
+
+ /**
+ * Get the system time in nano seconds
+ *
+ * @return will return the current time in nano's
+ */
+ private static long getTime() {
+ return (Sys.getTime() * NANOS_IN_SECOND) / Sys.getTimerResolution();
+ }
+
+ private static class RunningAvg {
+ private final long[] slots;
+ private int offset;
+
+ private static final long DAMPEN_THRESHOLD = 10 * 1000L * 1000L; // 10ms
+ private static final float DAMPEN_FACTOR = 0.9f; // don't change: 0.9f is exactly right!
+
+ public RunningAvg(int slotCount) {
+ this.slots = new long[slotCount];
+ this.offset = 0;
+ }
+
+ public void init(long value) {
+ while (this.offset < this.slots.length) {
+ this.slots[this.offset++] = value;
+ }
+ }
+
+ public void add(long value) {
+ this.slots[this.offset++ % this.slots.length] = value;
+ this.offset %= this.slots.length;
+ }
+
+ public long avg() {
+ long sum = 0;
+ for (int i = 0; i < this.slots.length; i++) {
+ sum += this.slots[i];
+ }
+ return sum / this.slots.length;
+ }
+
+ public void dampenForLowResTicker() {
+ if (this.avg() > DAMPEN_THRESHOLD) {
+ for (int i = 0; i < this.slots.length; i++) {
+ this.slots[i] *= DAMPEN_FACTOR;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-21 19:35:00
|
Revision: 3754
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3754&view=rev
Author: kappa1
Date: 2012-03-21 19:34:51 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
Display.sync() fix excessive CPU using on windows
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-03-19 22:12:38 UTC (rev 3753)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-03-21 19:34:51 UTC (rev 3754)
@@ -451,8 +451,12 @@
// increase by 200 microseconds (1/5 a ms)
adaptiveYieldTime = Math.min(adaptiveYieldTime + 200*1000, sleepTime);
}
+ else if (overSleep < adaptiveYieldTime - 2*1000*1000) {
+ // fast decrease by 50 microseconds for large under sleeps
+ adaptiveYieldTime = Math.max(adaptiveYieldTime - 50*1000, 0);
+ }
else if (overSleep < adaptiveYieldTime - 200*1000) {
- // decrease by 5 microseconds
+ // slower but finer decrease by 2 microseconds
adaptiveYieldTime = Math.max(adaptiveYieldTime - 2*1000, 0);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-03-19 22:12:45
|
Revision: 3753
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3753&view=rev
Author: matzon
Date: 2012-03-19 22:12:38 +0000 (Mon, 19 Mar 2012)
Log Message:
-----------
applying white border fix from dr_evil
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 2012-03-18 16:25:23 UTC (rev 3752)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2012-03-19 22:12:38 UTC (rev 3753)
@@ -1058,7 +1058,7 @@
long styleex = getWindowLongPtr(hwnd, GWL_EXSTYLE);
// update frame style
- if(resizable) {
+ if(resizable && !Display.isFullscreen()) {
setWindowLongPtr(hwnd, GWL_STYLE, style |= (WS_THICKFRAME | WS_MAXIMIZEBOX));
} else {
setWindowLongPtr(hwnd, GWL_STYLE, style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-18 16:25:29
|
Revision: 3752
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3752&view=rev
Author: kappa1
Date: 2012-03-18 16:25:23 +0000 (Sun, 18 Mar 2012)
Log Message:
-----------
Fix the new accurate Display.sync() method to use less CPU on Mac.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-03-04 13:41:49 UTC (rev 3751)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-03-18 16:25:23 UTC (rev 3752)
@@ -85,6 +85,9 @@
/** Whether the sync() method has been initiated */
private static boolean syncInitiated;
+ /** whether to disable adaptive yield time in sync() method */
+ private static boolean adaptiveTimeDisabled;
+
/** adaptive time to yield instead of sleeping in sync()*/
private static long adaptiveYieldTime;
@@ -419,7 +422,7 @@
long sleepTime = 1000000000 / fps; // nanoseconds to sleep this frame
// adaptiveYieldTime + remainder micro & nano seconds if smaller than sleepTime
- long yieldTime = Math.min(sleepTime, adaptiveYieldTime + sleepTime % (1000*1000));
+ long yieldTime = adaptiveTimeDisabled ? 0 : Math.min(sleepTime, adaptiveYieldTime + sleepTime % (1000*1000));
long overSleep = 0; // time the sync goes over by
try {
@@ -442,15 +445,17 @@
lastTime = getTime() - Math.min(overSleep, sleepTime);
- // auto tune the amount of time to yield
- if (overSleep > adaptiveYieldTime) {
- // increase by 200 microseconds (1/5 a ms)
- adaptiveYieldTime = Math.min(adaptiveYieldTime + 200*1000, sleepTime);
+ if (!adaptiveTimeDisabled) {
+ // auto tune the amount of time to yield
+ if (overSleep > adaptiveYieldTime) {
+ // increase by 200 microseconds (1/5 a ms)
+ adaptiveYieldTime = Math.min(adaptiveYieldTime + 200*1000, sleepTime);
+ }
+ else if (overSleep < adaptiveYieldTime - 200*1000) {
+ // decrease by 5 microseconds
+ adaptiveYieldTime = Math.max(adaptiveYieldTime - 2*1000, 0);
+ }
}
- else if (overSleep < adaptiveYieldTime - 200*1000) {
- // decrease by 5 microseconds
- adaptiveYieldTime = Math.max(adaptiveYieldTime - 2*1000, 0);
- }
}
/**
@@ -462,28 +467,37 @@
}
/**
- * On windows the sleep functions can be highly inaccurate by
- * over 10ms making in unusable. However it can be forced to
- * be a bit more accurate by running a separate sleeping daemon
- * thread.
+ * Initialise the sync(fps) method.
*/
private static void initiateSyncTimer() {
syncInitiated = true;
+ lastTime = getTime();
- if (!System.getProperty("os.name").startsWith("Win")) {
+ String osName = System.getProperty("os.name");
+
+ if (osName.startsWith("Mac") || osName.startsWith("Darwin")) {
+ // disabled on mac as it uses too much cpu, besides
+ // Thread.sleep is pretty accurate on mac by default
+ adaptiveTimeDisabled = true;
return;
}
- Thread timerAccuracyThread = new Thread(new Runnable() {
- public void run() {
- try {
- Thread.sleep(Long.MAX_VALUE);
- } catch (Exception e) {}
- }
- });
-
- timerAccuracyThread.setDaemon(true);
- timerAccuracyThread.start();
+ if (osName.startsWith("Win")) {
+ // On windows the sleep functions can be highly inaccurate by
+ // over 10ms making in unusable. However it can be forced to
+ // be a bit more accurate by running a separate sleeping daemon
+ // thread.
+ Thread timerAccuracyThread = new Thread(new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(Long.MAX_VALUE);
+ } catch (Exception e) {}
+ }
+ });
+
+ timerAccuracyThread.setDaemon(true);
+ timerAccuracyThread.start();
+ }
}
/** @return the title of the window */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-04 13:41:55
|
Revision: 3751
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3751&view=rev
Author: kappa1
Date: 2012-03-04 13:41:49 +0000 (Sun, 04 Mar 2012)
Log Message:
-----------
Refactor so that the peer_info variable in ContextGL does not need to be static
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextGL.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextGL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextGL.java 2012-03-04 03:50:58 UTC (rev 3750)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextGL.java 2012-03-04 13:41:49 UTC (rev 3751)
@@ -64,7 +64,7 @@
/** Handle to the native GL rendering context */
private final ByteBuffer handle;
- private static PeerInfo peer_info;
+ private final PeerInfo peer_info;
private final ContextAttribs contextAttribs;
private final boolean forwardCompatible;
@@ -229,7 +229,7 @@
* A video frame period is the time required to display a full frame of video data.
*/
public static void setSwapInterval(int value) {
- implementation.setSwapInterval(peer_info, value);
+ implementation.setSwapInterval(value);
}
/**
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java 2012-03-04 03:50:58 UTC (rev 3750)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java 2012-03-04 13:41:49 UTC (rev 3751)
@@ -81,7 +81,7 @@
*/
boolean isCurrent(ByteBuffer handle) throws LWJGLException;
- void setSwapInterval(PeerInfo peer_info, int value);
+ void setSwapInterval(int value);
/**
* Destroys the Context.
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java 2012-03-04 03:50:58 UTC (rev 3750)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java 2012-03-04 13:41:49 UTC (rev 3751)
@@ -141,8 +141,10 @@
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
- public void setSwapInterval(PeerInfo peer_info, int value) {
+ public void setSwapInterval(int value) {
ContextGL current_context = ContextGL.getCurrentContext();
+ PeerInfo peer_info = current_context.getPeerInfo();
+
if ( current_context == null )
throw new IllegalStateException("No context is current");
synchronized ( current_context ) {
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java 2012-03-04 03:50:58 UTC (rev 3750)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java 2012-03-04 13:41:49 UTC (rev 3751)
@@ -118,7 +118,7 @@
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
- public void setSwapInterval(PeerInfo peer_info, int value) {
+ public void setSwapInterval(int value) {
ContextGL current_context = ContextGL.getCurrentContext();
synchronized ( current_context ) {
nSetSwapInterval(current_context.getHandle(), value);
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java 2012-03-04 03:50:58 UTC (rev 3750)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java 2012-03-04 13:41:49 UTC (rev 3751)
@@ -106,7 +106,7 @@
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
- public void setSwapInterval(PeerInfo peer_info, int value) {
+ public void setSwapInterval(int value) {
boolean success = nSetSwapInterval(value);
if ( !success )
LWJGLUtil.log("Failed to set swap interval");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-04 03:51:05
|
Revision: 3750
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3750&view=rev
Author: kappa1
Date: 2012-03-04 03:50:58 +0000 (Sun, 04 Mar 2012)
Log Message:
-----------
add missing extgl_InitGLXEXTSwapControl()
Modified Paths:
--------------
trunk/LWJGL/src/native/linux/opengl/extgl_glx.c
Modified: trunk/LWJGL/src/native/linux/opengl/extgl_glx.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengl/extgl_glx.c 2012-03-04 03:45:09 UTC (rev 3749)
+++ trunk/LWJGL/src/native/linux/opengl/extgl_glx.c 2012-03-04 03:50:58 UTC (rev 3750)
@@ -238,6 +238,7 @@
extgl_InitGLX12();
extgl_InitGLX13();
extgl_InitGLXSGISwapControl();
+ extgl_InitGLXEXTSwapControl();
extgl_InitGLXARBCreateContext();
extgl_InitGLXNVPresentVideo();
extgl_InitGLXNVVideoCapture();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-04 03:45:15
|
Revision: 3749
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3749&view=rev
Author: kappa1
Date: 2012-03-04 03:45:09 +0000 (Sun, 04 Mar 2012)
Log Message:
-----------
add missing lwjgl_glXSwapIntervalEXT
Modified Paths:
--------------
trunk/LWJGL/src/native/linux/opengl/extgl_glx.h
Modified: trunk/LWJGL/src/native/linux/opengl/extgl_glx.h
===================================================================
--- trunk/LWJGL/src/native/linux/opengl/extgl_glx.h 2012-03-04 03:40:32 UTC (rev 3748)
+++ trunk/LWJGL/src/native/linux/opengl/extgl_glx.h 2012-03-04 03:45:09 UTC (rev 3749)
@@ -421,6 +421,7 @@
extern glXQueryExtensionsStringPROC lwjgl_glXQueryExtensionsString;
extern glXSwapIntervalSGIPROC lwjgl_glXSwapIntervalSGI;
+extern glXSwapIntervalEXTPROC lwjgl_glXSwapIntervalEXT;
extern glXCreateContextAttribsARBPROC lwjgl_glXCreateContextAttribsARB;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-04 03:40:39
|
Revision: 3748
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3748&view=rev
Author: kappa1
Date: 2012-03-04 03:40:32 +0000 (Sun, 04 Mar 2012)
Log Message:
-----------
Implement GLX_EXT_swap_control for Linux
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextGL.java
trunk/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
trunk/LWJGL/src/native/linux/opengl/extgl_glx.c
trunk/LWJGL/src/native/linux/opengl/extgl_glx.h
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextGL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextGL.java 2012-03-01 22:34:34 UTC (rev 3747)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextGL.java 2012-03-04 03:40:32 UTC (rev 3748)
@@ -64,7 +64,7 @@
/** Handle to the native GL rendering context */
private final ByteBuffer handle;
- private final PeerInfo peer_info;
+ private static PeerInfo peer_info;
private final ContextAttribs contextAttribs;
private final boolean forwardCompatible;
@@ -229,7 +229,7 @@
* A video frame period is the time required to display a full frame of video data.
*/
public static void setSwapInterval(int value) {
- implementation.setSwapInterval(value);
+ implementation.setSwapInterval(peer_info, value);
}
/**
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java 2012-03-01 22:34:34 UTC (rev 3747)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextImplementation.java 2012-03-04 03:40:32 UTC (rev 3748)
@@ -81,7 +81,7 @@
*/
boolean isCurrent(ByteBuffer handle) throws LWJGLException;
- void setSwapInterval(int value);
+ void setSwapInterval(PeerInfo peer_info, int value);
/**
* Destroys the Context.
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java 2012-03-01 22:34:34 UTC (rev 3747)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxContextImplementation.java 2012-03-04 03:40:32 UTC (rev 3748)
@@ -141,18 +141,29 @@
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
- public void setSwapInterval(int value) {
+ public void setSwapInterval(PeerInfo peer_info, int value) {
ContextGL current_context = ContextGL.getCurrentContext();
if ( current_context == null )
throw new IllegalStateException("No context is current");
synchronized ( current_context ) {
LinuxDisplay.lockAWT();
- nSetSwapInterval(current_context.getHandle(), value);
- LinuxDisplay.unlockAWT();
+ try {
+ ByteBuffer peer_handle = peer_info.lockAndGetHandle();
+ try {
+ nSetSwapInterval(peer_handle, current_context.getHandle(), value);
+ } finally {
+ peer_info.unlock();
+ }
+ } catch (LWJGLException e) {
+ // API CHANGE - this methods should throw LWJGLException
+ e.printStackTrace();
+ } finally {
+ LinuxDisplay.unlockAWT();
+ }
}
}
- private static native void nSetSwapInterval(ByteBuffer context_handle, int value);
+ private static native void nSetSwapInterval(ByteBuffer peer_handle, ByteBuffer context_handle, int value);
public void destroy(PeerInfo peer_info, ByteBuffer handle) throws LWJGLException {
LinuxDisplay.lockAWT();
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java 2012-03-01 22:34:34 UTC (rev 3747)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXContextImplementation.java 2012-03-04 03:40:32 UTC (rev 3748)
@@ -118,7 +118,7 @@
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
- public void setSwapInterval(int value) {
+ public void setSwapInterval(PeerInfo peer_info, int value) {
ContextGL current_context = ContextGL.getCurrentContext();
synchronized ( current_context ) {
nSetSwapInterval(current_context.getHandle(), value);
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java 2012-03-01 22:34:34 UTC (rev 3747)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsContextImplementation.java 2012-03-04 03:40:32 UTC (rev 3748)
@@ -106,7 +106,7 @@
private static native boolean nIsCurrent(ByteBuffer context_handle) throws LWJGLException;
- public void setSwapInterval(int value) {
+ public void setSwapInterval(PeerInfo peer_info, int value) {
boolean success = nSetSwapInterval(value);
if ( !success )
LWJGLUtil.log("Failed to set swap interval");
Modified: trunk/LWJGL/src/native/linux/opengl/extgl_glx.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengl/extgl_glx.c 2012-03-01 22:34:34 UTC (rev 3747)
+++ trunk/LWJGL/src/native/linux/opengl/extgl_glx.c 2012-03-04 03:40:32 UTC (rev 3748)
@@ -74,6 +74,9 @@
/* GLX_SGI_swap_control */
glXSwapIntervalSGIPROC lwjgl_glXSwapIntervalSGI = NULL;
+/* GLX_EXT_swap_control */
+glXSwapIntervalEXTPROC lwjgl_glXSwapIntervalEXT = NULL;
+
/* GLX_ARB_create_context */
glXCreateContextAttribsARBPROC lwjgl_glXCreateContextAttribsARB = NULL;
@@ -155,6 +158,12 @@
symbols_flags.GLX_SGI_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
}
+static void extgl_InitGLXEXTSwapControl() {
+ ExtFunction functions[] = {
+ {"glXSwapIntervalEXT", (void*)&lwjgl_glXSwapIntervalEXT}};
+ symbols_flags.GLX_EXT_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
+}
+
static void extgl_InitGLXARBCreateContext() {
ExtFunction functions[] = {
{"glXCreateContextAttribsARB", (void*)&lwjgl_glXCreateContextAttribsARB}};
@@ -189,6 +198,7 @@
/* extension_flags.GLX_EXT_visual_info = GLXQueryExtension(serverExts, clientExts, "GLX_EXT_visual_info");
extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(serverExts, clientExts, "GLX_EXT_visual_rating");*/
extension_flags->GLX_SGI_swap_control = symbols_flags.GLX_SGI_swap_control && GLXQueryExtension(serverExts, clientExts, "GLX_SGI_swap_control");
+ extension_flags->GLX_EXT_swap_control = symbols_flags.GLX_EXT_swap_control && GLXQueryExtension(serverExts, clientExts, "GLX_EXT_swap_control");
extension_flags->GLX_ARB_multisample = GLXQueryExtension(serverExts, clientExts, "GLX_ARB_multisample");
extension_flags->GLX_ARB_fbconfig_float = GLXQueryExtension(serverExts, clientExts, "GLX_ARB_fbconfig_float");
extension_flags->GLX_EXT_fbconfig_packed_float = GLXQueryExtension(serverExts, clientExts, "GLX_EXT_fbconfig_packed_float");
Modified: trunk/LWJGL/src/native/linux/opengl/extgl_glx.h
===================================================================
--- trunk/LWJGL/src/native/linux/opengl/extgl_glx.h 2012-03-01 22:34:34 UTC (rev 3747)
+++ trunk/LWJGL/src/native/linux/opengl/extgl_glx.h 2012-03-04 03:40:32 UTC (rev 3748)
@@ -343,6 +343,9 @@
/* GLX_SGI_swap_control */
typedef void (APIENTRY * glXSwapIntervalSGIPROC)(int interval);
+/* GLX_EXT_swap_control */
+typedef void (APIENTRY * glXSwapIntervalEXTPROC)(Display *dpy, GLXDrawable drawable, int interval);
+
/* GLX_ARB_create_context */
typedef GLXContext (APIENTRY * glXCreateContextAttribsARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
@@ -365,6 +368,7 @@
/* bool GLX_EXT_visual_info;
bool GLX_EXT_visual_rating;*/
bool GLX_SGI_swap_control;
+ bool GLX_EXT_swap_control;
bool GLX_ARB_multisample;
bool GLX_ARB_fbconfig_float;
bool GLX_EXT_fbconfig_packed_float;
Modified: trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c 2012-03-01 22:34:34 UTC (rev 3747)
+++ trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_LinuxContextImplementation.c 2012-03-04 03:40:32 UTC (rev 3748)
@@ -117,10 +117,15 @@
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSetSwapInterval
- (JNIEnv *env, jclass clazz, jobject context_handle, jint value)
+ (JNIEnv *env, jclass clazz, jobject peer_info_handle, jobject context_handle, jint value)
{
+ X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle);
X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle);
- if (context_info->extension_flags.GLX_SGI_swap_control) {
+
+ if (context_info->extension_flags.GLX_EXT_swap_control) {
+ lwjgl_glXSwapIntervalEXT(peer_info->display, peer_info->drawable, value);
+ }
+ else if (context_info->extension_flags.GLX_SGI_swap_control) {
lwjgl_glXSwapIntervalSGI(value);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-03-01 22:34:40
|
Revision: 3747
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3747&view=rev
Author: kappa1
Date: 2012-03-01 22:34:34 +0000 (Thu, 01 Mar 2012)
Log Message:
-----------
Tweak Display.sync() method a little to reduce the Thread.yield() time even further, now with a minimum of 0 yield time.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-02-29 23:18:35 UTC (rev 3746)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-03-01 22:34:34 UTC (rev 3747)
@@ -86,7 +86,7 @@
private static boolean syncInitiated;
/** adaptive time to yield instead of sleeping in sync()*/
- private static long adaptiveYieldTime = 1000*1000;
+ private static long adaptiveYieldTime;
/** X coordinate of the window */
private static int x = -1;
@@ -444,12 +444,12 @@
// auto tune the amount of time to yield
if (overSleep > adaptiveYieldTime) {
- // increase by 500 microseconds (half a ms)
- adaptiveYieldTime = Math.min(adaptiveYieldTime + 500*1000, sleepTime);
+ // increase by 200 microseconds (1/5 a ms)
+ adaptiveYieldTime = Math.min(adaptiveYieldTime + 200*1000, sleepTime);
}
- else if (overSleep < adaptiveYieldTime - 1000*1000) {
+ else if (overSleep < adaptiveYieldTime - 200*1000) {
// decrease by 5 microseconds
- adaptiveYieldTime = Math.max(adaptiveYieldTime - 5*1000, 1000*1000);
+ adaptiveYieldTime = Math.max(adaptiveYieldTime - 2*1000, 0);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-02-29 23:18:43
|
Revision: 3746
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3746&view=rev
Author: kappa1
Date: 2012-02-29 23:18:35 +0000 (Wed, 29 Feb 2012)
Log Message:
-----------
Implement a much more accurate Display.sync() method that auto adapts to the systems timer resolution and load.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-02-28 18:18:06 UTC (rev 3745)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-02-29 23:18:35 UTC (rev 3746)
@@ -79,9 +79,15 @@
/** The current display mode, if created */
private static DisplayMode current_mode;
- /** Timer for sync() */
- private static long timeThen;
+ /** time at last sync() */
+ private static long lastTime;
+ /** Whether the sync() method has been initiated */
+ private static boolean syncInitiated;
+
+ /** adaptive time to yield instead of sleeping in sync()*/
+ private static long adaptiveYieldTime = 1000*1000;
+
/** X coordinate of the window */
private static int x = -1;
@@ -401,41 +407,84 @@
}
}
- private static long timeLate;
-
/**
- * Best sync method that works reliably.
- *
+ * An accurate sync method that adapts automatically
+ * to the system it runs on to provide reliable results.
+ *
* @param fps The desired frame rate, in frames per second
*/
public static void sync(int fps) {
- long timeNow;
- long gapTo;
- long savedTimeLate;
- synchronized ( GlobalLock.lock ) {
- gapTo = Sys.getTimerResolution() / fps + timeThen;
- timeNow = Sys.getTime();
- savedTimeLate = timeLate;
- }
-
+ if (fps <= 0) return;
+ if (!syncInitiated) initiateSyncTimer();
+
+ long sleepTime = 1000000000 / fps; // nanoseconds to sleep this frame
+ // adaptiveYieldTime + remainder micro & nano seconds if smaller than sleepTime
+ long yieldTime = Math.min(sleepTime, adaptiveYieldTime + sleepTime % (1000*1000));
+ long overSleep = 0; // time the sync goes over by
+
try {
- while ( gapTo > timeNow + savedTimeLate ) {
- Thread.sleep(1);
- timeNow = Sys.getTime();
+ while (true) {
+ long t = getTime() - lastTime;
+
+ if (t < sleepTime - yieldTime) {
+ Thread.sleep(1);
+ }
+ else if (t < sleepTime) {
+ // burn the last few CPU cycles to ensure accuracy
+ Thread.yield();
+ }
+ else {
+ overSleep = t - sleepTime;
+ break; // exit while loop
+ }
}
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
+ } catch (InterruptedException e) {}
+
+ lastTime = getTime() - Math.min(overSleep, sleepTime);
+
+ // auto tune the amount of time to yield
+ if (overSleep > adaptiveYieldTime) {
+ // increase by 500 microseconds (half a ms)
+ adaptiveYieldTime = Math.min(adaptiveYieldTime + 500*1000, sleepTime);
}
-
- synchronized ( GlobalLock.lock ) {
- if ( gapTo < timeNow )
- timeLate = timeNow - gapTo;
- else
- timeLate = 0;
-
- timeThen = timeNow;
+ else if (overSleep < adaptiveYieldTime - 1000*1000) {
+ // decrease by 5 microseconds
+ adaptiveYieldTime = Math.max(adaptiveYieldTime - 5*1000, 1000*1000);
}
}
+
+ /**
+ * Get System Nano Time
+ * @return will return the current time in nano's
+ */
+ private static long getTime() {
+ return (Sys.getTime() * 1000000000) / Sys.getTimerResolution();
+ }
+
+ /**
+ * On windows the sleep functions can be highly inaccurate by
+ * over 10ms making in unusable. However it can be forced to
+ * be a bit more accurate by running a separate sleeping daemon
+ * thread.
+ */
+ private static void initiateSyncTimer() {
+ syncInitiated = true;
+
+ if (!System.getProperty("os.name").startsWith("Win")) {
+ return;
+ }
+
+ Thread timerAccuracyThread = new Thread(new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(Long.MAX_VALUE);
+ } catch (Exception e) {}
+ }
+ });
+
+ timerAccuracyThread.setDaemon(true);
+ timerAccuracyThread.start();
+ }
/** @return the title of the window */
public static String getTitle() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2012-02-28 18:18:17
|
Revision: 3745
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3745&view=rev
Author: spasi
Date: 2012-02-28 18:18:06 +0000 (Tue, 28 Feb 2012)
Log Message:
-----------
Fixed clEnqueueNativeKernel crash.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
Modified: trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2012-02-18 18:38:57 UTC (rev 3744)
+++ trunk/LWJGL/src/java/org/lwjgl/MemoryUtil.java 2012-02-28 18:18:06 UTC (rev 3745)
@@ -362,16 +362,18 @@
return getDeclaredFieldRecursive(ByteBuffer.class, "address");
}
- private static Field getDeclaredFieldRecursive(Class<?> type, final String fieldName) throws NoSuchFieldException {
- while ( type != null ) {
+ private static Field getDeclaredFieldRecursive(final Class<?> root, final String fieldName) throws NoSuchFieldException {
+ Class<?> type = root;
+
+ do {
try {
return type.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
type = type.getSuperclass();
}
- }
+ } while ( type != null );
- throw new NoSuchFieldException(fieldName + " does not exist in " + type.getSimpleName() + " or any of its superclasses.");
+ throw new NoSuchFieldException(fieldName + " does not exist in " + root.getSimpleName() + " or any of its superclasses.");
}
}
Modified: trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2012-02-18 18:38:57 UTC (rev 3744)
+++ trunk/LWJGL/src/native/common/org_lwjgl_opencl_CallbackUtil.c 2012-02-28 18:18:06 UTC (rev 3745)
@@ -146,10 +146,10 @@
static void CL_CALLBACK nativeKernelCallback(void *args) {
JNIEnv *env = attachCurrentThread();
jobject user_func = (jobject)(intptr_t)*(jlong *)args;
- jint num_mem_objects = *(jint *)((char *)args + 8);
+ jsize num_mem_objects = *(jsize *)((char *)args + 8);
jobjectArray memobjs = NULL;
jobject buffer;
- jint i;
+ jsize i;
if ( env != NULL && !(*env)->ExceptionOccurred(env) && nativeKernelCallbackJ != NULL ) {
if ( num_mem_objects > 0 ) {
Modified: trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2012-02-18 18:38:57 UTC (rev 3744)
+++ trunk/LWJGL/src/templates/org/lwjgl/opencl/CL10.java 2012-02-28 18:18:06 UTC (rev 3745)
@@ -1073,7 +1073,7 @@
nativeAfterVars = "\tvoid **args_mem_loc = num_mem_objects == 0 ? NULL : (void **)malloc(num_mem_objects * sizeof(void *));",
nativeBeforeCall = "\t_ptr_i = 0;\n" +
"\twhile ( _ptr_i < num_mem_objects ) {\n" +
- "\t\targs_mem_loc[_ptr_i] = (cl_void *)((char *)args_address + (4 + _ptr_i * (4 + sizeof(void *))));\n" +
+ "\t\targs_mem_loc[_ptr_i] = (cl_void *)((char *)args_address + (12 + 4 + _ptr_i * (4 + sizeof(void *))));\n" +
"\t\t_ptr_i++;\n" +
"\t}",
nativeAfterCall = "\tfree(args_mem_loc);"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2012-02-18 18:39:04
|
Revision: 3744
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3744&view=rev
Author: matzon
Date: 2012-02-18 18:38:57 +0000 (Sat, 18 Feb 2012)
Log Message:
-----------
added win32 display get x/y
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 2012-02-18 16:30:38 UTC (rev 3743)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2012-02-18 18:38:57 UTC (rev 3744)
@@ -52,6 +52,7 @@
final class WindowsDisplay implements DisplayImplementation {
private static final int GAMMA_LENGTH = 256;
+ private static final int WM_MOVE = 0x0003;
private static final int WM_CANCELMODE = 0x001F;
private static final int WM_MOUSEMOVE = 0x0200;
private static final int WM_LBUTTONDOWN = 0x0201;
@@ -182,6 +183,8 @@
private boolean resized;
private boolean resizable;
private boolean maximized;
+ private int x;
+ private int y;
private int width;
private int height;
@@ -1009,17 +1012,21 @@
captureMouse = -1;
}
return 0;
+ case WM_MOVE:
+ x = (int)(short)(lParam & 0xFFFF);
+ y = (int)(short)(lParam >> 16);
+ return defWindowProc(hwnd, msg, wParam, lParam);
default:
return defWindowProc(hwnd, msg, wParam, lParam);
}
}
public int getX() {
- return 0; // placeholder until implemented
+ return x;
}
public int getY() {
- return 0; // placeholder until implemented
+ return y;
}
public int getWidth() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-02-18 16:30:45
|
Revision: 3743
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3743&view=rev
Author: kappa1
Date: 2012-02-18 16:30:38 +0000 (Sat, 18 Feb 2012)
Log Message:
-----------
Added the new public API's Display.getX() and Display.getY(). Currently implemented for Linux and Mac. Windows implementation pending.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-02-18 01:49:46 UTC (rev 3742)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-02-18 16:30:38 UTC (rev 3743)
@@ -1282,10 +1282,50 @@
}
/**
+ * @return this method will return the x position (top-left) of the Display window.
+ *
+ * If running in fullscreen mode it will return 0.
+ * If Display.setParent(Canvas parent) is being used, the x position of
+ * the parent will be returned.
+ */
+ public static int getX() {
+
+ if (Display.isFullscreen()) {
+ return 0;
+ }
+
+ if (parent != null) {
+ return parent.getX();
+ }
+
+ return display_impl.getX();
+ }
+
+ /**
+ * @return this method will return the y position (top-left) of the Display window.
+ *
+ * If running in fullscreen mode it will return 0.
+ * If Display.setParent(Canvas parent) is being used, the y position of
+ * the parent will be returned.
+ */
+ public static int getY() {
+
+ if (Display.isFullscreen()) {
+ return 0;
+ }
+
+ if (parent != null) {
+ return parent.getY();
+ }
+
+ return display_impl.getY();
+ }
+
+ /**
* @return this method will return the width of the Display window.
*
* If running in fullscreen mode it will return the width of the current set DisplayMode.
- * If running Display.setParent(Canvas parent) is being used, the width of the parent
+ * If Display.setParent(Canvas parent) is being used, the width of the parent
* will be returned.
*
* This value will be updated after a call to Display.update().
@@ -1307,7 +1347,7 @@
* @return this method will return the height of the Display window.
*
* If running in fullscreen mode it will return the height of the current set DisplayMode.
- * If running Display.setParent(Canvas parent) is being used, the height of the parent
+ * If Display.setParent(Canvas parent) is being used, the height of the parent
* will be returned.
*
* This value will be updated after a call to Display.update().
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java 2012-02-18 01:49:46 UTC (rev 3742)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/DisplayImplementation.java 2012-02-18 16:30:38 UTC (rev 3743)
@@ -174,12 +174,22 @@
boolean wasResized();
/**
- * @return this method will return a the width of the Display window.
+ * @return this method will return the width of the Display window.
*/
int getWidth();
/**
- * @return this method will return a the height of the Display window.
+ * @return this method will return the height of the Display window.
*/
int getHeight();
+
+ /**
+ * @return this method will return the top-left x position of the Display window.
+ */
+ int getX();
+
+ /**
+ * @return this method will return the top-left y position of the Display window.
+ */
+ int getY();
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2012-02-18 01:49:46 UTC (rev 3742)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2012-02-18 16:30:38 UTC (rev 3743)
@@ -473,6 +473,8 @@
parent_window = parent != null ? getHandle(parent) : getRootWindow(getDisplay(), getDefaultScreen());
resizable = Display.isResizable();
resized = false;
+ window_x = x;
+ window_y = y;
window_width = mode.getWidth();
window_height = mode.getHeight();
current_window = nCreateWindow(getDisplay(), getDefaultScreen(), handle, mode, current_window_mode, x, y, undecorated, parent_window, resizable);
@@ -1387,6 +1389,14 @@
private static native void nSetWindowIcon(long display, long window, ByteBuffer icon_rgb, int icon_rgb_size, ByteBuffer icon_mask, int icon_mask_size, int width, int height);
+ public int getX() {
+ return window_x;
+ }
+
+ public int getY() {
+ return window_y;
+ }
+
public int getWidth() {
return window_width;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2012-02-18 01:49:46 UTC (rev 3742)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/MacOSXDisplay.java 2012-02-18 16:30:38 UTC (rev 3743)
@@ -495,7 +495,15 @@
// Don't use any icon, since Mac OS X windows don't have window icons
return 0;
}
+
+ public int getX() {
+ return frame.getX();
+ }
+ public int getY() {
+ return frame.getY();
+ }
+
public int getWidth() {
return frame.getWidth();
}
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2012-02-18 01:49:46 UTC (rev 3742)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2012-02-18 16:30:38 UTC (rev 3743)
@@ -1013,7 +1013,15 @@
return defWindowProc(hwnd, msg, wParam, lParam);
}
}
+
+ public int getX() {
+ return 0; // placeholder until implemented
+ }
+ public int getY() {
+ return 0; // placeholder until implemented
+ }
+
public int getWidth() {
return width;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ka...@us...> - 2012-02-18 01:49:52
|
Revision: 3742
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3742&view=rev
Author: kappa1
Date: 2012-02-18 01:49:46 +0000 (Sat, 18 Feb 2012)
Log Message:
-----------
Implement the ability for the native Display window on Linux to get its x and y position. In preparation for adding the new Display.getX() & getY() API's.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java
trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c
trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2012-02-06 20:35:25 UTC (rev 3741)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxDisplay.java 2012-02-18 01:49:46 UTC (rev 3742)
@@ -144,6 +144,8 @@
private boolean resizable;
private boolean resized;
+ private int window_x;
+ private int window_y;
private int window_width;
private int window_height;
@@ -516,6 +518,8 @@
private static native long nGetInputFocus(long display) throws LWJGLException;
private static native void nSetInputFocus(long display, long window, long time);
private static native void nSetWindowSize(long display, long window, int width, int height, boolean resizable);
+ private static native int nGetX(long display, long window);
+ private static native int nGetY(long display, long window);
private static native int nGetWidth(long display, long window);
private static native int nGetHeight(long display, long window);
@@ -840,10 +844,17 @@
break;
case LinuxEvent.Expose:
dirty = true;
+ break;
+ case LinuxEvent.ConfigureNotify:
+ int x = nGetX(getDisplay(), getWindow());
+ int y = nGetY(getDisplay(), getWindow());
int width = nGetWidth(getDisplay(), getWindow());
int height = nGetHeight(getDisplay(), getWindow());
+ window_x = x;
+ window_y = y;
+
if (window_width != width || window_height != height) {
resized = true;
window_width = width;
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java 2012-02-06 20:35:25 UTC (rev 3741)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/LinuxEvent.java 2012-02-18 01:49:46 UTC (rev 3742)
@@ -53,6 +53,7 @@
public static final int UnmapNotify = 18;
public static final int MapNotify = 19;
public static final int Expose = 12;
+ public static final int ConfigureNotify = 22;
public static final int ClientMessage = 33;
private final ByteBuffer event_buffer;
Modified: trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c 2012-02-06 20:35:25 UTC (rev 3741)
+++ trunk/LWJGL/src/native/linux/opengl/org_lwjgl_opengl_Display.c 2012-02-18 01:49:46 UTC (rev 3742)
@@ -283,6 +283,49 @@
return RootWindow(disp, screen);
}
+static Window getCurrentWindow(JNIEnv *env, jlong display_ptr, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+
+ Window parent = (Window)window_ptr;
+ Window win, root;
+
+ Window *children;
+ unsigned int nchildren;
+
+ do {
+ win = parent;
+
+ if (XQueryTree(disp, win, &root, &parent, &children, &nchildren) == 0) {
+ throwException(env, "XQueryTree failed");
+ return 0;
+ }
+
+ if (children != NULL) XFree(children);
+ } while (parent != root);
+
+ return win;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetX(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ Window win = getCurrentWindow(env, display_ptr, window_ptr);
+
+ XWindowAttributes win_attribs;
+ XGetWindowAttributes(disp, win, &win_attribs);
+
+ return win_attribs.x;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetY(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ Window win = getCurrentWindow(env, display_ptr, window_ptr);
+
+ XWindowAttributes win_attribs;
+ XGetWindowAttributes(disp, win, &win_attribs);
+
+ return win_attribs.y;
+}
+
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetWidth(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) {
Display *disp = (Display *)(intptr_t)display_ptr;
Window win = (Window)window_ptr;
@@ -381,7 +424,7 @@
setDecorations(disp, win, 0);
}
- if (RootWindow(disp, screen) == parent_handle) { // on set hints when Display.setParent isn't used
+ if (RootWindow(disp, screen) == parent_handle) { // only set hints when Display.setParent isn't used
updateWindowBounds(disp, win, x, y, width, height, JNI_TRUE, resizable);
updateWindowHints(env, disp, win);
}
Modified: trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c
===================================================================
--- trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c 2012-02-06 20:35:25 UTC (rev 3741)
+++ trunk/LWJGL/src/native/linux/opengles/org_lwjgl_opengl_Display.c 2012-02-18 01:49:46 UTC (rev 3742)
@@ -273,6 +273,49 @@
return RootWindow(disp, screen);
}
+static Window getCurrentWindow(JNIEnv *env, jlong display_ptr, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+
+ Window parent = (Window)window_ptr;
+ Window win, root;
+
+ Window *children;
+ unsigned int nchildren;
+
+ do {
+ win = parent;
+
+ if (XQueryTree(disp, win, &root, &parent, &children, &nchildren) == 0) {
+ throwException(env, "XQueryTree failed");
+ return 0;
+ }
+
+ if (children != NULL) XFree(children);
+ } while (parent != root);
+
+ return win;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetX(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ Window win = getCurrentWindow(env, display_ptr, window_ptr);
+
+ XWindowAttributes win_attribs;
+ XGetWindowAttributes(disp, win, &win_attribs);
+
+ return win_attribs.x;
+}
+
+JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetY(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) {
+ Display *disp = (Display *)(intptr_t)display_ptr;
+ Window win = getCurrentWindow(env, display_ptr, window_ptr);
+
+ XWindowAttributes win_attribs;
+ XGetWindowAttributes(disp, win, &win_attribs);
+
+ return win_attribs.y;
+}
+
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetWidth(JNIEnv *env, jclass unused, jlong display_ptr, jlong window_ptr) {
Display *disp = (Display *)(intptr_t)display_ptr;
Window win = (Window)window_ptr;
@@ -375,7 +418,7 @@
setDecorations(disp, win, 0);
}
- if (RootWindow(disp, screen) == parent_handle) { // on set hints when Display.setParent isn't used
+ if (RootWindow(disp, screen) == parent_handle) { // only set hints when Display.setParent isn't used
updateWindowBounds(disp, win, x, y, width, height, JNI_TRUE, resizable);
updateWindowHints(env, disp, win);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|