diff options
Diffstat (limited to 'src/test/com/jogamp/opengl/test/bugs/Issue344Base.java')
-rw-r--r-- | src/test/com/jogamp/opengl/test/bugs/Issue344Base.java | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java index 2a7afabff..7692a30b7 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java @@ -6,11 +6,14 @@ import java.awt.Frame; import java.awt.event.*; import java.awt.geom.*; +import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.awt.GLCanvas; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.*; + import com.jogamp.opengl.util.awt.TextRenderer; /** Test Code adapted from TextCube.java (in JOGL demos) @@ -35,17 +38,17 @@ public abstract class Issue344Base implements GLEventListener protected abstract String getText(); - protected void run(String[] args) { + protected void run(final String[] args) { final Frame frame = new Frame(getClass().getName()); frame.setLayout(new BorderLayout()); - GLCanvas canvas = new GLCanvas(); + final GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(this); frame.add(canvas, BorderLayout.CENTER); frame.setSize(512, 512); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { new Thread(new Runnable() { public void run() { System.exit(0); @@ -58,57 +61,57 @@ public abstract class Issue344Base implements GLEventListener public void run() { frame.setVisible(true); } } ); - } catch(Exception ex) { + } catch(final Exception ex) { throw new RuntimeException(ex); } } - public void init(GLAutoDrawable drawable) + public void init(final GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + final GL2 gl = drawable.getGL().getGL2(); - gl.glEnable(GL2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); renderer = new TextRenderer(font, useMipMaps); - Rectangle2D bounds = renderer.getBounds(getText()); - float w = (float) bounds.getWidth(); - float h = (float) bounds.getHeight(); + final Rectangle2D bounds = renderer.getBounds(getText()); + final float w = (float) bounds.getWidth(); + final float h = (float) bounds.getHeight(); textScaleFactor = 2.0f / (w * 1.1f); gl.setSwapInterval(0); } - public void display(GLAutoDrawable drawable) + public void display(final GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); - gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); + final GL2 gl = drawable.getGL().getGL2(); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); glu.gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0); renderer.begin3DRendering(); - Rectangle2D bounds = renderer.getBounds(getText()); - float w = (float) bounds.getWidth(); - float h = (float) bounds.getHeight(); + final Rectangle2D bounds = renderer.getBounds(getText()); + final float w = (float) bounds.getWidth(); + final float h = (float) bounds.getHeight(); renderer.draw3D(getText(), w / -2.0f * textScaleFactor, h / -2.0f * textScaleFactor, 3f, textScaleFactor); - + renderer.end3DRendering(); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { - GL2 gl = drawable.getGL().getGL2(); - gl.glMatrixMode(GL2.GL_PROJECTION); + final GL2 gl = drawable.getGL().getGL2(); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(15, (float) width / (float) height, 5, 15); } - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} } |