1package com.jogamp.opengl.test.bugs;
5import java.awt.GraphicsDevice;
6import java.awt.GraphicsEnvironment;
8import java.awt.Rectangle;
9import java.awt.event.WindowAdapter;
10import java.awt.event.WindowEvent;
12import com.jogamp.opengl.GLAutoDrawable;
13import com.jogamp.opengl.GLCapabilities;
14import com.jogamp.opengl.GLEventListener;
15import com.jogamp.opengl.GLProfile;
16import com.jogamp.opengl.awt.GLCanvas;
17import javax.swing.SwingUtilities;
19import com.jogamp.newt.awt.NewtCanvasAWT;
20import com.jogamp.newt.opengl.GLWindow;
21import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2;
22import com.jogamp.opengl.test.junit.util.MiscUtils;
23import com.jogamp.opengl.test.junit.util.UITestCase;
24import com.jogamp.opengl.util.Animator;
25import com.jogamp.opengl.util.AnimatorBase;
47 static public final int AWT = 0;
48 static public final int NEWT = 1;
59 static boolean waitForKey =
false;
60 static private Frame frame;
84 private void initGL() {
93 awtCanvas.setBackground(
new Color(0xFFCCCCCC,
true));
94 awtCanvas.setFocusable(
true);
97 awtCanvas.setIgnoreRepaint(
true);
101 newtWindow = GLWindow.
create(caps);
102 newtCanvas =
new NewtCanvasAWT(newtWindow);
103 newtCanvas.setBackground(
new Color(0xFFCCCCCC,
true));
104 newtCanvas.setFocusable(
true);
107 newtCanvas.setIgnoreRepaint(
true);
115 animator =
new Animator(glad);
119 private void initDraw() {
123 awtCanvas.requestFocus();
131 newtCanvas.requestFocus();
136 static public void main(
final String[] args) {
137 for(
int i=0; i<args.length; i++) {
138 if(args[i].equals(
"-vsync")) {
141 }
else if(args[i].equals(
"-exclctx")) {
143 }
else if(args[i].equals(
"-wait")) {
148 System.err.println(
"exclusiveContext "+
USE_ECT);
153 final GraphicsEnvironment environment =
154 GraphicsEnvironment.getLocalGraphicsEnvironment();
155 final GraphicsDevice displayDevice = environment.getDefaultScreenDevice();
157 frame =
new Frame(displayDevice.getDefaultConfiguration());
159 frame.setTitle(
"TestBug735Inv4AWT");
162 frame.addWindowListener(
new WindowAdapter() {
163 public void windowClosing(
final WindowEvent e) {
172 frame.add(applet.awtCanvas);
174 frame.add(applet.newtCanvas);
179 final Insets insets = frame.getInsets();
180 final int windowW = applet.width + insets.left + insets.right;
181 final int windowH = applet.height + insets.top + insets.bottom;
184 SwingUtilities.invokeAndWait(
new Runnable() {
186 frame.setSize(windowW, windowH);
189 final Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
190 frame.setLocation(screenRect.x + (screenRect.width - applet.width) / 2,
191 screenRect.y + (screenRect.height - applet.height) / 2);
193 frame.setVisible(
true);
196 }
catch (
final Exception e) {
void setBackgroundOpaque(final boolean opaque)
Sets whether the surface shall be opaque or translucent.
void setOnscreen(final boolean onscreen)
Sets whether the surface shall be on- or offscreen.
AWT Canvas containing a NEWT Window using native parenting.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
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.
void setSampleBuffers(final boolean enable)
Defaults to false.
Specifies the the OpenGL profile.
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
A heavyweight AWT component which provides OpenGL rendering support.
final GLDrawable getDelegatedDrawable()
If the implementation uses delegation, return the delegated GLDrawable instance, otherwise return thi...
static final int APPLET_WIDTH
static final boolean IGNORE_AWT_REPAINT
static void main(final String[] args)
static final int APPLET_HEIGHT
static int atoi(final String str, final int def)
Base implementation of GLAnimatorControl
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)
boolean start()
Starts this animator, if not running.
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.
boolean isRealized()
Returns true if this drawable is realized, otherwise false.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.