|
From: <eli...@us...> - 2006-05-03 20:53:43
|
Revision: 2321 Author: elias_naur Date: 2006-05-03 13:53:16 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2321&view=rev Log Message: ----------- Added Display.swapBuffers(). Combined with Display.processMessages() and Mouse/Keyboard/Controllers.poll() this method allows an application to create a custom policy for the rendering/polling loop in addition to the static Display.update() policy. 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-05-03 08:04:57 UTC (rev 2320) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2006-05-03 20:53:16 UTC (rev 2321) @@ -549,25 +549,37 @@ */ public static void processMessages() { if (!isCreated()) - throw new IllegalStateException("Cannot update uncreated window"); + throw new IllegalStateException("Display not created"); display_impl.update(); } /** + * Swap the display buffers. This method is called from update(), and should normally not be called by + * the application. + * @throws OpenGLException if an OpenGL error has occured since the last call to GL11.glGetError() + */ + public static void swapBuffers() throws LWJGLException { + if (!isCreated()) + throw new IllegalStateException("Display not created"); + + Util.checkGLError(); + Context.swapBuffers(); + } + + /** * Update the window. This calls processMessages(), and if the window is visible - * clears the dirty flag and swaps the buffers and polls the input devices. + * clears the dirty flag and calls swapBuffers() and finally polls the input devices. * @throws OpenGLException if an OpenGL error has occured since the last call to GL11.glGetError() */ public static void update() { if (!isCreated()) - throw new IllegalStateException("Cannot update uncreated window"); + throw new IllegalStateException("Display not created"); // We paint only when the window is visible or dirty if (isVisible() || isDirty()) { - Util.checkGLError(); try { - Context.swapBuffers(); + swapBuffers(); } catch (LWJGLException e) { throw new RuntimeException(e); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |