From: <sp...@us...> - 2012-09-06 07:12:06
|
Revision: 3797 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3797&view=rev Author: spasi Date: 2012-09-06 07:11:54 +0000 (Thu, 06 Sep 2012) Log Message: ----------- Made GLContext.getCapabilities throw a RuntimeException instead of returning null when there's no GL context current in the current thread. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2012-09-05 22:37:11 UTC (rev 3796) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2012-09-06 07:11:54 UTC (rev 3797) @@ -119,6 +119,14 @@ * @return The current capabilities instance. */ public static ContextCapabilities getCapabilities() { + ContextCapabilities caps = getCapabilitiesImpl(); + if ( caps == null ) + throw new RuntimeException("No OpenGL context found in the current thread."); + + return caps; + } + + private static ContextCapabilities getCapabilitiesImpl() { CapabilitiesCacheEntry recent_cache_entry = fast_path_cache; // Check owner of cache entry if ( recent_cache_entry.owner == Thread.currentThread() ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |