29package com.jogamp.opengl.test.junit.newt;
31import java.io.IOException;
32import java.util.Properties;
34import com.jogamp.nativewindow.NativeWindowFactory;
35import com.jogamp.opengl.GLCapabilities;
37import org.junit.AfterClass;
38import org.junit.Assert;
39import org.junit.FixMethodOrder;
41import org.junit.runners.MethodSorters;
43import com.jogamp.common.util.IOUtil;
44import com.jogamp.junit.util.SingletonJunitCase;
45import com.jogamp.newt.Display;
46import com.jogamp.newt.Display.PointerIcon;
47import com.jogamp.newt.opengl.GLWindow;
48import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
49import com.jogamp.opengl.test.junit.util.MiscUtils;
50import com.jogamp.opengl.test.junit.util.NewtTestUtil;
51import com.jogamp.opengl.test.junit.util.QuitAdapter;
52import com.jogamp.opengl.util.Animator;
53import com.jogamp.opengl.util.AnimatorBase;
55@FixMethodOrder(MethodSorters.NAME_ASCENDING)
58 static long duration = 1000;
65 static void setPointerIcons() {
66 final Properties sysp = System.getProperties();
67 sysp.put(
"jnlp.newt.window.icons",
"red-16x16.png red-32x32.png");
72 final Properties sysp = System.getProperties();
73 sysp.remove(
"jnlp.newt.window.icons");
77 public void test() throws InterruptedException {
79 Assert.assertNotNull(glWindow);
97 final IOUtil.ClassResources res =
new IOUtil.ClassResources(
new String[] {
"arrow-red-alpha-64x64.png" }, glWindow.getClass().getClassLoader(),
null);
100 System.err.printf(
"Create PointerIcon #%02d: %s%n", idx, _pointerIcon.
toString());
101 }
catch (
final Exception e) {
104 pointerIcon = _pointerIcon;
108 System.err.println(
"Set PointerIcon: "+glWindow.
getPointerIcon());
111 animator.
add(glWindow);
117 final long t0 = System.currentTimeMillis();
119 while(!quitAdapter.shouldQuit() && t1-t0<duration) {
121 t1 = System.currentTimeMillis();
132 public static void main(
final String args[])
throws IOException {
133 for(
int i=0; i<args.length; i++) {
134 if(args[i].equals(
"-time")) {
Provides a pluggable mechanism for arbitrary window toolkits to adapt their components to the NativeW...
abstract void createNative()
Manual trigger the native creation, if it is not done yet.
abstract PointerIcon createPointerIcon(final IOUtil.ClassResources pngResource, final int hotX, final int hotY)
Returns the newly created PointerIcon or null if not implemented on platform.
abstract Display getDisplay()
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final void warpPointer(final int x, final int y)
Moves the pointer to x/y relative to this window's origin in pixel units.
final void setPointerIcon(final PointerIcon pi)
final int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
final void addKeyListener(final KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
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 void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
final PointerIcon getPointerIcon()
Returns the current PointerIcon, which maybe null for the default.
final void addWindowListener(final WindowListener l)
Appends the given com.jogamp.newt.event.WindowListener to the end of the list.
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
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.
static void main(final String args[])
static void unsetPointerIcons()
static long atol(final String str, final long def)
static boolean waitForRealized(final Screen screen, final boolean realized, final Runnable waitAction)
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.
Native PointerIcon handle.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.