Made GLContext.getCapabilities throw a RuntimeException instead of returning null when there's no GL context current in the current thread.

This commit is contained in:
Ioannis Tsakpinis 2012-09-06 07:11:54 +00:00
parent 43426ac8d8
commit b824d786c4
1 changed files with 8 additions and 0 deletions

View File

@ -119,6 +119,14 @@ public final class GLContext {
* @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() ) {