aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl/test/bugs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp/opengl/test/bugs')
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java33
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java246
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java250
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java128
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java90
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java78
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java18
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java48
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java37
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue344Base.java47
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue344Test1.java4
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue344Test2.java2
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue344Test3.java2
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue344Test4.java2
14 files changed, 498 insertions, 487 deletions
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java b/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java
index 66889e9ed..9136b4e61 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java
@@ -1,9 +1,12 @@
package com.jogamp.opengl.test.bugs;
import javax.swing.*;
+
import java.awt.*;
+
import javax.media.opengl.*;
import javax.media.opengl.awt.*;
+import javax.media.opengl.fixedfunc.GLMatrixFunc;
public class Bug427GLJPanelTest1 extends JFrame implements GLEventListener {
@@ -20,35 +23,35 @@ public class Bug427GLJPanelTest1 extends JFrame implements GLEventListener {
setLocation(40, 40);
setVisible(true);
} } );
- } catch(Exception ex) {
+ } catch(final Exception ex) {
throw new RuntimeException(ex);
}
- GLProfile glp = GLProfile.get(GLProfile.GL2);
- GLCapabilities caps = new GLCapabilities(glp);
+ final GLProfile glp = GLProfile.get(GLProfile.GL2);
+ final GLCapabilities caps = new GLCapabilities(glp);
caps.setDoubleBuffered(true);
caps.setHardwareAccelerated(true);
- GLJPanel panel = new GLJPanel(caps);
+ final GLJPanel panel = new GLJPanel(caps);
panel.addGLEventListener(this);
add(panel, BorderLayout.CENTER);
}
- public static void main(String[] args) {
+ public static void main(final String[] args) {
final Bug427GLJPanelTest1 demo = new Bug427GLJPanelTest1();
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
demo.setVisible(true);
} } );
- } catch(Exception ex) {
+ } catch(final Exception ex) {
throw new RuntimeException(ex);
}
}
- public void display(GLAutoDrawable drawable) {
- GL2 gl = drawable.getGL().getGL2();
+ public void display(final GLAutoDrawable drawable) {
+ final GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glBegin(GL.GL_TRIANGLES);
@@ -66,21 +69,21 @@ public class Bug427GLJPanelTest1 extends JFrame implements GLEventListener {
gl.glFlush();
}
- public void init(GLAutoDrawable drawable) {
- GL2 gl = drawable.getGL().getGL2();
+ public void init(final GLAutoDrawable drawable) {
+ final GL2 gl = drawable.getGL().getGL2();
gl.glClearColor(0, 0, 0, 0);
- gl.glMatrixMode(GL2.GL_PROJECTION);
+ gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(0, 1, 0, 1, -1, 1);
}
- public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) {
+ public void reshape(final GLAutoDrawable glDrawable, final int x, final int y, final int w, final int h) {
}
- public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
+ public void displayChanged(final GLAutoDrawable drawable, final boolean modeChanged, final boolean deviceChanged) {
}
-
- public void dispose(GLAutoDrawable drawable) {
+
+ public void dispose(final GLAutoDrawable drawable) {
}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
index f443459c3..7b8313b7f 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
@@ -49,15 +49,15 @@ import com.jogamp.opengl.util.glsl.ShaderState;
public class Bug735Inv0AppletAWT extends Applet implements Runnable {
static public int AWT = 0;
static public int NEWT = 1;
-
+
static public int APPLET_WIDTH = 500;
static public int APPLET_HEIGHT = 290;
static public int TARGET_FPS = 120;
static public int TOOLKIT = NEWT;
static public boolean MANUAL_FRAME_HANDLING = true;
-
+
//////////////////////////////////////////////////////////////////////////////
-
+
static private Frame frame;
static private Bug735Inv0AppletAWT applet;
private GLCanvas awtCanvas;
@@ -66,52 +66,52 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
private DrawRunnable drawRunnable;
private GLContext context;
private GLU glu;
-
+
private int width;
private int height;
private Thread thread;
-
+
private boolean doneInit = false;
private boolean doneSetup = false;
-
- private long frameRatePeriod = 1000000000L / TARGET_FPS;
+
+ private final long frameRatePeriod = 1000000000L / TARGET_FPS;
private long millisOffset;
private int frameCount;
private float frameRate;
-
+
private ShaderCode vertShader;
private ShaderCode fragShader;
private ShaderProgram shaderProg;
private ShaderState shaderState;
private GLUniformData resolution;
- private GLUniformData time;
- private GLArrayDataServer vertices;
-
- private int fcount = 0, lastm = 0;
- private int fint = 1;
-
+ private GLUniformData time;
+ private GLArrayDataServer vertices;
+
+ private int fcount = 0, lastm = 0;
+ private final int fint = 1;
+
public void init() {
setSize(APPLET_WIDTH, APPLET_HEIGHT);
setPreferredSize(new Dimension(APPLET_WIDTH, APPLET_HEIGHT));
width = APPLET_WIDTH;
height = APPLET_HEIGHT;
}
-
+
public void start() {
thread = new Thread(this, "Animation Thread");
- thread.start();
+ thread.start();
}
-
- public void run() {
+
+ public void run() {
int noDelays = 0;
// Number of frames with a delay of 0 ms before the
// animation thread yields to other running threads.
final int NO_DELAYS_PER_YIELD = 15;
final int TIMEOUT_SECONDS = 2;
-
+
long beforeTime = System.nanoTime();
long overSleepTime = 0L;
-
+
millisOffset = System.currentTimeMillis();
frameCount = 1;
while (Thread.currentThread() == thread) {
@@ -119,26 +119,26 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
requestDraw(latch);
try {
latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
-
+
if (frameCount == 1) {
EventQueue.invokeLater(new Runnable() {
public void run() {
requestFocusInWindow();
}
});
- }
-
- long afterTime = System.nanoTime();
- long timeDiff = afterTime - beforeTime;
- long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
+ }
+
+ final long afterTime = System.nanoTime();
+ final long timeDiff = afterTime - beforeTime;
+ final long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
if (sleepTime > 0) { // some time left in this cycle
try {
Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L));
noDelays = 0; // Got some sleep, not delaying anymore
- } catch (InterruptedException ex) { }
+ } catch (final InterruptedException ex) { }
overSleepTime = (System.nanoTime() - afterTime) - sleepTime;
} else { // sleepTime <= 0; the frame took longer than the period
overSleepTime = 0L;
@@ -147,54 +147,54 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
Thread.yield(); // give another thread a chance to run
noDelays = 0;
}
- }
+ }
beforeTime = System.nanoTime();
}
}
-
- public void requestDraw(CountDownLatch latch) {
+
+ public void requestDraw(final CountDownLatch latch) {
if (!doneInit) {
initDraw();
}
-
- if (TOOLKIT == AWT) {
- awtCanvas.invoke(true, drawRunnable);
- } else if (TOOLKIT == NEWT) {
- newtWindow.invoke(true, drawRunnable);
+
+ if (TOOLKIT == AWT) {
+ awtCanvas.invoke(true, drawRunnable);
+ } else if (TOOLKIT == NEWT) {
+ newtWindow.invoke(true, drawRunnable);
}
-
+
if (latch != null) {
latch.countDown();
- }
+ }
}
-
+
private class DrawRunnable implements GLRunnable {
private boolean notCurrent;
-
+
@Override
- public boolean run(GLAutoDrawable drawable) {
+ public boolean run(final GLAutoDrawable drawable) {
if (MANUAL_FRAME_HANDLING) {
- makeContextCurrent();
+ makeContextCurrent();
}
-
+
if (doneSetup) {
draw(drawable.getGL().getGL2ES2());
} else {
setup(drawable.getGL().getGL2ES2());
- }
+ }
checkGLErrors(drawable.getGL());
-
+
if (MANUAL_FRAME_HANDLING) {
swapBuffers();
releaseCurrentContext();
}
-
+
return true;
}
-
+
private void makeContextCurrent() {
- int MAX_CONTEXT_GRAB_ATTEMPTS = 10;
-
+ final int MAX_CONTEXT_GRAB_ATTEMPTS = 10;
+
if (context.isCurrent()) {
notCurrent = false;
} else {
@@ -218,17 +218,17 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
} catch (final InterruptedException e) {
e.printStackTrace();
}
-
+
} while (value == GLContext.CONTEXT_NOT_CURRENT);
- }
+ }
}
-
+
private void swapBuffers() {
final GL gl = GLContext.getCurrentGL();
gl.glFlush();
- GLContext.getCurrent().getGLDrawable().swapBuffers();
+ GLContext.getCurrent().getGLDrawable().swapBuffers();
}
-
+
private void releaseCurrentContext() {
if (notCurrent) {
try {
@@ -237,31 +237,31 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
} catch (final GLException gle) {
gle.printStackTrace();
}
- }
+ }
}
}
-
+
private void initGL() {
- GLProfile profile = GLProfile.getDefault();
- GLCapabilities caps = new GLCapabilities(profile);
+ final GLProfile profile = GLProfile.getDefault();
+ final GLCapabilities caps = new GLCapabilities(profile);
caps.setBackgroundOpaque(true);
caps.setOnscreen(true);
caps.setSampleBuffers(false);
-
+
if (TOOLKIT == AWT) {
awtCanvas = new GLCanvas(caps);
awtCanvas.setBounds(0, 0, applet.width, applet.height);
awtCanvas.setBackground(new Color(0xFFCCCCCC, true));
- awtCanvas.setFocusable(true);
-
+ awtCanvas.setFocusable(true);
+
applet.setLayout(new BorderLayout());
applet.add(awtCanvas, BorderLayout.CENTER);
-
+
if (MANUAL_FRAME_HANDLING) {
awtCanvas.setIgnoreRepaint(true);
- awtCanvas.setAutoSwapBufferMode(false);
+ awtCanvas.setAutoSwapBufferMode(false);
}
- } else if (TOOLKIT == NEWT) {
+ } else if (TOOLKIT == NEWT) {
newtWindow = GLWindow.create(caps);
newtCanvas = new NewtCanvasAWT(newtWindow);
newtCanvas.setBounds(0, 0, applet.width, applet.height);
@@ -270,14 +270,14 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
applet.setLayout(new BorderLayout());
applet.add(newtCanvas, BorderLayout.CENTER);
-
+
if (MANUAL_FRAME_HANDLING) {
newtCanvas.setIgnoreRepaint(true);
- newtWindow.setAutoSwapBufferMode(false);
+ newtWindow.setAutoSwapBufferMode(false);
}
}
}
-
+
private void initDraw() {
if (TOOLKIT == AWT) {
awtCanvas.setVisible(true);
@@ -287,7 +287,7 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
// Request the focus here as it cannot work when the window is not visible
awtCanvas.requestFocus();
context = awtCanvas.getContext();
- }
+ }
} else if (TOOLKIT == NEWT) {
newtCanvas.setVisible(true);
// Force the realization
@@ -298,37 +298,37 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
context = newtWindow.getContext();
}
}
-
+
drawRunnable = new DrawRunnable();
-
+
doneInit = true;
}
-
- private void setup(GL2ES2 gl) {
+
+ private void setup(final GL2ES2 gl) {
if (60 < TARGET_FPS) {
// Disables vsync
- gl.setSwapInterval(0);
+ gl.setSwapInterval(0);
}
glu = new GLU();
-
+
vertShader = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, LandscapeES2.class, "shader", "shader/bin", "landscape", true);
fragShader = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, LandscapeES2.class, "shader", "shader/bin", "landscape", true);
vertShader.defaultShaderCustomization(gl, true, true);
fragShader.defaultShaderCustomization(gl, true, true);
shaderProg = new ShaderProgram();
shaderProg.add(gl, vertShader, System.err);
- shaderProg.add(gl, fragShader, System.err);
-
+ shaderProg.add(gl, fragShader, System.err);
+
shaderState = new ShaderState();
shaderState.attachShaderProgram(gl, shaderProg, true);
-
+
resolution = new GLUniformData("iResolution", 3, FloatBuffer.wrap(new float[] {width, height, 0}));
shaderState.ownUniform(resolution);
- shaderState.uniform(gl, resolution);
-
+ shaderState.uniform(gl, resolution);
+
time = new GLUniformData("iGlobalTime", 0.0f);
shaderState.ownUniform(time);
-
+
vertices = GLArrayDataServer.createGLSL("inVertex", 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
vertices.putf(-1.0f); vertices.putf(-1.0f);
vertices.putf(+1.0f); vertices.putf(-1.0f);
@@ -337,94 +337,94 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
vertices.seal(gl, true);
shaderState.ownAttribute(vertices, true);
shaderState.useProgram(gl, false);
-
+
doneSetup = true;
}
- private void draw(GL2ES2 gl) {
+ private void draw(final GL2ES2 gl) {
// gl.glClearColor(0.5f, 0.1f, 0.1f, 1);
// gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT);
-
- shaderState.useProgram(gl, true);
-
+
+ shaderState.useProgram(gl, true);
+
time.setData((System.currentTimeMillis() - millisOffset) / 1000.0f);
shaderState.uniform(gl, time);
vertices.enableBuffer(gl, true);
- gl.glDrawArrays(GL2ES2.GL_TRIANGLE_STRIP, 0, 4);
+ gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
vertices.enableBuffer(gl, false);
-
+
shaderState.useProgram(gl, false);
-
+
// Compute current framerate and printout.
- frameCount++;
+ frameCount++;
fcount += 1;
- int m = (int) (System.currentTimeMillis() - millisOffset);
+ final int m = (int) (System.currentTimeMillis() - millisOffset);
if (m - lastm > 1000 * fint) {
frameRate = (float)(fcount) / fint;
fcount = 0;
lastm = m;
- }
+ }
if (frameCount % TARGET_FPS == 0) {
- System.out.println("FrameCount: " + frameCount + " - " +
+ System.out.println("FrameCount: " + frameCount + " - " +
"FrameRate: " + frameRate);
- }
- }
-
- private void checkGLErrors(GL gl) {
- int err = gl.glGetError();
+ }
+ }
+
+ private void checkGLErrors(final GL gl) {
+ final int err = gl.glGetError();
if (err != 0) {
- String errString = glu.gluErrorString(err);
+ final String errString = glu.gluErrorString(err);
System.out.println(errString);
- }
+ }
}
-
- static public void main(String[] args) {
- GraphicsEnvironment environment =
+
+ static public void main(final String[] args) {
+ final GraphicsEnvironment environment =
GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
+ final GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
frame = new Frame(displayDevice.getDefaultConfiguration());
frame.setBackground(new Color(0xCC, 0xCC, 0xCC));
frame.setTitle("TestBug735Inv0AppletAWT");
-
+
try {
- Class<?> c = Thread.currentThread().getContextClassLoader().
+ final Class<?> c = Thread.currentThread().getContextClassLoader().
loadClass(Bug735Inv0AppletAWT.class.getName());
applet = (Bug735Inv0AppletAWT) c.newInstance();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
- }
-
+ }
+
frame.setLayout(null);
frame.add(applet);
frame.pack();
frame.setResizable(false);
-
+
applet.init();
-
- Insets insets = frame.getInsets();
- int windowW = applet.width + insets.left + insets.right;
- int windowH = applet.height + insets.top + insets.bottom;
- frame.setSize(windowW, windowH);
-
- Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
+
+ final Insets insets = frame.getInsets();
+ final int windowW = applet.width + insets.left + insets.right;
+ final int windowH = applet.height + insets.top + insets.bottom;
+ frame.setSize(windowW, windowH);
+
+ final Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
frame.setLocation(screenRect.x + (screenRect.width - applet.width) / 2,
- screenRect.y + (screenRect.height - applet.height) / 2);
-
- int usableWindowH = windowH - insets.top - insets.bottom;
+ screenRect.y + (screenRect.height - applet.height) / 2);
+
+ final int usableWindowH = windowH - insets.top - insets.bottom;
applet.setBounds((windowW - applet.width)/2,
insets.top + (usableWindowH - applet.height)/2,
applet.width, applet.height);
-
+
// This allows to close the frame.
frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
+ public void windowClosing(final WindowEvent e) {
System.exit(0);
}
});
-
+
applet.initGL();
frame.setVisible(true);
- applet.start();
+ applet.start();
}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
index e8cef5e16..377f5e7ef 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
@@ -51,15 +51,15 @@ import com.jogamp.opengl.util.glsl.ShaderState;
public class Bug735Inv1AppletAWT extends Applet implements Runnable {
static public int AWT = 0;
static public int NEWT = 1;
-
+
static public int APPLET_WIDTH = 500;
static public int APPLET_HEIGHT = 290;
static public int TARGET_FPS = 120;
static public int TOOLKIT = NEWT;
static public boolean MANUAL_FRAME_HANDLING = true;
-
+
//////////////////////////////////////////////////////////////////////////////
-
+
static private Frame frame;
static private Bug735Inv1AppletAWT applet;
private GLCanvas awtCanvas;
@@ -68,52 +68,52 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
private DrawRunnable drawRunnable;
// JAU private GLContext context;
private GLU glu;
-
+
private int width;
private int height;
private Thread thread;
-
+
private boolean doneInit = false;
private boolean doneSetup = false;
-
- private long frameRatePeriod = 1000000000L / TARGET_FPS;
+
+ private final long frameRatePeriod = 1000000000L / TARGET_FPS;
private long millisOffset;
private int frameCount;
private float frameRate;
-
+
private ShaderCode vertShader;
private ShaderCode fragShader;
private ShaderProgram shaderProg;
private ShaderState shaderState;
private GLUniformData resolution;
- private GLUniformData time;
- private GLArrayDataServer vertices;
-
- private int fcount = 0, lastm = 0;
- private int fint = 1;
-
+ private GLUniformData time;
+ private GLArrayDataServer vertices;
+
+ private int fcount = 0, lastm = 0;
+ private final int fint = 1;
+
public void init() {
setSize(APPLET_WIDTH, APPLET_HEIGHT);
setPreferredSize(new Dimension(APPLET_WIDTH, APPLET_HEIGHT));
width = APPLET_WIDTH;
height = APPLET_HEIGHT;
}
-
+
public void start() {
thread = new Thread(this, "Animation Thread");
- thread.start();
+ thread.start();
}
-
- public void run() {
+
+ public void run() {
int noDelays = 0;
// Number of frames with a delay of 0 ms before the
// animation thread yields to other running threads.
final int NO_DELAYS_PER_YIELD = 15;
final int TIMEOUT_SECONDS = 2;
-
+
long beforeTime = System.nanoTime();
long overSleepTime = 0L;
-
+
millisOffset = System.currentTimeMillis();
frameCount = 1;
while (Thread.currentThread() == thread) {
@@ -121,26 +121,26 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
requestDraw(latch);
try {
latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
-
+
if (frameCount == 1) {
EventQueue.invokeLater(new Runnable() {
public void run() {
requestFocusInWindow();
}
});
- }
-
- long afterTime = System.nanoTime();
- long timeDiff = afterTime - beforeTime;
- long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
+ }
+
+ final long afterTime = System.nanoTime();
+ final long timeDiff = afterTime - beforeTime;
+ final long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
if (sleepTime > 0) { // some time left in this cycle
try {
Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L));
noDelays = 0; // Got some sleep, not delaying anymore
- } catch (InterruptedException ex) { }
+ } catch (final InterruptedException ex) { }
overSleepTime = (System.nanoTime() - afterTime) - sleepTime;
} else { // sleepTime <= 0; the frame took longer than the period
overSleepTime = 0L;
@@ -149,53 +149,53 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
Thread.yield(); // give another thread a chance to run
noDelays = 0;
}
- }
+ }
beforeTime = System.nanoTime();
}
}
-
- public void requestDraw(CountDownLatch latch) {
+
+ public void requestDraw(final CountDownLatch latch) {
if (!doneInit) {
initDraw();
}
-
- if (TOOLKIT == AWT) {
- awtCanvas.invoke(true, drawRunnable);
- } else if (TOOLKIT == NEWT) {
- newtWindow.invoke(true, drawRunnable);
+
+ if (TOOLKIT == AWT) {
+ awtCanvas.invoke(true, drawRunnable);
+ } else if (TOOLKIT == NEWT) {
+ newtWindow.invoke(true, drawRunnable);
}
-
+
if (latch != null) {
latch.countDown();
- }
+ }
}
-
+
private class DrawRunnable implements GLRunnable {
private boolean notCurrent;
-
+
@Override
- public boolean run(GLAutoDrawable drawable) {
+ public boolean run(final GLAutoDrawable drawable) {
if (MANUAL_FRAME_HANDLING) {
- makeContextCurrent(drawable.getContext());
+ makeContextCurrent(drawable.getContext());
}
-
+
if (!doneSetup) {
setup(drawable.getGL().getGL2ES2());
}
draw(drawable.getGL().getGL2ES2());
checkGLErrors(drawable.getGL());
-
+
if (MANUAL_FRAME_HANDLING) {
swapBuffers(drawable.getContext());
releaseCurrentContext(drawable.getContext());
}
-
+
return true;
}
-
- private void makeContextCurrent(GLContext context) {
- int MAX_CONTEXT_GRAB_ATTEMPTS = 10;
-
+
+ private void makeContextCurrent(final GLContext context) {
+ final int MAX_CONTEXT_GRAB_ATTEMPTS = 10;
+
if (context.isCurrent()) {
notCurrent = false;
} else {
@@ -219,18 +219,18 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
} catch (final InterruptedException e) {
e.printStackTrace();
}
-
+
} while (value == GLContext.CONTEXT_NOT_CURRENT);
- }
+ }
}
-
- private void swapBuffers(GLContext context) {
+
+ private void swapBuffers(final GLContext context) {
final GL gl = context.getGL();
gl.glFlush();
- context.getGLDrawable().swapBuffers();
+ context.getGLDrawable().swapBuffers();
}
-
- private void releaseCurrentContext(GLContext context) {
+
+ private void releaseCurrentContext(final GLContext context) {
if (notCurrent) {
try {
context.release();
@@ -238,31 +238,31 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
} catch (final GLException gle) {
gle.printStackTrace();
}
- }
+ }
}
}
-
+
private void initGL() {
- GLProfile profile = GLProfile.getDefault();
- GLCapabilities caps = new GLCapabilities(profile);
+ final GLProfile profile = GLProfile.getDefault();
+ final GLCapabilities caps = new GLCapabilities(profile);
caps.setBackgroundOpaque(true);
caps.setOnscreen(true);
caps.setSampleBuffers(false);
-
+
if (TOOLKIT == AWT) {
awtCanvas = new GLCanvas(caps);
awtCanvas.setBounds(0, 0, applet.width, applet.height);
awtCanvas.setBackground(new Color(0xFFCCCCCC, true));
- awtCanvas.setFocusable(true);
-
+ awtCanvas.setFocusable(true);
+
applet.setLayout(new BorderLayout());
applet.add(awtCanvas, BorderLayout.CENTER);
-
+
if (MANUAL_FRAME_HANDLING) {
awtCanvas.setIgnoreRepaint(true);
- awtCanvas.setAutoSwapBufferMode(false);
+ awtCanvas.setAutoSwapBufferMode(false);
}
- } else if (TOOLKIT == NEWT) {
+ } else if (TOOLKIT == NEWT) {
newtWindow = GLWindow.create(caps);
newtCanvas = new NewtCanvasAWT(newtWindow);
newtCanvas.setBounds(0, 0, applet.width, applet.height);
@@ -271,14 +271,14 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
applet.setLayout(new BorderLayout());
applet.add(newtCanvas, BorderLayout.CENTER);
-
+
if (MANUAL_FRAME_HANDLING) {
newtCanvas.setIgnoreRepaint(true);
- newtWindow.setAutoSwapBufferMode(false);
+ newtWindow.setAutoSwapBufferMode(false);
}
}
}
-
+
private void initDraw() {
if (TOOLKIT == AWT) {
awtCanvas.setVisible(true);
@@ -287,7 +287,7 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
if (awtCanvas.getDelegatedDrawable().isRealized()) {
// Request the focus here as it cannot work when the window is not visible
awtCanvas.requestFocus();
- }
+ }
} else if (TOOLKIT == NEWT) {
newtCanvas.setVisible(true);
// Force the realization
@@ -297,37 +297,37 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
newtCanvas.requestFocus();
}
}
-
+
drawRunnable = new DrawRunnable();
-
+
doneInit = true;
}
-
- private void setup(GL2ES2 gl) {
+
+ private void setup(final GL2ES2 gl) {
if (60 < TARGET_FPS) {
// Disables vsync
- gl.setSwapInterval(0);
- }
+ gl.setSwapInterval(0);
+ }
glu = new GLU();
-
+
vertShader = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, LandscapeES2.class, "shader", "shader/bin", "landscape", true);
fragShader = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, LandscapeES2.class, "shader", "shader/bin", "landscape", true);
vertShader.defaultShaderCustomization(gl, true, true);
fragShader.defaultShaderCustomization(gl, true, true);
shaderProg = new ShaderProgram();
shaderProg.add(gl, vertShader, System.err);
- shaderProg.add(gl, fragShader, System.err);
-
+ shaderProg.add(gl, fragShader, System.err);
+
shaderState = new ShaderState();
shaderState.attachShaderProgram(gl, shaderProg, true);
-
+
resolution = new GLUniformData("iResolution", 3, FloatBuffer.wrap(new float[] {width, height, 0}));
shaderState.ownUniform(resolution);
- shaderState.uniform(gl, resolution);
-
+ shaderState.uniform(gl, resolution);
+
time = new GLUniformData("iGlobalTime", 0.0f);
shaderState.ownUniform(time);
-
+
vertices = GLArrayDataServer.createGLSL("inVertex", 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
vertices.putf(-1.0f); vertices.putf(-1.0f);
vertices.putf(+1.0f); vertices.putf(-1.0f);
@@ -336,94 +336,94 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
vertices.seal(gl, true);
shaderState.ownAttribute(vertices, true);
shaderState.useProgram(gl, false);
-
+
doneSetup = true;
}
- private void draw(GL2ES2 gl) {
+ private void draw(final GL2ES2 gl) {
// gl.glClearColor(0.5f, 0.1f, 0.1f, 1);
// gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT);
-
- shaderState.useProgram(gl, true);
-
+
+ shaderState.useProgram(gl, true);
+
time.setData((System.currentTimeMillis() - millisOffset) / 1000.0f);
shaderState.uniform(gl, time);
vertices.enableBuffer(gl, true);
- gl.glDrawArrays(GL2ES2.GL_TRIANGLE_STRIP, 0, 4);
+ gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
vertices.enableBuffer(gl, false);
-
+
shaderState.useProgram(gl, false);
-
+
// Compute current framerate and printout.
- frameCount++;
+ frameCount++;
fcount += 1;
- int m = (int) (System.currentTimeMillis() - millisOffset);
+ final int m = (int) (System.currentTimeMillis() - millisOffset);
if (m - lastm > 1000 * fint) {
frameRate = (float)(fcount) / fint;
fcount = 0;
lastm = m;
- }
+ }
if (frameCount % TARGET_FPS == 0) {
- System.out.println("FrameCount: " + frameCount + " - " +
+ System.out.println("FrameCount: " + frameCount + " - " +
"FrameRate: " + frameRate);
}
- }
-
- private void checkGLErrors(GL gl) {
- int err = gl.glGetError();
+ }
+
+ private void checkGLErrors(final GL gl) {
+ final int err = gl.glGetError();
if (err != 0) {
- String errString = glu.gluErrorString(err);
+ final String errString = glu.gluErrorString(err);
System.out.println(errString);
- }
+ }
}
-
- static public void main(String[] args) {
- GraphicsEnvironment environment =
+
+ static public void main(final String[] args) {
+ final GraphicsEnvironment environment =
GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
+ final GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
frame = new Frame(displayDevice.getDefaultConfiguration());
frame.setBackground(new Color(0xCC, 0xCC, 0xCC));
frame.setTitle("TestBug735Inv1AppletAWT");
-
+
try {
- Class<?> c = Thread.currentThread().getContextClassLoader().
+ final Class<?> c = Thread.currentThread().getContextClassLoader().
loadClass(Bug735Inv1AppletAWT.class.getName());
applet = (Bug735Inv1AppletAWT) c.newInstance();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
- }
-
+ }
+
frame.setLayout(null);
frame.add(applet);
frame.pack();
frame.setResizable(false);
-
+
applet.init();
-
- Insets insets = frame.getInsets();
- int windowW = applet.width + insets.left + insets.right;
- int windowH = applet.height + insets.top + insets.bottom;
- frame.setSize(windowW, windowH);
-
- Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
+
+ final Insets insets = frame.getInsets();
+ final int windowW = applet.width + insets.left + insets.right;
+ final int windowH = applet.height + insets.top + insets.bottom;
+ frame.setSize(windowW, windowH);
+
+ final Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
frame.setLocation(screenRect.x + (screenRect.width - applet.width) / 2,
- screenRect.y + (screenRect.height - applet.height) / 2);
-
- int usableWindowH = windowH - insets.top - insets.bottom;
+ screenRect.y + (screenRect.height - applet.height) / 2);
+
+ final int usableWindowH = windowH - insets.top - insets.bottom;
applet.setBounds((windowW - applet.width)/2,
insets.top + (usableWindowH - applet.height)/2,
applet.width, applet.height);
-
+
// This allows to close the frame.
frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
+ public void windowClosing(final WindowEvent e) {
System.exit(0);
}
});
-
+
applet.initGL();
frame.setVisible(true);
- applet.start();
+ applet.start();
}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java
index 6340d2b64..109bb1a42 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java
@@ -33,7 +33,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* - Use GLEventListener
* - Add GLEventListener to GLAutoDrawable
* - Use GLAutoDrawable.display() instead of GLAutoDrawable.invoke(true, GLRunnable { init / render })
- * - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener
+ * - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener
* </pre>
* OSX Results:
* <pre>
@@ -45,7 +45,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
public class Bug735Inv2AppletAWT extends Applet implements Runnable {
static public int AWT = 0;
static public int NEWT = 1;
-
+
static public int APPLET_WIDTH = 500;
static public int APPLET_HEIGHT = 290;
static public int TARGET_FPS = 120;
@@ -53,10 +53,10 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
static public boolean IGNORE_AWT_REPAINT = false;
static public boolean USE_ECT = false;
static public int SWAP_INTERVAL = 1;
-
+
//////////////////////////////////////////////////////////////////////////////
-
- static boolean waitForKey = false;
+
+ static boolean waitForKey = false;
static private Frame frame;
static private Bug735Inv2AppletAWT applet;
private GLCanvas awtCanvas;
@@ -64,14 +64,14 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
private GLAutoDrawable glad;
private NewtCanvasAWT newtCanvas;
private GLEventListener demo;
-
+
private int width;
private int height;
private Thread thread;
-
- private long frameRatePeriod = 1000000000L / TARGET_FPS;
+
+ private final long frameRatePeriod = 1000000000L / TARGET_FPS;
private int frameCount;
-
+
public void init() {
setSize(APPLET_WIDTH, APPLET_HEIGHT);
setPreferredSize(new Dimension(APPLET_WIDTH, APPLET_HEIGHT));
@@ -79,23 +79,23 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
height = APPLET_HEIGHT;
initGL();
}
-
+
public void start() {
initDraw();
thread = new Thread(this, "Animation Thread");
- thread.start();
+ thread.start();
}
-
- public void run() {
+
+ public void run() {
int noDelays = 0;
// Number of frames with a delay of 0 ms before the
// animation thread yields to other running threads.
final int NO_DELAYS_PER_YIELD = 15;
final int TIMEOUT_SECONDS = 2;
-
+
long beforeTime = System.nanoTime();
long overSleepTime = 0L;
-
+
frameCount = 1;
while (Thread.currentThread() == thread) {
if (frameCount == 1) {
@@ -107,23 +107,23 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
if( USE_ECT ) {
glad.setExclusiveContextThread(thread);
}
- }
+ }
final CountDownLatch latch = new CountDownLatch(1);
requestDraw(latch);
try {
latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
e.printStackTrace();
}
-
- long afterTime = System.nanoTime();
- long timeDiff = afterTime - beforeTime;
- long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
+
+ final long afterTime = System.nanoTime();
+ final long timeDiff = afterTime - beforeTime;
+ final long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
if (sleepTime > 0) { // some time left in this cycle
try {
Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L));
noDelays = 0; // Got some sleep, not delaying anymore
- } catch (InterruptedException ex) { }
+ } catch (final InterruptedException ex) { }
overSleepTime = (System.nanoTime() - afterTime) - sleepTime;
} else { // sleepTime <= 0; the frame took longer than the period
overSleepTime = 0L;
@@ -132,40 +132,40 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
Thread.yield(); // give another thread a chance to run
noDelays = 0;
}
- }
+ }
beforeTime = System.nanoTime();
}
}
-
- public void requestDraw(CountDownLatch latch) {
+
+ public void requestDraw(final CountDownLatch latch) {
glad.display();
if (latch != null) {
latch.countDown();
- }
+ }
}
-
+
private void initGL() {
- GLProfile profile = GLProfile.getDefault();
- GLCapabilities caps = new GLCapabilities(profile);
+ final GLProfile profile = GLProfile.getDefault();
+ final GLCapabilities caps = new GLCapabilities(profile);
caps.setBackgroundOpaque(true);
caps.setOnscreen(true);
caps.setSampleBuffers(false);
-
+
if (TOOLKIT == AWT) {
awtCanvas = new GLCanvas(caps);
awtCanvas.setBounds(0, 0, applet.width, applet.height);
awtCanvas.setBackground(new Color(0xFFCCCCCC, true));
- awtCanvas.setFocusable(true);
-
+ awtCanvas.setFocusable(true);
+
applet.setLayout(new BorderLayout());
applet.add(awtCanvas, BorderLayout.CENTER);
-
+
if (IGNORE_AWT_REPAINT) {
awtCanvas.setIgnoreRepaint(true);
}
glad = awtCanvas;
- } else if (TOOLKIT == NEWT) {
+ } else if (TOOLKIT == NEWT) {
newtWindow = GLWindow.create(caps);
newtCanvas = new NewtCanvasAWT(newtWindow);
newtCanvas.setBounds(0, 0, applet.width, applet.height);
@@ -174,17 +174,17 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
applet.setLayout(new BorderLayout());
applet.add(newtCanvas, BorderLayout.CENTER);
-
+
if (IGNORE_AWT_REPAINT) {
newtCanvas.setIgnoreRepaint(true);
}
glad = newtWindow;
}
-
+
demo = new LandscapeES2(SWAP_INTERVAL);
glad.addGLEventListener(demo);
}
-
+
private void initDraw() {
if (TOOLKIT == AWT) {
awtCanvas.setVisible(true);
@@ -193,7 +193,7 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
if (awtCanvas.getDelegatedDrawable().isRealized()) {
// Request the focus here as it cannot work when the window is not visible
awtCanvas.requestFocus();
- }
+ }
} else if (TOOLKIT == NEWT) {
newtCanvas.setVisible(true);
// Force the realization
@@ -204,8 +204,8 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
}
}
}
-
- static public void main(String[] args) {
+
+ static public void main(final String[] args) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-vsync")) {
i++;
@@ -217,56 +217,56 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
}
}
System.err.println("swapInterval "+SWAP_INTERVAL);
- System.err.println("exclusiveContext "+USE_ECT);
+ System.err.println("exclusiveContext "+USE_ECT);
if(waitForKey) {
UITestCase.waitForKey("Start");
}
-
- GraphicsEnvironment environment =
+
+ final GraphicsEnvironment environment =
GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
+ final GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
frame = new Frame(displayDevice.getDefaultConfiguration());
frame.setBackground(new Color(0xCC, 0xCC, 0xCC));
frame.setTitle("TestBug735Inv2AppletAWT");
-
+
try {
- Class<?> c = Thread.currentThread().getContextClassLoader().
+ final Class<?> c = Thread.currentThread().getContextClassLoader().
loadClass(Bug735Inv2AppletAWT.class.getName());
applet = (Bug735Inv2AppletAWT) c.newInstance();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
- }
-
+ }
+
frame.setLayout(null);
frame.add(applet);
frame.pack();
frame.setResizable(false);
-
+
applet.init();
-
- Insets insets = frame.getInsets();
- int windowW = applet.width + insets.left + insets.right;
- int windowH = applet.height + insets.top + insets.bottom;
- frame.setSize(windowW, windowH);
-
- Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
+
+ final Insets insets = frame.getInsets();
+ final int windowW = applet.width + insets.left + insets.right;
+ final int windowH = applet.height + insets.top + insets.bottom;
+ frame.setSize(windowW, windowH);
+
+ final Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
frame.setLocation(screenRect.x + (screenRect.width - applet.width) / 2,
- screenRect.y + (screenRect.height - applet.height) / 2);
-
- int usableWindowH = windowH - insets.top - insets.bottom;
+ screenRect.y + (screenRect.height - applet.height) / 2);
+
+ final int usableWindowH = windowH - insets.top - insets.bottom;
applet.setBounds((windowW - applet.width)/2,
insets.top + (usableWindowH - applet.height)/2,
applet.width, applet.height);
-
+
// This allows to close the frame.
frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
+ public void windowClosing(final WindowEvent e) {
System.exit(0);
}
});
-
+
frame.setVisible(true);
- applet.start();
+ applet.start();
}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java
index 0a4c54046..883a40345 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java
@@ -32,7 +32,7 @@ import com.jogamp.opengl.util.AnimatorBase;
* - Use GLEventListener
* - Add GLEventListener to GLAutoDrawable
* - Use GLAutoDrawable.display() instead of GLAutoDrawable.invoke(true, GLRunnable { init / render })
- * - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener
+ * - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener
* - Use Animator
* - Remove applet, component sizes, use frame based size via validate
* - Run frame validation/visibility on AWT-EDT
@@ -48,17 +48,17 @@ import com.jogamp.opengl.util.AnimatorBase;
public class Bug735Inv3AppletAWT extends Applet {
static public int AWT = 0;
static public int NEWT = 1;
-
+
static public int APPLET_WIDTH = 500;
static public int APPLET_HEIGHT = 290;
static public int TOOLKIT = NEWT;
static public boolean IGNORE_AWT_REPAINT = false;
static public boolean USE_ECT = false;
static public int SWAP_INTERVAL = 1;
-
+
//////////////////////////////////////////////////////////////////////////////
-
- static boolean waitForKey = false;
+
+ static boolean waitForKey = false;
static private Frame frame;
static private Bug735Inv3AppletAWT applet;
private GLCanvas awtCanvas;
@@ -67,10 +67,10 @@ public class Bug735Inv3AppletAWT extends Applet {
private NewtCanvasAWT newtCanvas;
private GLEventListener demo;
private AnimatorBase animator;
-
+
private int width;
private int height;
-
+
public void init() {
setSize(APPLET_WIDTH, APPLET_HEIGHT);
// JAU setPreferredSize(new Dimension(APPLET_WIDTH, APPLET_HEIGHT));
@@ -78,34 +78,34 @@ public class Bug735Inv3AppletAWT extends Applet {
height = APPLET_HEIGHT;
initGL();
}
-
+
public void start() {
initDraw();
animator.start();
animator.setUpdateFPSFrames(60, System.err);
}
-
+
private void initGL() {
- GLProfile profile = GLProfile.getDefault();
- GLCapabilities caps = new GLCapabilities(profile);
+ final GLProfile profile = GLProfile.getDefault();
+ final GLCapabilities caps = new GLCapabilities(profile);
caps.setBackgroundOpaque(true);
caps.setOnscreen(true);
caps.setSampleBuffers(false);
-
+
if (TOOLKIT == AWT) {
awtCanvas = new GLCanvas(caps);
// JAU awtCanvas.setBounds(0, 0, applet.width, applet.height);
awtCanvas.setBackground(new Color(0xFFCCCCCC, true));
- awtCanvas.setFocusable(true);
-
+ awtCanvas.setFocusable(true);
+
applet.setLayout(new BorderLayout());
applet.add(awtCanvas, BorderLayout.CENTER);
-
+
if (IGNORE_AWT_REPAINT) {
awtCanvas.setIgnoreRepaint(true);
}
glad = awtCanvas;
- } else if (TOOLKIT == NEWT) {
+ } else if (TOOLKIT == NEWT) {
newtWindow = GLWindow.create(caps);
newtCanvas = new NewtCanvasAWT(newtWindow);
// JAU newtCanvas.setBounds(0, 0, applet.width, applet.height);
@@ -114,27 +114,27 @@ public class Bug735Inv3AppletAWT extends Applet {
applet.setLayout(new BorderLayout());
applet.add(newtCanvas, BorderLayout.CENTER);
-
+
if (IGNORE_AWT_REPAINT) {
newtCanvas.setIgnoreRepaint(true);
}
glad = newtWindow;
}
-
+
demo = new LandscapeES2(SWAP_INTERVAL);
// demo = new GearsES2(SWAP_INTERVAL);
glad.addGLEventListener(demo);
animator = new Animator(glad);
animator.setExclusiveContext(USE_ECT);
}
-
+
private void initDraw() {
if (TOOLKIT == AWT) {
// JAU awtCanvas.setVisible(true);
if (awtCanvas.getDelegatedDrawable().isRealized()) {
// Request the focus here as it cannot work when the window is not visible
awtCanvas.requestFocus();
- }
+ }
} else if (TOOLKIT == NEWT) {
// JAU newtCanvas.setVisible(true);
// Force the realization
@@ -143,10 +143,10 @@ public class Bug735Inv3AppletAWT extends Applet {
// Request the focus here as it cannot work when the window is not visible
newtCanvas.requestFocus();
}
- }
+ }
}
-
- static public void main(String[] args) {
+
+ static public void main(final String[] args) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-vsync")) {
i++;
@@ -158,61 +158,61 @@ public class Bug735Inv3AppletAWT extends Applet {
}
}
System.err.println("swapInterval "+SWAP_INTERVAL);
- System.err.println("exclusiveContext "+USE_ECT);
+ System.err.println("exclusiveContext "+USE_ECT);
if(waitForKey) {
UITestCase.waitForKey("Start");
}
-
- final GraphicsEnvironment environment =
+
+ final GraphicsEnvironment environment =
GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
frame = new Frame(displayDevice.getDefaultConfiguration());
frame.setBackground(new Color(0xCC, 0xCC, 0xCC));
frame.setTitle("TestBug735Inv3AppletAWT");
-
+
// This allows to close the frame.
frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
+ public void windowClosing(final WindowEvent e) {
System.exit(0);
}
});
-
+
try {
- Class<?> c = Thread.currentThread().getContextClassLoader().
+ final Class<?> c = Thread.currentThread().getContextClassLoader().
loadClass(Bug735Inv3AppletAWT.class.getName());
applet = (Bug735Inv3AppletAWT) c.newInstance();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new RuntimeException(e);
- }
-
+ }
+
// JAU frame.setLayout(null);
frame.add(applet);
-
+
applet.init();
-
- Insets insets = frame.getInsets();
+
+ final Insets insets = frame.getInsets();
final int windowW = applet.width + insets.left + insets.right;
final int windowH = applet.height + insets.top + insets.bottom;
-
+
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setSize(windowW, windowH);
frame.validate();
// JAU frame.pack();
- Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
+ final Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
frame.setLocation(screenRect.x + (screenRect.width - applet.width) / 2,
- screenRect.y + (screenRect.height - applet.height) / 2);
-
+ screenRect.y + (screenRect.height - applet.height) / 2);
+
frame.setResizable(false);
- frame.setVisible(true);
+ frame.setVisible(true);
}
});
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
- }
-
- applet.start();
+ }
+
+ applet.start();
}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java
index f0be22b65..c9df683b1 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java
@@ -30,7 +30,7 @@ import com.jogamp.opengl.util.AnimatorBase;
* - Use GLEventListener
* - Add GLEventListener to GLAutoDrawable
* - Use GLAutoDrawable.display() instead of GLAutoDrawable.invoke(true, GLRunnable { init / render })
- * - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener
+ * - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener
* - Use Animator
* - Remove component sizes, use frame based size via validate
* - Run frame validation/visibility on AWT-EDT
@@ -46,17 +46,17 @@ import com.jogamp.opengl.util.AnimatorBase;
public class Bug735Inv4AWT {
static public int AWT = 0;
static public int NEWT = 1;
-
+
static public int APPLET_WIDTH = 500;
static public int APPLET_HEIGHT = 290;
static public int TOOLKIT = NEWT;
static public boolean IGNORE_AWT_REPAINT = false;
static public boolean USE_ECT = false;
static public int SWAP_INTERVAL = 1;
-
+
//////////////////////////////////////////////////////////////////////////////
-
- static boolean waitForKey = false;
+
+ static boolean waitForKey = false;
static private Frame frame;
static private Bug735Inv4AWT applet;
private GLCanvas awtCanvas;
@@ -65,39 +65,39 @@ public class Bug735Inv4AWT {
private NewtCanvasAWT newtCanvas;
private GLEventListener demo;
private AnimatorBase animator;
-
+
private int width;
private int height;
-
+
public void init() {
width = APPLET_WIDTH;
height = APPLET_HEIGHT;
initGL();
}
-
+
public void start() {
initDraw();
animator.start();
animator.setUpdateFPSFrames(60, System.err);
}
-
+
private void initGL() {
- GLProfile profile = GLProfile.getDefault();
- GLCapabilities caps = new GLCapabilities(profile);
+ final GLProfile profile = GLProfile.getDefault();
+ final GLCapabilities caps = new GLCapabilities(profile);
caps.setBackgroundOpaque(true);
caps.setOnscreen(true);
caps.setSampleBuffers(false);
-
+
if (TOOLKIT == AWT) {
awtCanvas = new GLCanvas(caps);
awtCanvas.setBackground(new Color(0xFFCCCCCC, true));
- awtCanvas.setFocusable(true);
-
+ awtCanvas.setFocusable(true);
+
if (IGNORE_AWT_REPAINT) {
awtCanvas.setIgnoreRepaint(true);
}
glad = awtCanvas;
- } else if (TOOLKIT == NEWT) {
+ } else if (TOOLKIT == NEWT) {
newtWindow = GLWindow.create(caps);
newtCanvas = new NewtCanvasAWT(newtWindow);
newtCanvas.setBackground(new Color(0xFFCCCCCC, true));
@@ -108,20 +108,20 @@ public class Bug735Inv4AWT {
}
glad = newtWindow;
}
-
+
demo = new LandscapeES2(SWAP_INTERVAL);
// demo = new GearsES2(SWAP_INTERVAL);
glad.addGLEventListener(demo);
animator = new Animator(glad);
animator.setExclusiveContext(USE_ECT);
}
-
+
private void initDraw() {
if (TOOLKIT == AWT) {
if (awtCanvas.getDelegatedDrawable().isRealized()) {
// Request the focus here as it cannot work when the window is not visible
awtCanvas.requestFocus();
- }
+ }
} else if (TOOLKIT == NEWT) {
// newtCanvas.repaint();
// Force the realization
@@ -130,10 +130,10 @@ public class Bug735Inv4AWT {
// Request the focus here as it cannot work when the window is not visible
newtCanvas.requestFocus();
}
- }
+ }
}
-
- static public void main(String[] args) {
+
+ static public void main(final String[] args) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-vsync")) {
i++;
@@ -145,29 +145,29 @@ public class Bug735Inv4AWT {
}
}
System.err.println("swapInterval "+SWAP_INTERVAL);
- System.err.println("exclusiveContext "+USE_ECT);
+ System.err.println("exclusiveContext "+USE_ECT);
if(waitForKey) {
UITestCase.waitForKey("Start");
}
-
- final GraphicsEnvironment environment =
+
+ final GraphicsEnvironment environment =
GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
frame = new Frame(displayDevice.getDefaultConfiguration());
// JAU frame.setBackground(new Color(0xCC, 0xCC, 0xCC));
frame.setTitle("TestBug735Inv4AWT");
-
+
// This allows to close the frame.
frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
+ public void windowClosing(final WindowEvent e) {
System.exit(0);
}
});
-
+
applet = new Bug735Inv4AWT();
applet.init();
-
+
if (TOOLKIT == AWT) {
frame.add(applet.awtCanvas);
} else if (TOOLKIT == NEWT) {
@@ -175,28 +175,28 @@ public class Bug735Inv4AWT {
}
// frame.pack();
// frame.setResizable(false);
-
- Insets insets = frame.getInsets();
+
+ final Insets insets = frame.getInsets();
final int windowW = applet.width + insets.left + insets.right;
final int windowH = applet.height + insets.top + insets.bottom;
-
+
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setSize(windowW, windowH);
frame.validate();
// frame.pack();
- Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
+ final Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
frame.setLocation(screenRect.x + (screenRect.width - applet.width) / 2,
- screenRect.y + (screenRect.height - applet.height) / 2);
-
- frame.setVisible(true);
+ screenRect.y + (screenRect.height - applet.height) / 2);
+
+ frame.setVisible(true);
}
});
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
- }
-
- applet.start();
+ }
+
+ applet.start();
}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java b/src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java
index 1d7f6e78c..20573aa4b 100644
--- a/src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java
+++ b/src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java
@@ -41,7 +41,7 @@ public class DemoBug910ExtendedAWTAppletLifecycleCheck extends Applet {
private static String currentThreadName() { return "["+Thread.currentThread().getName()+", isAWT-EDT "+EventQueue.isDispatchThread()+"]"; }
- private static void invoke(boolean wait, Runnable r) {
+ private static void invoke(final boolean wait, final Runnable r) {
if(EventQueue.isDispatchThread()) {
r.run();
} else {
@@ -51,24 +51,24 @@ public class DemoBug910ExtendedAWTAppletLifecycleCheck extends Applet {
} else {
EventQueue.invokeLater(r);
}
- } catch (InvocationTargetException e) {
+ } catch (final InvocationTargetException e) {
throw new RuntimeException(e.getTargetException());
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
throw new RuntimeException(e);
}
}
}
- private static final String comp2Str(Component c) {
+ private static final String comp2Str(final Component c) {
return c.getClass().getSimpleName()+"[visible "+c.isVisible()+", showing "+c.isShowing()+", valid "+c.isValid()+
", displayable "+c.isDisplayable()+", "+c.getX()+"/"+c.getY()+" "+c.getWidth()+"x"+c.getHeight()+"]";
}
- private void println(String msg) {
+ private void println(final String msg) {
System.err.println(msg);
}
- private final void checkComponentState(String msg, boolean expIsContained, int expAddNotifyCount, int expRemoveNotifyCount) {
+ private final void checkComponentState(final String msg, final boolean expIsContained, final int expAddNotifyCount, final int expRemoveNotifyCount) {
final int compCount = getComponentCount();
final Component c = 1 <= compCount ? getComponent(0) : null;
final String clazzName = null != c ? c.getName() : "n/a";
@@ -88,8 +88,8 @@ public class DemoBug910ExtendedAWTAppletLifecycleCheck extends Applet {
volatile int stopCount = 0;
volatile int destroyCount = 0;
- private final void checkAppletState(String msg, boolean expIsActive,
- int expInitCount, int expStartCount, int expStopCount, boolean startStopCountEquals, int expDestroyCount) {
+ private final void checkAppletState(final String msg, final boolean expIsActive,
+ final int expInitCount, final int expStartCount, final int expStopCount, final boolean startStopCountEquals, final int expDestroyCount) {
final boolean isActive = this.isActive();
final String okS = ( expInitCount == initCount &&
expIsActive == isActive &&
@@ -144,7 +144,7 @@ public class DemoBug910ExtendedAWTAppletLifecycleCheck extends Applet {
}
@Override
- public void paint(Graphics g) {
+ public void paint(final Graphics g) {
super.paint(g);
paintCount++;
final int width = getWidth();
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java b/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java
index 833f34153..802bd65d5 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java
@@ -9,16 +9,18 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Random;
+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.GLU;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.awt.TextRenderer;
-/**
+/**
* Demonstrates corruption with older versions of TextRenderer. Two
* problems: errors when punting from glyph-based renderer to
* string-by-string renderer, and failure of glyph-based renderer when
@@ -31,64 +33,64 @@ public class Issue326Test1 extends Frame implements GLEventListener {
int width, height;
- public static void main(String[] args) {
- new Issue326Test1();
+ public static void main(final String[] args) {
+ new Issue326Test1();
}
-
+
GLCanvas canvas;
TextRenderer tr ;
-
+
public Issue326Test1() {
super("TextTest");
this.setSize(800, 800);
canvas = new GLCanvas();
canvas.addGLEventListener(this);
add(canvas);
-
+
setVisible(true);
addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
+ public void windowClosing(final WindowEvent e) {
System.exit(0);
}
});
}
- public void display(GLAutoDrawable drawable) {
- GL2 gl = drawable.getGL().getGL2();
+ public void display(final GLAutoDrawable drawable) {
+ final GL2 gl = drawable.getGL().getGL2();
gl.glClearColor(0, 0, 0, 0);
- gl.glClear(GL2.GL_COLOR_BUFFER_BIT|GL2.GL_DEPTH_BUFFER_BIT);
-
-
- gl.glMatrixMode(GL2.GL_PROJECTION);
- gl.glLoadIdentity();
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT);
+
+
+ gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ gl.glLoadIdentity();
//new GLU().gluPerspective(45f, (float)width/(float)height, 0.1f, 1000f);
gl.glOrtho(0.0, 800, 0.0, 800, -100.0, 100.0);
- gl.glMatrixMode(GL2.GL_MODELVIEW);
+ gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
gl.glLoadIdentity();
-
+
tr.beginRendering(800,800);
tr.draw( "die Marktwirtschaft. Da regelt sich � angeblich", 16, 32);
tr.draw( "Hello World! This text is scrambled", 16, 16);
tr.endRendering();
-
+
}
- public void init(GLAutoDrawable arg0) {
+ public void init(final GLAutoDrawable arg0) {
tr = new TextRenderer(new java.awt.Font("Verdana", java.awt.Font.PLAIN, 12), true, false, null, false);
tr.setColor(1, 1, 1 ,1);
}
- public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) {
+ public void reshape(final GLAutoDrawable arg0, final int arg1, final int arg2, final int arg3, final int arg4) {
width = arg3;
height = arg4;
- GL2 gl = arg0.getGL().getGL2();
+ final GL2 gl = arg0.getGL().getGL2();
gl.glViewport(0, 0, width, height);
- gl.glMatrixMode(GL2.GL_PROJECTION);
+ gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(0.0, 800, 0.0, 200, -100.0, 100.0);
- gl.glMatrixMode(GL2.GL_MODELVIEW);
+ gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
gl.glLoadIdentity();
}
- public void dispose(GLAutoDrawable drawable) {}
+ public void dispose(final GLAutoDrawable drawable) {}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java b/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java
index 2a8fd3a39..032eaa23c 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java
@@ -3,10 +3,13 @@ package com.jogamp.opengl.test.bugs;
import java.awt.Font;
import java.awt.Frame;
import java.awt.event.*;
+
+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 com.jogamp.opengl.util.awt.*;
@@ -20,54 +23,54 @@ public class Issue326Test2 extends Frame implements GLEventListener {
int width, height;
- public static void main(String[] args) {
- new Issue326Test2();
+ public static void main(final String[] args) {
+ new Issue326Test2();
}
-
+
GLCanvas canvas;
TextRenderer tr;
-
+
public Issue326Test2() {
super("");
this.setSize(800, 800);
canvas = new GLCanvas();
canvas.addGLEventListener(this);
add(canvas);
-
+
setVisible(true);
addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
+ public void windowClosing(final WindowEvent e) {
System.exit(0);
}
});
}
- public void display(GLAutoDrawable drawable) {
- GL2 gl = drawable.getGL().getGL2();
+ public void display(final GLAutoDrawable drawable) {
+ final GL2 gl = drawable.getGL().getGL2();
gl.glClearColor(0, 0, 0, 0);
- gl.glClear(GL2.GL_COLOR_BUFFER_BIT|GL2.GL_DEPTH_BUFFER_BIT);
-
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT);
+
tr.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
tr.draw("LA CLAPI\u00c8RE \nAlt: 1100-1700m \nGlissement de terrain majeur", 16, 80);
tr.draw("dans la haute Tin\u00e9e, sur un flanc du Parc du Mercantour.", 16, 16);
tr.endRendering();
-
+
}
- public void init(GLAutoDrawable arg0) {
+ public void init(final GLAutoDrawable arg0) {
tr = new TextRenderer(Font.decode("Arial-BOLD-64"));
tr.setColor(1, 1, 1 ,1);
}
- public void reshape(GLAutoDrawable arg0, int x, int y, int w, int h) {
- GL2 gl = arg0.getGL().getGL2();
- gl.glMatrixMode(GL2.GL_PROJECTION);
+ public void reshape(final GLAutoDrawable arg0, final int x, final int y, final int w, final int h) {
+ final GL2 gl = arg0.getGL().getGL2();
+ gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(0.0, w, 0.0, h, -1, 1);
- gl.glMatrixMode(GL2.GL_MODELVIEW);
+ gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
gl.glLoadIdentity();
}
- public void dispose(GLAutoDrawable drawable) {}
+ public void dispose(final GLAutoDrawable drawable) {}
}
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) {}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Test1.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Test1.java
index f0da7cbf8..384b6e993 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Issue344Test1.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Test1.java
@@ -2,11 +2,11 @@ package com.jogamp.opengl.test.bugs;
public class Issue344Test1 extends Issue344Base {
protected String getText() {
- // test 1 - weird artifacts appear with a large font & long string
+ // test 1 - weird artifacts appear with a large font & long string
return "abcdefghijklmnopqrstuvwxyz1234567890";
}
- public static void main(String[] args) {
+ public static void main(final String[] args) {
new Issue344Test1().run(args);
}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Test2.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Test2.java
index bb1acf2de..9941b3f5b 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Issue344Test2.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Test2.java
@@ -6,7 +6,7 @@ public class Issue344Test2 extends Issue344Base {
return "\u201Cabcdefghijklmnopqrstuvwxyz\u201D";
}
- public static void main(String[] args) {
+ public static void main(final String[] args) {
new Issue344Test2().run(args);
}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Test3.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Test3.java
index bb73d84ec..7ae4245c6 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Issue344Test3.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Test3.java
@@ -6,7 +6,7 @@ public class Issue344Test3 extends Issue344Base {
return "abcde";
}
- public static void main(String[] args) {
+ public static void main(final String[] args) {
new Issue344Test3().run(args);
}
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Test4.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Test4.java
index de4c37a40..87a5b644e 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Issue344Test4.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Test4.java
@@ -6,7 +6,7 @@ public class Issue344Test4 extends Issue344Base {
return "\u201CGreetings\u201D!";
}
- public static void main(String[] args) {
+ public static void main(final String[] args) {
new Issue344Test4().run(args);
}
}