29package com.jogamp.opengl.test.junit.jogl.acore;
31import com.jogamp.newt.opengl.GLWindow;
33import com.jogamp.nativewindow.util.InsetsImmutable;
34import com.jogamp.opengl.GLAutoDrawable;
35import com.jogamp.opengl.GLCapabilities;
36import com.jogamp.opengl.GLContext;
37import com.jogamp.opengl.GLDrawable;
38import com.jogamp.opengl.GLDrawableFactory;
39import com.jogamp.opengl.GLProfile;
41import com.jogamp.opengl.GLAutoDrawableDelegate;
42import com.jogamp.opengl.util.Animator;
43import com.jogamp.opengl.test.junit.util.GLTestUtil;
44import com.jogamp.opengl.test.junit.util.MiscUtils;
45import com.jogamp.opengl.test.junit.util.NewtTestUtil;
46import com.jogamp.opengl.test.junit.util.UITestCase;
47import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
49import org.junit.Assert;
50import org.junit.BeforeClass;
52import org.junit.FixMethodOrder;
53import org.junit.runners.MethodSorters;
73@FixMethodOrder(MethodSorters.NAME_ASCENDING)
77 static int width, height;
85 Assert.assertNotNull(glp);
87 Assert.assertNotNull(caps);
91 setTestSupported(
false);
95 private void initShared() throws InterruptedException {
99 Assert.assertNotNull(sharedDrawable);
101 Assert.assertTrue(GLTestUtil.waitForRealized(obj,
true,
null));
103 sharedGears =
new GearsES1();
104 Assert.assertNotNull(sharedGears);
109 Assert.assertTrue(
"Master ctx not created", GLTestUtil.waitForContextCreated(sharedDrawable,
true,
null));
110 Assert.assertTrue(
"Master Ctx is shared before shared creation", !ctxM.
isShared());
111 Assert.assertTrue(
"Master Gears is shared", !sharedGears.usesSharedGears());
114 private void releaseShared() {
115 Assert.assertNotNull(sharedDrawable);
119 protected GLWindow runTestGL(
final Animator animator,
final int x,
final int y,
final boolean useShared,
final boolean vsync)
throws InterruptedException {
121 Assert.assertNotNull(glWindow);
123 glWindow.
setTitle(
"Shared Gears NEWT Test: "+x+
"/"+y+
" shared "+useShared);
125 glWindow.setSharedAutoDrawable(sharedDrawable);
128 glWindow.
setSize(width, height);
136 animator.add(glWindow);
146 Assert.assertEquals(
"Master Context not shared as expected",
true, sharedDrawable.
getContext().
isShared());
151 Assert.assertEquals(
"New Context not shared as expected", useShared, glWindow.
getContext().
isShared());
152 Assert.assertEquals(
"Gears is not shared as expected", useShared, gears.usesSharedGears());
157 public void test01() throws InterruptedException {
160 final GLWindow f1 = runTestGL(animator, 0, 0,
true,
false);
163 f1.
getY()+0,
true,
false);
180 static long duration = 500;
182 public static void main(
final String args[]) {
183 for(
int i=0; i<args.length; i++) {
184 if(args[i].equals(
"-time")) {
187 duration = Integer.parseInt(args[i]);
188 }
catch (
final Exception ex) { ex.printStackTrace(); }
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final void setPosition(final int x, final int y)
Sets the location of the window's client area excluding insets (window decorations) in window units.
final void setTitle(final String title)
final int getX()
Returns the current x position of this window, relative to it's parent.
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 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 InsetsImmutable getInsets()
Returns the insets defined as the width and height of the window decoration on the left,...
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...
Fully functional GLAutoDrawable implementation utilizing already created GLDrawable and GLContext ins...
Specifies a set of OpenGL capabilities.
Abstraction for an OpenGL rendering context.
final boolean isShared()
Returns true if this GLContext is shared, otherwise false.
final GLContext getSharedMaster()
Returns the shared master GLContext of this GLContext if shared, otherwise return null.
abstract GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser)
Creates an unrealized dummy GLDrawable.
static GLDrawableFactory getFactory(final GLProfile glProfile)
Returns the sole GLDrawableFactory instance.
Specifies the the OpenGL profile.
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
static final String GL2ES1
The intersection of the desktop GL2 and embedded ES1 profile.
Sharing the VBO of 3 GearsES1 instances, each in their own GLWindow.
GLWindow runTestGL(final Animator animator, final int x, final int y, final boolean useShared, final boolean vsync)
static void main(final String args[])
void setSharedGears(final GearsES1 shared)
static boolean waitForContextCreated(final GLAutoDrawable autoDrawable, final boolean created, final Runnable waitAction)
static void dumpSharedGLContext(final String prefix, final GLContext self)
static boolean waitForRealized(final Screen screen, final boolean realized, final Runnable waitAction)
static boolean waitForVisible(final Window win, final boolean visible, final Runnable waitAction)
final long getTotalFPSDuration()
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.
Immutable insets representing rectangular window decoration insets on all four edges in window units.
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
GLContext getContext()
Returns the context associated with this drawable.
An abstraction for an OpenGL rendering target.
void setRealized(boolean realized)
Indicates to GLDrawable implementations whether the underlying surface has been created and can be dr...