aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2009-05-22 23:12:09 +0000
committerKenneth Russel <[email protected]>2009-05-22 23:12:09 +0000
commitebc40265fde90f63977c9fac1713b1272c17b33a (patch)
tree6fecf896cfee0062e4bc54f2ef08d8592d455500
parentbe3d7e5c1cf5d4d0342da36c3ab3eae91da51ec1 (diff)
Optimized GLU creation by caching Class object for implementation
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1910 232f8b59-042b-4e1e-8c03-345bb8c30851
-rwxr-xr-xmake/config/jogl/glu-CustomJavaCode-base.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/make/config/jogl/glu-CustomJavaCode-base.java b/make/config/jogl/glu-CustomJavaCode-base.java
index 5b8a30f46..bc8f18c8d 100755
--- a/make/config/jogl/glu-CustomJavaCode-base.java
+++ b/make/config/jogl/glu-CustomJavaCode-base.java
@@ -83,20 +83,32 @@ public static final GLU createGLU() throws GLException {
return createGLU(GLProfile.getProfile());
}
+private static Class gl2Class;
+private static Class gl2es1Class;
+
/**
* Instantiates a GLU implementation object in respect to the given GL profile.
*/
public static final GLU createGLU(String profile) throws GLException {
try {
+ Class c = null;
if(GLProfile.GL2.equals(profile)) {
- return (GLU) NWReflection.createInstance("javax.media.opengl.glu.gl2.GLUgl2");
- }
- } catch (GLException e) { e.printStackTrace(); }
- try {
- if(GLProfile.GL2ES1.equals(profile) || GLProfile.GL2.equals(profile) || GLProfile.GLES1.equals(profile)) {
- return (GLU) NWReflection.createInstance("javax.media.opengl.glu.gl2es1.GLUgl2es1");
- }
- } catch (GLException e) { e.printStackTrace(); }
+ if (gl2Class == null) {
+ gl2Class = Class.forName("javax.media.opengl.glu.gl2.GLUgl2");
+ }
+ c = gl2Class;
+ } else if (GLProfile.GL2ES1.equals(profile) || GLProfile.GLES1.equals(profile)) {
+ if (gl2es1Class == null) {
+ gl2es1Class = Class.forName("javax.media.opengl.glu.gl2es1.GLUgl2es1");
+ }
+ c = gl2es1Class;
+ }
+ if (c != null) {
+ return (GLU) c.newInstance();
+ }
+ } catch (Exception e) {
+ throw new GLException(e);
+ }
// There is no specialized ES 2 GLU at this time
/*
try {