diff options
author | Sven Gothel <[email protected]> | 2014-06-17 23:42:58 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-06-17 23:42:58 +0200 |
commit | 4e91f5e085585481b542c476a1ba599f2e914bf1 (patch) | |
tree | 1b8164703ad61ab367d74a3880acf2c9a6b3dedf | |
parent | 68ca3ae8fcce28c62034299bc6e6f7eaab50bd1f (diff) |
Fix regression due to GlueGen commit c3054a01990e55ab35756ea23ab7d7c05f24dd37, completes JOGL commit 68ca3ae8fcce28c62034299bc6e6f7eaab50bd1f
Add handling of 'initializeImpl()' of generated GLU* classes:
- GLU : no 'initializeImpl()' <- no libs
- GLUgl2es1: no 'initializeImpl()' <- no libs
- GLUgl: call 'initializeImpl()' in manual static init impl.
Further more, we shall not initialize the GLU* classes in GLU
static init method, querying GLU* class availability.
Tested via OlympicES1.
-rw-r--r-- | make/config/jogl/glu-CustomJavaCode-base.java | 9 | ||||
-rw-r--r-- | make/config/jogl/glu-CustomJavaCode-gl2.java | 4 | ||||
-rw-r--r-- | make/config/jogl/glu-CustomJavaCode-gl2es1.java | 4 | ||||
-rw-r--r-- | make/config/jogl/glu-base.cfg | 1 | ||||
-rw-r--r-- | make/config/jogl/glu-gl2.cfg | 1 | ||||
-rw-r--r-- | make/config/jogl/glu-gl2es1.cfg | 1 | ||||
-rw-r--r-- | make/scripts/tests.sh | 4 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java | 45 |
8 files changed, 43 insertions, 26 deletions
diff --git a/make/config/jogl/glu-CustomJavaCode-base.java b/make/config/jogl/glu-CustomJavaCode-base.java index 21d6277e9..48fe31329 100644 --- a/make/config/jogl/glu-CustomJavaCode-base.java +++ b/make/config/jogl/glu-CustomJavaCode-base.java @@ -83,11 +83,16 @@ static { Class _gl2Class=null; Class _gl2es1Class=null; try { - _gl2Class = Class.forName("javax.media.opengl.glu.gl2.GLUgl2"); - _gl2es1Class = Class.forName("javax.media.opengl.glu.gl2es1.GLUgl2es1"); + final ClassLoader cl = GLU.class.getClassLoader(); + _gl2Class = Class.forName("javax.media.opengl.glu.gl2.GLUgl2", false, cl); + _gl2es1Class = Class.forName("javax.media.opengl.glu.gl2es1.GLUgl2es1", false, cl); } catch (Throwable t) {} gl2Class = _gl2Class; gl2es1Class = _gl2es1Class; + /** No native code, not required nor possible + if( !initializeImpl() ) { + throw new RuntimeException("Initialization failure"); + } */ } /** diff --git a/make/config/jogl/glu-CustomJavaCode-gl2.java b/make/config/jogl/glu-CustomJavaCode-gl2.java index 4dcb5691e..c8ac9403b 100644 --- a/make/config/jogl/glu-CustomJavaCode-gl2.java +++ b/make/config/jogl/glu-CustomJavaCode-gl2.java @@ -7,6 +7,10 @@ static { if (val != null && !val.toLowerCase().equals("false")) { useJavaMipmapCode = false; } + // Native code exists + if( !initializeImpl() ) { + throw new RuntimeException("Initialization failure"); + } return null; } }); diff --git a/make/config/jogl/glu-CustomJavaCode-gl2es1.java b/make/config/jogl/glu-CustomJavaCode-gl2es1.java index 203d1eeae..de9c65b8d 100644 --- a/make/config/jogl/glu-CustomJavaCode-gl2es1.java +++ b/make/config/jogl/glu-CustomJavaCode-gl2es1.java @@ -8,6 +8,10 @@ static { if (val != null && !val.toLowerCase().equals("false")) { useJavaMipmapCode = false; } + // No native code, not required nor possible + // if( !initializeImpl() ) { + // throw new RuntimeException("Initialization failure"); + // } return null; } }); diff --git a/make/config/jogl/glu-base.cfg b/make/config/jogl/glu-base.cfg index f4021d6d8..93aff1fa9 100644 --- a/make/config/jogl/glu-base.cfg +++ b/make/config/jogl/glu-base.cfg @@ -18,6 +18,7 @@ Ignore gluScaleImage # Custom Java code for GLU class IncludeAs CustomJavaCode GLU glu-CustomJavaCode-base.java +ManualStaticInit GLU # Imports for the Error and Registry classes Import jogamp.opengl.glu.error.Error diff --git a/make/config/jogl/glu-gl2.cfg b/make/config/jogl/glu-gl2.cfg index a634e3113..9a15645a6 100644 --- a/make/config/jogl/glu-gl2.cfg +++ b/make/config/jogl/glu-gl2.cfg @@ -34,6 +34,7 @@ CustomCCode #include <GL/glu.h> # Custom Java code for GLU class IncludeAs CustomJavaCode GLUgl2 glu-CustomJavaCode-gl2.java +ManualStaticInit GLUgl2 # GLU needs access to the GLUtesselatorImpl class for GLUtesselator, # to the Mipmap class for scaling and mipmap generation, diff --git a/make/config/jogl/glu-gl2es1.cfg b/make/config/jogl/glu-gl2es1.cfg index fa7011360..35dd6a2e0 100644 --- a/make/config/jogl/glu-gl2es1.cfg +++ b/make/config/jogl/glu-gl2es1.cfg @@ -18,6 +18,7 @@ Ignore gluScaleImage # Custom Java code for GLU class IncludeAs CustomJavaCode GLUgl2es1 glu-CustomJavaCode-gl2es1.java +ManualStaticInit GLUgl2es1 Import javax.media.opengl.GLES1 Import jogamp.opengl.glu.mipmap.Mipmap diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 19eb6dede..532bf518b 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -374,7 +374,7 @@ function testawtswt() { # demos (any TK, more user driven tests) # #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestOlympicES1NEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestOlympicES1NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* @@ -634,7 +634,7 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock00AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock01AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock02AWT $* -testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelTextureStateAWT $* +#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelTextureStateAWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelResize01AWT $* #testawt com.jogamp.opengl.test.bugs.Bug735Inv0AppletAWT $* diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java index 04fe26420..b0803c871 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java @@ -31,7 +31,7 @@ public class OlympicES1 implements GLEventListener // private static final double M_PI= 3.141592654; private static final double M_2PI= 2*3.141592654; - private static final int + private static final int // XSIZE= 100, // YSIZE= 75, RINGS= 5, @@ -60,18 +60,18 @@ public class OlympicES1 implements GLEventListener private int iters[]; private ImmModeSink theTorus; - private float lmodel_ambient[] = {0.0f, 0.0f, 0.0f, 0.0f}; - private float lmodel_twoside[] = {0.0f, 0.0f, 0.0f, 0.0f}; + private final float lmodel_ambient[] = {0.0f, 0.0f, 0.0f, 0.0f}; + private final float lmodel_twoside[] = {0.0f, 0.0f, 0.0f, 0.0f}; // private float lmodel_local[] = {0.0f, 0.0f, 0.0f, 0.0f}; - private float light0_ambient[] = {0.1f, 0.1f, 0.1f, 1.0f}; - private float light0_diffuse[] = {1.0f, 1.0f, 1.0f, 0.0f}; - private float light0_position[] = {0.8660254f, 0.5f, 1f, 0f}; - private float light0_specular[] = {1.0f, 1.0f, 1.0f, 0.0f}; - private float bevel_mat_ambient[] = {0.0f, 0.0f, 0.0f, 1.0f}; - private float bevel_mat_shininess[] = {40.0f, 0f, 0f, 0f}; - private float bevel_mat_specular[] = {1.0f, 1.0f, 1.0f, 0.0f}; - private float bevel_mat_diffuse[] = {1.0f, 0.0f, 0.0f, 0.0f}; - private int swapInterval; + private final float light0_ambient[] = {0.1f, 0.1f, 0.1f, 1.0f}; + private final float light0_diffuse[] = {1.0f, 1.0f, 1.0f, 0.0f}; + private final float light0_position[] = {0.8660254f, 0.5f, 1f, 0f}; + private final float light0_specular[] = {1.0f, 1.0f, 1.0f, 0.0f}; + private final float bevel_mat_ambient[] = {0.0f, 0.0f, 0.0f, 1.0f}; + private final float bevel_mat_shininess[] = {40.0f, 0f, 0f, 0f}; + private final float bevel_mat_specular[] = {1.0f, 1.0f, 1.0f, 0.0f}; + private final float bevel_mat_diffuse[] = {1.0f, 0.0f, 0.0f, 0.0f}; + private final int swapInterval; private GLU glu; public OlympicES1() { @@ -88,8 +88,8 @@ public class OlympicES1 implements GLEventListener this.debugFFPEmu = debugFFPEmu; this.traceFFPEmu = traceFFPEmu; } - - public void init(GLAutoDrawable drawable) + + public void init(GLAutoDrawable drawable) { GL _gl = drawable.getGL(); @@ -109,7 +109,7 @@ public class OlympicES1 implements GLEventListener try { // Debug .. gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) ); - } catch (Exception e) {e.printStackTrace();} + } catch (Exception e) {e.printStackTrace();} } if(trace) { try { @@ -130,6 +130,7 @@ public class OlympicES1 implements GLEventListener System.err.println("GL:" + gl + ", " + gl.getContext().getGLVersion()); glu = GLUgl2es1.createGLU(gl); + System.err.println("GLU:" + glu.getClass().getName()); rgb_colors=new byte[RINGS][3]; mapped_colors=new int [RINGS]; @@ -180,11 +181,11 @@ public class OlympicES1 implements GLEventListener dests[GREENRING][1] = bottom_y; dests[GREENRING][2] = bottom_z; - theTorus = ImmModeSink.createFixed(40, + theTorus = ImmModeSink.createFixed(40, 3, GL.GL_FLOAT, // vertex 0, GL.GL_FLOAT, // color 3, GL.GL_FLOAT, // normal - 0, GL.GL_FLOAT, // texCoords + 0, GL.GL_FLOAT, // texCoords GL.GL_STATIC_DRAW); FillTorus(gl, theTorus, 0.1f, 8, 1.0f, 25); @@ -215,7 +216,7 @@ public class OlympicES1 implements GLEventListener gl.glEnable(GL2ES1.GL_COLOR_MATERIAL); gl.glShadeModel(GL2ES1.GL_SMOOTH); - ReInit(); + ReInit(); t0 = System.currentTimeMillis(); tL = t0; } @@ -226,13 +227,13 @@ public class OlympicES1 implements GLEventListener glu.destroy(); glu = null; theTorus.destroy(glad.getGL()); - theTorus = null; + theTorus = null; } @Override public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { - final GL2ES1 gl = glad.getGL().getGL2ES1(); + final GL2ES1 gl = glad.getGL().getGL2ES1(); gl.setSwapInterval(swapInterval); gl.glMatrixMode(GL2ES1.GL_PROJECTION); @@ -254,7 +255,7 @@ public class OlympicES1 implements GLEventListener for (i = 0; i < RINGS; i++) { gl.glColor4ub(rgb_colors[i][0], rgb_colors[i][1], rgb_colors[i][2], (byte)1); gl.glPushMatrix(); - gl.glTranslatef(dests[i][0] + offsets[i][0], + gl.glTranslatef(dests[i][0] + offsets[i][0], dests[i][1] + offsets[i][1], dests[i][2] + offsets[i][2]); gl.glRotatef(angs[i], rotAxis[i][0], rotAxis[i][1], rotAxis[i][2]); @@ -267,7 +268,7 @@ public class OlympicES1 implements GLEventListener long t0, tL; - protected void animationCalc() + protected void animationCalc() { int i, j; |