28package com.jogamp.opengl.test.junit.jogl.demos.es2.awt;
30import java.applet.Applet;
32import java.awt.event.WindowAdapter;
33import java.awt.event.WindowEvent;
35import com.jogamp.opengl.GL;
36import com.jogamp.opengl.GLAutoDrawable;
37import com.jogamp.opengl.GLCapabilities;
38import com.jogamp.opengl.GLCapabilitiesImmutable;
39import com.jogamp.opengl.GLEventListener;
40import com.jogamp.opengl.GLProfile;
41import com.jogamp.opengl.awt.GLCanvas;
42import javax.swing.JFrame;
43import javax.swing.JPanel;
54@SuppressWarnings(
"serial")
62 public static boolean isApplet =
true;
64 static public void main(
final String args[]) {
65 Applet myApplet =
null;
69 appletStarter(myApplet,
"Bug861AppletGLCanvasTest01", 800, 600);
72 static public void appletStarter(
final Applet des,
final String frameName,
final int width,
final int height) {
73 appletHolder =
new JPanel();
78 frame =
new JFrame(frameName);
79 frame.setVisible(
false);
80 frame.getContentPane().add(appletHolder);
82 appletHolder.setLayout(
null);
83 des.setBounds(0, 0, width, height);
84 appletHolder.add(des);
86 frame.setVisible(
true);
87 final int frameBorderSize = appletHolder.getLocationOnScreen().x - frame.getLocationOnScreen().x;
88 final int titleBarHeight = appletHolder.getLocationOnScreen().y - frame.getLocationOnScreen().y;
89 final int frameWidth = width + 2 * frameBorderSize;
90 final int frameHeight = height + titleBarHeight + frameBorderSize;
91 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
92 frame.setSize(frameWidth, frameHeight);
93 frame.setVisible(
true);
95 frame.addWindowListener(
new WindowAdapter() {
96 public void windowClosing(
final WindowEvent e) {
107 setBackground(Color.gray);
113 canvas.setBounds(50, 50, 200, 450);
119 final GL gl = gLAutoDrawable.
getGL();
Specifies a set of OpenGL capabilities.
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.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Bug 816: OSX CALayer Positioning Bug.
void init(final GLAutoDrawable gLAutoDrawable)
Called by the drawable immediately after the OpenGL context is initialized.
static JPanel appletHolder
static void appletStarter(final Applet des, final String frameName, final int width, final int height)
void dispose(final GLAutoDrawable glad)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
void reshape(final GLAutoDrawable glad, final int i, final int i1, final int i2, final int i3)
Called by the drawable during the first repaint after the component has been resized.
static void main(final String args[])
void display(final GLAutoDrawable glad)
Called by the drawable to initiate OpenGL rendering by the client.
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
void swapBuffers()
Swaps the front and back buffers of this drawable.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
static final int GL_COLOR_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_COLOR_BUFFER_BIT" wit...
void glClearColor(float red, float green, float blue, float alpha)
Entry point to C language function: void {@native glClearColor}(GLfloat red, GLfloat green,...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...