From 8f76db4364f66c36780e762e086a18d5cc315363 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Sun, 11 Oct 2009 07:41:31 -0700
Subject: NEWT X11 Display Lock:     Integrate Display.lock/unlock,     so the
 generic Window will call it.     Specialized for X11Display, the only real
 impl of it.     Fixes offscreen EDT usage ..

GLProfile:
    Add isAWTAvailable() and isAWTJOGLAvailable()

TextureIO:
    - Add NetPbmTextureWriter
    - Only use IIOTexture* if !isAWTJOGLAvailable()
    - Add write (TextureData, File)
---
 src/jogl/classes/javax/media/opengl/GLProfile.java | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

(limited to 'src/jogl/classes/javax/media/opengl')

diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 756c80009..abb6ca4f3 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -605,6 +605,9 @@ public class GLProfile implements Cloneable {
     // This is here only to avoid having separate GL2ES1Impl and GL2ES2Impl classes
     private static final String GL2ES12 = "GL2ES12";
 
+    private static final boolean isAWTAvailable;
+    private static final boolean isAWTJOGLAvailable;
+
     private static final boolean hasGL3Impl;
     private static final boolean hasGL2Impl;
     private static final boolean hasGL2ES12Impl;
@@ -624,6 +627,15 @@ public class GLProfile implements Cloneable {
     static {
         JVMUtil.initSingleton();
 
+        AccessControlContext acc = AccessController.getContext();
+
+        isAWTAvailable = !Debug.getBooleanProperty("java.awt.headless", true, acc) &&
+                          NWReflection.isClassAvailable("java.awt.Component") ;
+
+        isAWTJOGLAvailable = isAWTAvailable &&
+                             NWReflection.isClassAvailable("javax.media.nativewindow.awt.AWTGraphicsDevice") && // NativeWindow
+                             NWReflection.isClassAvailable("javax.media.opengl.awt.GLCanvas") ; // JOGL
+
         boolean hasDesktopGL = false;
         boolean hasDesktopGLES12 = false;
         boolean hasNativeOSFactory = false;
@@ -711,6 +723,8 @@ public class GLProfile implements Cloneable {
         hasGLES1Impl     = btest;
 
         if (DEBUG) {
+            System.err.println("GLProfile.static isAWTAvailable "+isAWTAvailable);
+            System.err.println("GLProfile.static isAWTJOGLAvailable "+isAWTJOGLAvailable);
             System.err.println("GLProfile.static hasNativeOSFactory "+hasNativeOSFactory);
             System.err.println("GLProfile.static hasDesktopGLES12 "+hasDesktopGLES12);
             System.err.println("GLProfile.static hasDesktopGL "+hasDesktopGL);
@@ -799,6 +813,9 @@ public class GLProfile implements Cloneable {
         return null;
     }
 
+    public static boolean isAWTAvailable() { return isAWTAvailable; }
+    public static boolean isAWTJOGLAvailable() { return isAWTJOGLAvailable; }
+
     public static String getGLTypeName(int type) {
         switch (type) {
         case GL.GL_UNSIGNED_BYTE:
-- 
cgit v1.2.3