29package com.jogamp.opengl.test.junit.jogl.demos.es2.newt;
31import com.jogamp.newt.event.KeyAdapter;
32import com.jogamp.newt.event.KeyEvent;
33import com.jogamp.newt.opengl.GLWindow;
34import com.jogamp.opengl.test.junit.util.MiscUtils;
35import com.jogamp.opengl.test.junit.util.UITestCase;
36import com.jogamp.opengl.test.junit.util.QuitAdapter;
37import com.jogamp.opengl.util.Animator;
38import com.jogamp.opengl.util.AnimatorBase;
39import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2;
41import com.jogamp.opengl.GLCapabilities;
42import com.jogamp.opengl.GLProfile;
45import org.junit.FixMethodOrder;
46import org.junit.runners.MethodSorters;
48@FixMethodOrder(MethodSorters.NAME_ASCENDING)
50 static int width = 500, height = 290;
51 static int swapInterval = 1;
52 static boolean forceES2 =
false;
53 static boolean forceGL3 =
false;
54 static boolean mainRun =
false;
55 static boolean exclusiveContext =
false;
56 static boolean useAnimator =
true;
59 System.err.println(
"requested: swapInterval "+swapInterval+
", "+caps);
61 glWindow.
setTitle(getSimpleTestName(
"."));
62 glWindow.
setSize(width, height);
85 public void keyReleased(
final KeyEvent e) {
90 glWindow.invokeOnNewThread(
null,
false,
new Runnable() {
96 glWindow.invokeOnNewThread(
null,
false,
new Runnable() {
106 animator.
add(glWindow);
120 while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.
getTotalFPSDuration()<duration) {
135 }
else if(forceES2) {
149 System.err.println(
"GL3 n/a");
157 static long duration = 1000;
159 public static void main(
final String args[]) {
161 for(
int i=0; i<args.length; i++) {
162 if(args[i].equals(
"-time")) {
165 }
else if(args[i].equals(
"-vsync")) {
168 }
else if(args[i].equals(
"-exclctx")) {
169 exclusiveContext =
true;
170 }
else if(args[i].equals(
"-noanim")) {
172 }
else if(args[i].equals(
"-es2")) {
174 }
else if(args[i].equals(
"-gl3")) {
178 System.err.println(
"forceES2 "+forceES2);
179 System.err.println(
"forceGL3 "+forceGL3);
final char getKeyChar()
Returns the UTF-16 character reflecting the key symbol incl.
static boolean isPrintableKey(final short uniChar, final boolean isKeyChar)
Returns true if given uniChar represents a printable character, i.e.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final boolean isFullscreen()
final int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
final void setTitle(final String title)
final int getX()
Returns the current x position of this window, relative to it's parent.
final void addKeyListener(final KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
final boolean isUndecorated()
final int getY()
Returns the current y position of the top-left corner of the client area relative to it's parent in w...
final int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
final void setSize(final int width, final int height)
Sets the size of the window's client area in window units, excluding decorations.
final boolean setFullscreen(final boolean fullscreen)
Enable or disable fullscreen mode for this window.
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
final void addWindowListener(final WindowListener l)
Appends the given com.jogamp.newt.event.WindowListener to the end of the list.
final CapabilitiesImmutable getChosenCapabilities()
Gets an immutable set of chosen capabilities.
final InsetsImmutable getInsets()
Returns the insets defined as the width and height of the window decoration on the left,...
final void setUndecorated(final boolean value)
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
final Window getDelegatedWindow()
If the implementation uses delegation, return the delegated Window instance, otherwise return this in...
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
static final String GL3
The desktop OpenGL core profile 3.x, with x >= 1.
static final String GLES2
The embedded OpenGL profile ES 2.x, with x >= 0.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
void runTestGL(final GLCapabilities caps)
static void main(final String args[])
static int atoi(final String str, final int def)
static long atol(final String str, final long def)
void setPostSNDetail(final String v)
final long getTotalFPSDuration()
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final synchronized Thread setExclusiveContext(final Thread t)
Dedicate all GLAutoDrawable's context to the given exclusive context thread.
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.
CapabilitiesImmutable getChosenCapabilities()
Gets an immutable set of chosen capabilities.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.