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.NewtTestUtil;
36import com.jogamp.opengl.test.junit.util.UITestCase;
37import com.jogamp.opengl.test.junit.util.QuitAdapter;
38import com.jogamp.opengl.util.Animator;
39import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
40import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareMappedES2;
42import com.jogamp.nativewindow.NativeWindowFactory;
43import com.jogamp.opengl.GLCapabilities;
44import com.jogamp.opengl.GLEventListener;
45import com.jogamp.opengl.GLProfile;
47import org.junit.Assert;
48import org.junit.BeforeClass;
49import org.junit.AfterClass;
51import org.junit.FixMethodOrder;
52import org.junit.runners.MethodSorters;
54@FixMethodOrder(MethodSorters.NAME_ASCENDING)
56 static int width, height;
58 static boolean loop_shutdown =
false;
59 static boolean vsync =
false;
60 static boolean forceES2 =
false;
61 static boolean forceGL3 =
false;
62 static boolean mainRun =
false;
63 static boolean doRotate =
true;
64 static boolean useMappedBuffers =
false;
77 System.err.println(
"requested: vsync "+vsync+
", "+caps);
79 Assert.assertNotNull(glWindow);
80 glWindow.
setTitle(getSimpleTestName(
"."));
81 glWindow.
setSize(width, height);
84 if( useMappedBuffers ) {
108 public void keyReleased(
final KeyEvent e) {
113 glWindow.invokeOnNewThread(
null,
false,
new Runnable() {
118 glWindow.invokeOnNewThread(
null,
false,
new Runnable() {
137 while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.
getTotalFPSDuration()<duration) {
142 Assert.assertFalse(animator.isAnimating());
143 Assert.assertFalse(animator.
isStarted());
152 for(
int i=1; i<=loops; i++) {
153 System.err.println(
"Loop "+i+
"/"+loops);
157 }
else if(forceES2) {
175 System.err.println(
"GL3 n/a");
183 static long duration = 500;
185 public static void main(
final String args[]) {
187 for(
int i=0; i<args.length; i++) {
188 if(args[i].equals(
"-time")) {
191 }
else if(args[i].equals(
"-es2")) {
193 }
else if(args[i].equals(
"-gl3")) {
195 }
else if(args[i].equals(
"-norotate")) {
197 }
else if(args[i].equals(
"-mappedBuffers")) {
198 useMappedBuffers =
true;
199 }
else if(args[i].equals(
"-loops")) {
202 }
else if(args[i].equals(
"-loop-shutdown")) {
203 loop_shutdown =
true;
206 System.err.println(
"duration "+duration);
207 System.err.println(
"loops "+loops);
208 System.err.println(
"loop shutdown "+loop_shutdown);
209 System.err.println(
"forceES2 "+forceES2);
210 System.err.println(
"forceGL3 "+forceGL3);
211 System.err.println(
"mappedBuffers "+useMappedBuffers);
Provides a pluggable mechanism for arbitrary window toolkits to adapt their components to the NativeW...
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 void shutdown()
Manual shutdown method, may be called after your last JOGL use within the running JVM.
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 setDoRotation(final boolean rotate)
void setDoRotation(final boolean rotate)
static void releaseClass()
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)
static boolean waitForRealized(final Screen screen, final boolean realized, final Runnable waitAction)
void setPostSNDetail(final String v)
final long getTotalFPSDuration()
final void setUpdateFPSFrames(final int frames, final PrintStream out)
synchronized boolean isStarted()
Indicates whether this animator has been started.
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.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.