29package com.jogamp.opengl.test.junit.jogl.acore.glels;
31import java.awt.BorderLayout;
32import java.awt.Component;
33import java.awt.Dimension;
35import java.io.IOException;
36import java.lang.reflect.InvocationTargetException;
38import com.jogamp.newt.event.TraceWindowAdapter;
39import com.jogamp.newt.event.awt.AWTWindowAdapter;
41import com.jogamp.opengl.GLAutoDrawable;
42import com.jogamp.opengl.GLCapabilitiesImmutable;
43import com.jogamp.opengl.GLDrawableFactory;
44import com.jogamp.opengl.awt.GLCanvas;
46import jogamp.nativewindow.awt.AWTMisc;
48import com.jogamp.opengl.test.junit.util.QuitAdapter;
50import org.junit.Assert;
51import org.junit.FixMethodOrder;
52import org.junit.runners.MethodSorters;
58@FixMethodOrder(MethodSorters.NAME_ASCENDING)
64 if( caps.isOnscreen() ) {
65 final Frame frame =
new Frame(
"Gears AWT Test");
66 Assert.assertNotNull(frame);
69 Assert.assertNotNull(glCanvas);
70 final Dimension glc_sz =
new Dimension(width, height);
71 glCanvas.setMinimumSize(glc_sz);
72 glCanvas.setPreferredSize(glc_sz);
78 frame.setLayout(
new BorderLayout());
79 frame.add(glCanvas, BorderLayout.CENTER);
80 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
83 frame.setVisible(
true);
88 Assert.assertNotNull(glad);
95 if( glad.getChosenGLCapabilities().isOnscreen() ) {
96 final Frame frame = AWTMisc.getFrame((Component)glad);
97 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
99 final Frame _frame = frame;
107 public static void main(
final String args[])
throws IOException {
108 for(
int i=0; i<args.length; i++) {
109 if(args[i].equals(
"-time")) {
112 duration = Integer.parseInt(args[i]);
113 }
catch (
final Exception ex) { ex.printStackTrace(); }
114 }
else if(args[i].equals(
"-period")) {
117 period = Integer.parseInt(args[i]);
118 }
catch (
final Exception ex) { ex.printStackTrace(); }
119 }
else if(args[i].equals(
"-testUnsafe")) {
120 testEvenUnsafeSwapGLContext =
true;
synchronized AWTAdapter addTo(final java.awt.Component awtComponent)
Due to the fact that some NEWT com.jogamp.newt.event.NEWTEventListener are mapped to more than one ja...
abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, int width, int height)
Creates a realized GLOffscreenAutoDrawable incl it's offscreen NativeSurface with the given capabilit...
static GLDrawableFactory getFactory(final GLProfile glProfile)
Returns the sole GLDrawableFactory instance.
A heavyweight AWT component which provides OpenGL rendering support.
Test re-association (switching) of GLWindow /GLDrawables, from GLWindow/GLOffscreenAutoDrawable to an...
Test re-association (switching) of GLContext/GLDrawables, from GLCanvas to an GLOffscreenAutoDrawable...
void destroyGLAutoDrawable(final GLAutoDrawable glad)
static void main(final String args[])
GLAutoDrawable createGLAutoDrawable(final QuitAdapter quitAdapter, final GLCapabilitiesImmutable caps, final int width, final int height)
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
Specifies an immutable set of OpenGL capabilities.
void setSize(int width, int height)
Requests a new width and height for this AWTGLAutoDrawable.