|
From: <eli...@us...> - 2006-09-19 13:41:23
|
Revision: 2574
http://svn.sourceforge.net/java-game-lib/?rev=2574&view=rev
Author: elias_naur
Date: 2006-09-19 06:41:18 -0700 (Tue, 19 Sep 2006)
Log Message:
-----------
Display.java: Moved Context creation to after createWindow to relax the requirement that the Display PeerInfo must be valid before createWindow(). This will help Windows get rid of a dummy window.
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 2006-09-19 13:18:05 UTC (rev 2573)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2006-09-19 13:41:18 UTC (rev 2574)
@@ -123,7 +123,7 @@
/**
* Fetch the Drawable from the Display.
*
- * @return the Drawable corresponding to the Display context, or null it display is
+ * @return the Drawable corresponding to the Display context, or null if display is
* not created.
*/
public static Drawable getDrawable() {
@@ -230,8 +230,10 @@
if (fullscreen)
switchDisplayMode();
createWindow();
+ makeCurrent();
} catch (LWJGLException e) {
destroyContext();
+ destroyPeerInfo();
display_impl.resetDisplayMode();
throw e;
}
@@ -262,12 +264,10 @@
window_y = 0;
}
display_impl.createWindow(current_mode, fullscreen, window_x, window_y);
- makeCurrent();
+ window_created = true;
setTitle(title);
initControls();
- setSwapInterval(swap_interval);
- window_created = true;
// set cached window icon if exists
if(cached_icons != null) {
@@ -468,8 +468,10 @@
display_impl.resetDisplayMode();
}
createWindow();
+ makeCurrent();
} catch (LWJGLException e) {
destroyContext();
+ destroyPeerInfo();
display_impl.resetDisplayMode();
throw e;
}
@@ -679,12 +681,23 @@
switchDisplayMode();
try {
peer_info = display_impl.createPeerInfo(pixel_format);
- context = new Context(peer_info, shared_drawable != null ? shared_drawable.getContext() : null);
try {
createWindow();
- initContext();
+ try {
+ context = new Context(peer_info, shared_drawable != null ? shared_drawable.getContext() : null);
+ try {
+ makeCurrent();
+ initContext();
+ } catch (LWJGLException e) {
+ destroyContext();
+ throw e;
+ }
+ } catch (LWJGLException e) {
+ destroyWindow();
+ throw e;
+ }
} catch (LWJGLException e) {
- destroyContext();
+ destroyPeerInfo();
throw e;
}
} catch (LWJGLException e) {
@@ -694,6 +707,7 @@
}
private static void initContext() {
+ setSwapInterval(swap_interval);
// Put the window into orthographic projection mode with 1:1 pixel ratio.
// We haven't used GLU here to do this to avoid an unnecessary dependency.
GL11.glMatrixMode(GL11.GL_PROJECTION);
@@ -759,15 +773,20 @@
destroyWindow();
destroyContext();
+ destroyPeerInfo();
x = y = -1;
cached_icons = null;
reset();
}
+ private static void destroyPeerInfo() {
+ peer_info.destroy();
+ peer_info = null;
+ }
+
private static void destroyContext() {
try {
context.forceDestroy();
- peer_info.destroy();
} catch (LWJGLException e) {
throw new RuntimeException(e);
} finally {
@@ -795,7 +814,7 @@
* @return true if the window's native peer has been created
*/
public static boolean isCreated() {
- return context != null;
+ return window_created;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-10-26 19:41:27
|
Revision: 2608
http://svn.sourceforge.net/java-game-lib/?rev=2608&view=rev
Author: elias_naur
Date: 2006-10-26 12:41:15 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Don't register the Display shutdown hook in the static initializer. Register it at create() and remove it at destroy(). This avoids unnecessary conflicts when only using AWT stuff
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 2006-10-26 15:03:47 UTC (rev 2607)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2006-10-26 19:41:15 UTC (rev 2608)
@@ -59,6 +59,11 @@
import org.lwjgl.input.Mouse;
public final class Display {
+ private static final Thread shutdown_hook = new Thread() {
+ public void run() {
+ reset();
+ }
+ };
/** The display implementor */
private static final DisplayImplementation display_impl;
@@ -105,16 +110,6 @@
try {
current_mode = initial_mode = display_impl.init();
LWJGLUtil.log("Initial mode: " + initial_mode);
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- Runtime.getRuntime().addShutdownHook(new Thread() {
- public void run() {
- reset();
- }
- });
- return null;
- }
- });
} catch (LWJGLException e) {
throw new RuntimeException(e);
}
@@ -589,7 +584,10 @@
}
processMessages();
+ pollDevices();
+ }
+ static void pollDevices() {
// Poll the input devices while we're here
if (Mouse.isCreated()) {
Mouse.poll();
@@ -677,6 +675,12 @@
throw new IllegalStateException("Only one LWJGL context may be instantiated at any one time.");
if (pixel_format == null)
throw new NullPointerException("pixel_format cannot be null");
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ Runtime.getRuntime().addShutdownHook(shutdown_hook);
+ return null;
+ }
+ });
if (fullscreen)
switchDisplayMode();
try {
@@ -777,6 +781,12 @@
x = y = -1;
cached_icons = null;
reset();
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ Runtime.getRuntime().removeShutdownHook(shutdown_hook);
+ return null;
+ }
+ });
}
private static void destroyPeerInfo() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2006-11-19 11:43:03
|
Revision: 2660
http://svn.sourceforge.net/java-game-lib/?rev=2660&view=rev
Author: elias_naur
Date: 2006-11-19 03:43:00 -0800 (Sun, 19 Nov 2006)
Log Message:
-----------
Display: Don't add the shutdown hook twice when a previous create() call has failed
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 2006-11-19 09:08:26 UTC (rev 2659)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2006-11-19 11:43:00 UTC (rev 2660)
@@ -657,6 +657,24 @@
create(pixel_format, null);
}
+ private static void removeShutdownHook() {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ Runtime.getRuntime().removeShutdownHook(shutdown_hook);
+ return null;
+ }
+ });
+ }
+
+ private static void registerShutdownHook() {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ Runtime.getRuntime().addShutdownHook(shutdown_hook);
+ return null;
+ }
+ });
+ }
+
/**
* Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed
* context are not supported on the platform, the display mode will be switched to the mode returned by
@@ -675,12 +693,8 @@
throw new IllegalStateException("Only one LWJGL context may be instantiated at any one time.");
if (pixel_format == null)
throw new NullPointerException("pixel_format cannot be null");
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- Runtime.getRuntime().addShutdownHook(shutdown_hook);
- return null;
- }
- });
+ removeShutdownHook();
+ registerShutdownHook();
if (fullscreen)
switchDisplayMode();
try {
@@ -781,12 +795,7 @@
x = y = -1;
cached_icons = null;
reset();
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- Runtime.getRuntime().removeShutdownHook(shutdown_hook);
- return null;
- }
- });
+ removeShutdownHook();
}
private static void destroyPeerInfo() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-01-04 14:12:41
|
Revision: 2717
http://svn.sourceforge.net/java-game-lib/?rev=2717&view=rev
Author: elias_naur
Date: 2007-01-04 06:12:36 -0800 (Thu, 04 Jan 2007)
Log Message:
-----------
Windows: Clear the window with OpenGL to replace UpdateWindow(HWND) and run message loop once in Display.create().
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 2007-01-04 14:00:45 UTC (rev 2716)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-01-04 14:12:36 UTC (rev 2717)
@@ -734,6 +734,9 @@
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glViewport(0, 0, current_mode.getWidth(), current_mode.getHeight());
+ // Clear window to avoid the desktop "showing through"
+ GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
+ update();
}
static DisplayImplementation getImplementation() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-01-13 19:24:07
|
Revision: 2723
http://svn.sourceforge.net/java-game-lib/?rev=2723&view=rev
Author: elias_naur
Date: 2007-01-13 11:24:05 -0800 (Sat, 13 Jan 2007)
Log Message:
-----------
Display: Fixed a NPE when create() fails on context creation
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 2007-01-10 13:55:42 UTC (rev 2722)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-01-13 19:24:05 UTC (rev 2723)
@@ -277,7 +277,7 @@
return;
}
try {
- if (context.isCurrent()) {
+ if (context != null && context.isCurrent()) {
context.releaseDrawable();
Context.releaseCurrentContext();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-01-22 10:14:15
|
Revision: 2732
http://svn.sourceforge.net/java-game-lib/?rev=2732&view=rev
Author: elias_naur
Date: 2007-01-22 02:14:13 -0800 (Mon, 22 Jan 2007)
Log Message:
-----------
Tweaked comment for Display.getAvailableDisplayModes to make it clear that invalid modes can be returned and that create() won't always detect such modes
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 2007-01-22 09:24:06 UTC (rev 2731)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-01-22 10:14:13 UTC (rev 2732)
@@ -153,8 +153,13 @@
/**
* Returns the entire list of possible fullscreen display modes as an array, in no
- * particular order. Any given mode is not guaranteed to be available and
- * the only certain way to check is to call create() and make sure it works.
+ * particular order. Although best attempts to filter out invalid modes are done, any
+ * given mode is not guaranteed to be available nor is it guaranteed to be within the
+ * current monitor specs (this is especially a problem with the frequency parameter).
+ * Furthermore, it is not guaranteed that create() will detect an illegal display mode.
+ *
+ * The only certain way to check
+ * is to call create() and make sure it works.
* Only non-palette-indexed modes are returned (ie. bpp will be 16, 24, or 32).
* Only DisplayModes from this call can be used when the Display is in fullscreen
* mode.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-04-28 20:10:36
|
Revision: 2808
http://svn.sourceforge.net/java-game-lib/?rev=2808&view=rev
Author: elias_naur
Date: 2007-04-28 13:10:21 -0700 (Sat, 28 Apr 2007)
Log Message:
-----------
Make sure the swap interval is reset in Display when switching Display modes and toggling fullscreen
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 2007-04-26 07:13:02 UTC (rev 2807)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-04-28 20:10:21 UTC (rev 2808)
@@ -223,7 +223,7 @@
if (fullscreen)
switchDisplayMode();
createWindow();
- makeCurrent();
+ makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
destroyContext();
destroyPeerInfo();
@@ -475,7 +475,7 @@
display_impl.resetDisplayMode();
}
createWindow();
- makeCurrent();
+ makeCurrentAndSetSwapInterval();
} catch (LWJGLException e) {
destroyContext();
destroyPeerInfo();
@@ -744,7 +744,7 @@
try {
context = new Context(peer_info, shared_drawable != null ? shared_drawable.getContext() : null);
try {
- makeCurrent();
+ makeCurrentAndSetSwapInterval();
initContext();
} catch (LWJGLException e) {
destroyContext();
@@ -765,8 +765,12 @@
}
}
+ private static void makeCurrentAndSetSwapInterval() throws LWJGLException {
+ makeCurrent();
+ setSwapInterval(swap_interval);
+ }
+
private static void initContext() {
- setSwapInterval(swap_interval);
// Put the window into orthographic projection mode with 1:1 pixel ratio.
// We haven't used GLU here to do this to avoid an unnecessary dependency.
GL11.glMatrixMode(GL11.GL_PROJECTION);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-05-27 07:48:45
|
Revision: 2829
http://svn.sourceforge.net/java-game-lib/?rev=2829&view=rev
Author: elias_naur
Date: 2007-05-27 00:48:43 -0700 (Sun, 27 May 2007)
Log Message:
-----------
Display: Add GL error check after initial makeCurrent()
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 2007-05-27 05:19:19 UTC (rev 2828)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-05-27 07:48:43 UTC (rev 2829)
@@ -767,6 +767,7 @@
private static void makeCurrentAndSetSwapInterval() throws LWJGLException {
makeCurrent();
+ Util.checkGLerror();
setSwapInterval(swap_interval);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-05-27 13:09:49
|
Revision: 2830
http://svn.sourceforge.net/java-game-lib/?rev=2830&view=rev
Author: elias_naur
Date: 2007-05-27 06:09:48 -0700 (Sun, 27 May 2007)
Log Message:
-----------
Display: Add GL error check after initial makeCurrent() (for real this 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 2007-05-27 07:48:43 UTC (rev 2829)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-05-27 13:09:48 UTC (rev 2830)
@@ -767,7 +767,7 @@
private static void makeCurrentAndSetSwapInterval() throws LWJGLException {
makeCurrent();
- Util.checkGLerror();
+ Util.checkGLError();
setSwapInterval(swap_interval);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-06-06 13:56:05
|
Revision: 2846
http://svn.sourceforge.net/java-game-lib/?rev=2846&view=rev
Author: elias_naur
Date: 2007-06-06 06:56:03 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
Removed unused, private Display.getContext()
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 2007-06-06 12:27:40 UTC (rev 2845)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-06-06 13:56:03 UTC (rev 2846)
@@ -874,13 +874,6 @@
}
/**
- * @return the unique Display context (or null, if the Display has not been created)
- */
- private static Context getContext() {
- return context;
- }
-
- /**
* @return true if the window's native peer has been created
*/
public static boolean isCreated() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-08-15 20:14:33
|
Revision: 2872
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2872&view=rev
Author: matzon
Date: 2007-08-15 13:14:29 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
fix: make sure that we return to the same display mode that was set in windowed mode when toggling between fullscreen and windowed mode
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 2007-08-12 23:33:25 UTC (rev 2871)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-08-15 20:14:29 UTC (rev 2872)
@@ -82,6 +82,9 @@
/** Cached window icons, for when Display is recreated */
private static ByteBuffer[] cached_icons;
+
+ /** Display mode used prior to entering fullscreen */
+ private static DisplayMode windowed_display_mode;
/**
* Y coordinate of the window. Y in window coordinates is from the top of the display down,
@@ -298,6 +301,7 @@
private static void switchDisplayMode() throws LWJGLException {
if (!current_mode.isFullscreen()) {
LWJGLUtil.log("Switching to "+initial_mode);
+ windowed_display_mode = current_mode;
setDisplayMode(initial_mode);
}
display_impl.switchDisplayMode(current_mode);
@@ -473,6 +477,7 @@
switchDisplayMode();
} else {
display_impl.resetDisplayMode();
+ current_mode = windowed_display_mode;
}
createWindow();
makeCurrentAndSetSwapInterval();
@@ -844,6 +849,7 @@
destroyPeerInfo();
x = y = -1;
cached_icons = null;
+ windowed_display_mode = null;
reset();
removeShutdownHook();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-08-16 08:49:17
|
Revision: 2874
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2874&view=rev
Author: elias_naur
Date: 2007-08-16 01:49:14 -0700 (Thu, 16 Aug 2007)
Log Message:
-----------
Revert 2872
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 2007-08-16 08:38:20 UTC (rev 2873)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-08-16 08:49:14 UTC (rev 2874)
@@ -82,9 +82,6 @@
/** Cached window icons, for when Display is recreated */
private static ByteBuffer[] cached_icons;
-
- /** Display mode used prior to entering fullscreen */
- private static DisplayMode windowed_display_mode;
/**
* Y coordinate of the window. Y in window coordinates is from the top of the display down,
@@ -301,7 +298,6 @@
private static void switchDisplayMode() throws LWJGLException {
if (!current_mode.isFullscreen()) {
LWJGLUtil.log("Switching to "+initial_mode);
- windowed_display_mode = current_mode;
setDisplayMode(initial_mode);
}
display_impl.switchDisplayMode(current_mode);
@@ -477,7 +473,6 @@
switchDisplayMode();
} else {
display_impl.resetDisplayMode();
- current_mode = windowed_display_mode;
}
createWindow();
makeCurrentAndSetSwapInterval();
@@ -849,7 +844,6 @@
destroyPeerInfo();
x = y = -1;
cached_icons = null;
- windowed_display_mode = null;
reset();
removeShutdownHook();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-08-16 08:55:10
|
Revision: 2875
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2875&view=rev
Author: elias_naur
Date: 2007-08-16 01:55:06 -0700 (Thu, 16 Aug 2007)
Log Message:
-----------
Don't allow switching to fullscreen when a custom display mode is in effect. This is a change from before, where the current mode was simply overwritten with the initial (desktop) mode
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 2007-08-16 08:49:14 UTC (rev 2874)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-08-16 08:55:06 UTC (rev 2875)
@@ -297,8 +297,7 @@
private static void switchDisplayMode() throws LWJGLException {
if (!current_mode.isFullscreen()) {
- LWJGLUtil.log("Switching to "+initial_mode);
- setDisplayMode(initial_mode);
+ throw new IllegalStateException("Only modes acquired from getAvailableDisplayModes() can be used for fullscreen display");
}
display_impl.switchDisplayMode(current_mode);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-08-30 12:19:49
|
Revision: 2894
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2894&view=rev
Author: elias_naur
Date: 2007-08-30 05:19:34 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Made Display.timeNow local
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 2007-08-28 08:02:24 UTC (rev 2893)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-08-30 12:19:34 UTC (rev 2894)
@@ -75,7 +75,7 @@
private static DisplayMode current_mode;
/** Timer for sync() */
- private static long timeNow, timeThen;
+ private static long timeThen;
/** X coordinate of the window */
private static int x = -1;
@@ -353,7 +353,7 @@
public static void sync3(int fps) {
synchronized (GlobalLock.lock) {
float frameTime = 1.0f / (fps > 1 ? fps - 1 : 1);
- timeNow = Sys.getTime();
+ long timeNow = Sys.getTime();
while (timeNow > timeThen && (float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < frameTime) {
// This is a system-friendly way of allowing other stuff to use CPU if it wants to
Thread.yield();
@@ -373,7 +373,7 @@
public static void sync2(int fps) {
synchronized (GlobalLock.lock) {
long gapTo = Sys.getTimerResolution() / fps + timeThen;
- timeNow = Sys.getTime();
+ long timeNow = Sys.getTime();
while (gapTo > timeNow + timeLate) {
Thread.yield();
@@ -397,7 +397,7 @@
public static void sync(int fps) {
synchronized (GlobalLock.lock) {
long gapTo = Sys.getTimerResolution() / fps + timeThen;
- timeNow = Sys.getTime();
+ long timeNow = Sys.getTime();
while (gapTo > timeNow + timeLate) {
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-08-30 12:35:00
|
Revision: 2895
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2895&view=rev
Author: elias_naur
Date: 2007-08-30 05:34:56 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Don't let Display.sync* sleep with the global lock held
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 2007-08-30 12:19:34 UTC (rev 2894)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-08-30 12:34:56 UTC (rev 2895)
@@ -351,16 +351,19 @@
* @param fps The desired frame rate, in frames per second
*/
public static void sync3(int fps) {
+ long savedTimeThen;
+ long timeNow;
synchronized (GlobalLock.lock) {
- float frameTime = 1.0f / (fps > 1 ? fps - 1 : 1);
- long timeNow = Sys.getTime();
- while (timeNow > timeThen && (float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < frameTime) {
- // This is a system-friendly way of allowing other stuff to use CPU if it wants to
- Thread.yield();
- timeNow = Sys.getTime();
- }
+ timeNow = Sys.getTime();
+ savedTimeThen = timeThen;
timeThen = timeNow;
}
+ float frameTime = 1.0f / (fps > 1 ? fps - 1 : 1);
+ while (timeNow > savedTimeThen && (float) (timeNow - savedTimeThen) / (float) Sys.getTimerResolution() < frameTime) {
+ // This is a system-friendly way of allowing other stuff to use CPU if it wants to
+ Thread.yield();
+ timeNow = Sys.getTime();
+ }
}
private static long timeLate;
@@ -371,15 +374,21 @@
* @param fps The desired frame rate, in frames per second
*/
public static void sync2(int fps) {
+ long timeNow;
+ long gapTo;
+ long savedTimeLate;
synchronized (GlobalLock.lock) {
- long gapTo = Sys.getTimerResolution() / fps + timeThen;
- long timeNow = Sys.getTime();
+ gapTo = Sys.getTimerResolution() / fps + timeThen;
+ timeNow = Sys.getTime();
+ savedTimeLate = timeLate;
+ }
- while (gapTo > timeNow + timeLate) {
- Thread.yield();
- timeNow = Sys.getTime();
- }
+ while (gapTo > timeNow + savedTimeLate) {
+ Thread.yield();
+ timeNow = Sys.getTime();
+ }
+ synchronized (GlobalLock.lock) {
if (gapTo < timeNow)
timeLate = timeNow - gapTo;
else
@@ -395,18 +404,24 @@
* @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) {
- long gapTo = Sys.getTimerResolution() / fps + timeThen;
- long timeNow = Sys.getTime();
+ gapTo = Sys.getTimerResolution() / fps + timeThen;
+ timeNow = Sys.getTime();
+ savedTimeLate = timeLate;
+ }
- while (gapTo > timeNow + timeLate) {
- try {
- Thread.sleep(1);
- } catch (InterruptedException e) {
- }
- timeNow = Sys.getTime();
+ while (gapTo > timeNow + savedTimeLate) {
+ try {
+ Thread.sleep(1);
+ } catch (InterruptedException e) {
}
+ timeNow = Sys.getTime();
+ }
+ synchronized (GlobalLock.lock) {
if (gapTo < timeNow)
timeLate = timeNow - gapTo;
else
@@ -415,7 +430,7 @@
timeThen = timeNow;
}
}
-
+
/**
* @return the X coordinate of the window (always 0 for fullscreen)
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-08-30 18:27:14
|
Revision: 2896
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2896&view=rev
Author: elias_naur
Date: 2007-08-30 11:27:12 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Mac OS X: Release and clear the context from the drawable in the correct order
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 2007-08-30 12:34:56 UTC (rev 2895)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2007-08-30 18:27:12 UTC (rev 2896)
@@ -277,8 +277,8 @@
}
try {
if (context != null && context.isCurrent()) {
+ Context.releaseCurrentContext();
context.releaseDrawable();
- Context.releaseCurrentContext();
}
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred while trying to release context: " + e);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-01-19 09:53:16
|
Revision: 2934
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2934&view=rev
Author: elias_naur
Date: 2008-01-19 01:53:14 -0800 (Sat, 19 Jan 2008)
Log Message:
-----------
Only let Display.update() call display_impl.update() once
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 2008-01-19 08:57:20 UTC (rev 2933)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2008-01-19 09:53:14 UTC (rev 2934)
@@ -618,8 +618,9 @@
if (!isCreated())
throw new IllegalStateException("Display not created");
+ processMessages();
// We paint only when the window is visible or dirty
- if (isVisible() || isDirty()) {
+ if (display_impl.isVisible() || display_impl.isDirty()) {
try {
swapBuffers();
} catch (LWJGLException e) {
@@ -627,7 +628,6 @@
}
}
- processMessages();
pollDevices();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-01-21 20:21:22
|
Revision: 2937
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2937&view=rev
Author: elias_naur
Date: 2008-01-21 12:21:21 -0800 (Mon, 21 Jan 2008)
Log Message:
-----------
Display: Removed display_impl.update() from isCloseRequested(), isVisible(), isDirty() and isActive() since it can be an expensive call on at least linux. Display.update() is now required to be called to update the internal state.
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 2008-01-21 18:59:12 UTC (rev 2936)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2008-01-21 20:21:21 UTC (rev 2937)
@@ -531,7 +531,6 @@
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Cannot determine close requested state of uncreated window");
- display_impl.update();
return display_impl.isCloseRequested();
}
}
@@ -543,7 +542,6 @@
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Cannot determine minimized state of uncreated window");
- display_impl.update();
return display_impl.isVisible();
}
}
@@ -555,7 +553,6 @@
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Cannot determine focused state of uncreated window");
- display_impl.update();
return display_impl.isActive();
}
}
@@ -574,7 +571,6 @@
synchronized (GlobalLock.lock) {
if (!isCreated())
throw new IllegalStateException("Cannot determine dirty state of uncreated window");
- display_impl.update();
return display_impl.isDirty();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-03-23 15:51:11
|
Revision: 2965
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2965&view=rev
Author: elias_naur
Date: 2008-03-23 08:51:10 -0700 (Sun, 23 Mar 2008)
Log Message:
-----------
Removed 2D OpenGL initialization code from Display. It messes with the implicit, but well-defined, opengl default state and doesn't fit well with multiple context types (gl3 and d3d)
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 2008-03-02 18:16:39 UTC (rev 2964)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2008-03-23 15:51:10 UTC (rev 2965)
@@ -782,14 +782,6 @@
}
private static void initContext() {
- // Put the window into orthographic projection mode with 1:1 pixel ratio.
- // We haven't used GLU here to do this to avoid an unnecessary dependency.
- GL11.glMatrixMode(GL11.GL_PROJECTION);
- GL11.glLoadIdentity();
- GL11.glOrtho(0.0, current_mode.getWidth(), 0.0, current_mode.getHeight(), -1.0, 1.0);
- GL11.glMatrixMode(GL11.GL_MODELVIEW);
- GL11.glLoadIdentity();
- GL11.glViewport(0, 0, current_mode.getWidth(), current_mode.getHeight());
// Clear window to avoid the desktop "showing through"
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
update();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-07 20:39:47
|
Revision: 2992
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2992&view=rev
Author: elias_naur
Date: 2008-04-07 13:39:46 -0700 (Mon, 07 Apr 2008)
Log Message:
-----------
Added line about tracking parent size to Display.setParent javadoc
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 2008-04-07 20:13:17 UTC (rev 2991)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2008-04-07 20:39:46 UTC (rev 2992)
@@ -522,7 +522,8 @@
* null or a different parent. This generally means that the parent component must remain added to it's parent container.<p>
* It is not advisable to call this method from an AWT thread, since the context will be made current on the thread
* and it is difficult to predict which AWT thread will process any given AWT event.<p>
- * If the Display is in fullscreen mode, the current parent will be ignored.
+ * While the Display is in fullscreen mode, the current parent will be ignored. Additionally, when a non null parent is specified,
+ * the Dispaly will inherit the size of the parent, disregarding the currently set display mode.<p>
*
*/
public static void setParent(Canvas parent) throws LWJGLException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-13 18:11:40
|
Revision: 3017
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3017&view=rev
Author: elias_naur
Date: 2008-04-13 11:11:38 -0700 (Sun, 13 Apr 2008)
Log Message:
-----------
Linux: Some DRI drivers don't like to have the context destroyed before the window, even though the context is not current anymore. The destroy ordering in Display.destroy is now flipped as a workaround
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 2008-04-13 17:04:05 UTC (rev 3016)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2008-04-13 18:11:38 UTC (rev 3017)
@@ -310,13 +310,7 @@
}
}
- private static void destroyWindow() {
- if (!window_created) {
- return;
- }
- if (parent != null) {
- parent.removeComponentListener(component_listener);
- }
+ private static void releaseDrawable() {
try {
if (context != null && context.isCurrent()) {
Context.releaseCurrentContext();
@@ -325,7 +319,17 @@
} catch (LWJGLException e) {
LWJGLUtil.log("Exception occurred while trying to release context: " + e);
}
+ }
+ private static void destroyWindow() {
+ if (!window_created) {
+ return;
+ }
+ if (parent != null) {
+ parent.removeComponentListener(component_listener);
+ }
+ releaseDrawable();
+
// Automatically destroy keyboard & mouse
if (Mouse.isCreated()) {
Mouse.destroy();
@@ -932,8 +936,9 @@
return;
}
+ releaseDrawable();
+ destroyContext();
destroyWindow();
- destroyContext();
destroyPeerInfo();
x = y = -1;
cached_icons = null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-04-13 18:26:26
|
Revision: 3019
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3019&view=rev
Author: elias_naur
Date: 2008-04-13 11:26:22 -0700 (Sun, 13 Apr 2008)
Log Message:
-----------
Don't set icon when Display is parented
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 2008-04-13 18:13:26 UTC (rev 3018)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2008-04-13 18:26:22 UTC (rev 3019)
@@ -1092,7 +1092,7 @@
}
}
- if(Display.isCreated()) {
+ if (Display.isCreated() && parent == null) {
return display_impl.setIcon(cached_icons);
} else {
return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-05-30 06:53:35
|
Revision: 3084
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3084&view=rev
Author: elias_naur
Date: 2008-05-29 23:53:33 -0700 (Thu, 29 May 2008)
Log Message:
-----------
Removed Display.sync2 and Display.sync3
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 2008-05-28 18:09:24 UTC (rev 3083)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2008-05-30 06:53:33 UTC (rev 3084)
@@ -396,7 +396,7 @@
* to prevent just missing the frame time if vsync is set.
* @param fps The desired frame rate, in frames per second
*/
- public static void sync3(int fps) {
+/* public static void sync3(int fps) {
long savedTimeThen;
long timeNow;
synchronized (GlobalLock.lock) {
@@ -411,7 +411,7 @@
timeNow = Sys.getTime();
}
}
-
+*/
private static long timeLate;
/**
@@ -419,7 +419,7 @@
*
* @param fps The desired frame rate, in frames per second
*/
- public static void sync2(int fps) {
+/* public static void sync2(int fps) {
long timeNow;
long gapTo;
long savedTimeLate;
@@ -443,7 +443,7 @@
timeThen = timeNow;
}
}
-
+*/
/**
* Best sync method that works reliably.
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2008-05-30 07:08:16
|
Revision: 3085
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3085&view=rev
Author: elias_naur
Date: 2008-05-30 00:08:14 -0700 (Fri, 30 May 2008)
Log Message:
-----------
Removed dead code from Display
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 2008-05-30 06:53:33 UTC (rev 3084)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2008-05-30 07:08:14 UTC (rev 3085)
@@ -390,61 +390,9 @@
}
}
- /**
- * Synchronize the display to a capped frame rate. Note that we are being "smart" about the
- * desired results in our implementation; we automatically subtract 1 from the desired framerate
- * to prevent just missing the frame time if vsync is set.
- * @param fps The desired frame rate, in frames per second
- */
-/* public static void sync3(int fps) {
- long savedTimeThen;
- long timeNow;
- synchronized (GlobalLock.lock) {
- timeNow = Sys.getTime();
- savedTimeThen = timeThen;
- timeThen = timeNow;
- }
- float frameTime = 1.0f / (fps > 1 ? fps - 1 : 1);
- while (timeNow > savedTimeThen && (float) (timeNow - savedTimeThen) / (float) Sys.getTimerResolution() < frameTime) {
- // This is a system-friendly way of allowing other stuff to use CPU if it wants to
- Thread.yield();
- timeNow = Sys.getTime();
- }
- }
-*/
private static long timeLate;
/**
- * Alternative sync method which works better on triple-buffered GL displays.
- *
- * @param fps The desired frame rate, in frames per second
- */
-/* public static void sync2(int fps) {
- long timeNow;
- long gapTo;
- long savedTimeLate;
- synchronized (GlobalLock.lock) {
- gapTo = Sys.getTimerResolution() / fps + timeThen;
- timeNow = Sys.getTime();
- savedTimeLate = timeLate;
- }
-
- while (gapTo > timeNow + savedTimeLate) {
- Thread.yield();
- timeNow = Sys.getTime();
- }
-
- synchronized (GlobalLock.lock) {
- if (gapTo < timeNow)
- timeLate = timeNow - gapTo;
- else
- timeLate = 0;
-
- timeThen = timeNow;
- }
- }
-*/
- /**
* Best sync method that works reliably.
*
* @param fps The desired frame rate, in frames per second
@@ -478,21 +426,6 @@
}
/**
- * @return the X coordinate of the window (always 0 for fullscreen)
- */
- /*public static int getX() {
- return (fullscreen) ? 0 : x;
- }*/
-
- /**
- * @return the Y coordinate of the window (always 0 for fullscreen)
- */
- /*public static int getY() {
- return (fullscreen) ? 0 : y;
- }*/
-
-
- /**
* @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: <eli...@us...> - 2008-06-16 18:29:35
|
Revision: 3103
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3103&view=rev
Author: elias_naur
Date: 2008-06-16 11:29:18 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
Display.setIcon: Preserve icon buffer positions
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 2008-06-08 09:30:24 UTC (rev 3102)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2008-06-16 18:29:18 UTC (rev 3103)
@@ -1020,7 +1020,9 @@
cached_icons = new ByteBuffer[icons.length];
for(int i=0;i<icons.length; i++) {
cached_icons[i] = BufferUtils.createByteBuffer(icons[i].capacity());
+ int old_position = icons[i].position();
cached_icons[i].put(icons[i]);
+ icons[i].position(old_position);
cached_icons[i].flip();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|