2 Copyright (C) 2001, 2006 United States Government
3 as represented by the Administrator of the
4 National Aeronautics and Space Administration.
7 package gov
.nasa
.worldwind
.util
;
10 * @version $Id: JOGLVersionInfo.java 2422 2007-07-25 23:07:49Z tgaskins $
12 * This program returns the version and implementation information for the Java Bindings for OpenGL (R)
13 * implementation found in the CLASSPATH. This information is also found in the manifest for jogl.jar, and this
14 * program uses the java.lang.Package class to retrieve it programatically.
17 public class JOGLVersionInfo
19 private static JOGLVersionInfo svi
= new JOGLVersionInfo();
22 private JOGLVersionInfo()
24 ClassLoader classLoader
= getClass().getClassLoader();
25 this.p
= pkgInfo(classLoader
, "javax.media.opengl", "GL");
28 private static Package
pkgInfo(ClassLoader classLoader
, String pkgName
, String className
)
34 classLoader
.loadClass(pkgName
+ "." + className
);
36 // TODO: message logging
37 p
= Package
.getPackage(pkgName
);
39 System
.out
.println("WARNING: Package.getPackage(" + pkgName
+") is null");
41 catch (ClassNotFoundException e
)
43 System
.out
.println("Unable to load " + pkgName
);
49 public static Package
getPackage()
54 public static boolean isCompatibleWith(String version
)
56 return svi
.p
!= null && svi
.p
.isCompatibleWith(version
);
59 public static String
getSpecificationTitle()
61 return svi
.p
!= null ? svi
.p
.getSpecificationTitle() : null;
64 public static String
getSpecificationVendor()
66 return svi
.p
!= null ? svi
.p
.getSpecificationVendor() : null;
69 public static String
getSpecificationVersion()
71 return svi
.p
!= null ? svi
.p
.getSpecificationVersion() : null;
74 public static String
getImplementationTitle()
76 return svi
.p
!= null ? svi
.p
.getImplementationTitle() : null;
79 public static String
getImplementationVersion()
81 return svi
.p
!= null ? svi
.p
.getImplementationVersion() : null;
84 public static void main(String
[] args
)
86 System
.out
.println(JOGLVersionInfo
.getPackage());
87 System
.out
.println(JOGLVersionInfo
.getSpecificationTitle());
88 System
.out
.println(JOGLVersionInfo
.getSpecificationVendor());
89 System
.out
.println(JOGLVersionInfo
.getSpecificationVersion());
90 System
.out
.println(JOGLVersionInfo
.getImplementationTitle());
91 System
.out
.println(JOGLVersionInfo
.getImplementationVersion());
92 System
.out
.println(JOGLVersionInfo
.isCompatibleWith("1.0"));
93 System
.out
.println(JOGLVersionInfo
.isCompatibleWith("1.1.1"));
94 System
.out
.println(JOGLVersionInfo
.isCompatibleWith("1.2.1"));
95 System
.out
.println(JOGLVersionInfo
.getImplementationVersion().compareToIgnoreCase("1.1.1-pre-20070511-02:12:11"));
96 System
.out
.println(JOGLVersionInfo
.getImplementationVersion().compareToIgnoreCase("1.1.1-pre-20070512-02:12:11"));
97 System
.out
.println(JOGLVersionInfo
.getImplementationVersion().compareToIgnoreCase("1.1.1"));