1package com.jogamp.opengl.test.bugs;
3import java.awt.BorderLayout;
6import java.awt.event.*;
9import com.jogamp.common.util.InterruptSource;
10import com.jogamp.opengl.GL;
11import com.jogamp.opengl.GL2;
12import com.jogamp.opengl.GLAutoDrawable;
13import com.jogamp.opengl.GLEventListener;
14import com.jogamp.opengl.awt.GLCanvas;
15import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
16import com.jogamp.opengl.glu.*;
18import com.jogamp.opengl.util.awt.TextRenderer;
31 float textScaleFactor;
36 font =
new Font(
"default", Font.PLAIN, 200);
42 protected void run(
final String[] args) {
43 final Frame frame =
new Frame(getClass().getName());
44 frame.setLayout(
new BorderLayout());
48 frame.add(canvas, BorderLayout.CENTER);
50 frame.setSize(512, 512);
51 frame.addWindowListener(
new WindowAdapter() {
52 public void windowClosing(
final WindowEvent e) {
53 new InterruptSource.Thread(
null,
new Runnable() {
61 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
63 frame.setVisible(
true);
65 }
catch(
final Exception ex) {
66 throw new RuntimeException(ex);
79 final float w = (float) bounds.getWidth();
81 textScaleFactor = 2.0f / (w * 1.1f);
98 final float w = (float) bounds.getWidth();
99 final float h = (float) bounds.getHeight();
101 w / -2.0f * textScaleFactor,
102 h / -2.0f * textScaleFactor,
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.
Provides access to the OpenGL Utility Library (GLU).
void gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
void gluPerspective(float fovy, float aspect, float zNear, float zFar)
Test Code adapted from TextCube.java (in JOGL demos)
void run(final String[] args)
void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height)
Called by the drawable during the first repaint after the component has been resized.
abstract String getText()
void display(final GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
void dispose(final GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
Renders bitmapped Java 2D text into an OpenGL window with high performance, full Unicode support,...
void begin3DRendering()
Begins rendering of 2D text in 3D with this TextRenderer into the current OpenGL drawable.
void draw3D(final CharSequence str, final float x, final float y, final float z, final float scaleFactor)
Draws the supplied CharSequence at the desired 3D location using the renderer's current color.
void end3DRendering()
Ends a 3D render cycle with this TextRenderer.
Rectangle2D getBounds(final String str)
Returns the bounding rectangle of the given String, assuming it was rendered at the origin.
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
void setSwapInterval(int interval)
Set the swap interval of the current context and attached onscreen GLDrawable.
GL2 getGL2()
Casts this object to the GL2 interface.
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 glEnable(int cap)
Entry point to C language function: void {@native glEnable}(GLenum cap) Part of GL_ES_VERSION_2_0,...
static final int GL_DEPTH_TEST
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_TEST" with expr...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
static final int GL_DEPTH_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_BUFFER_BIT" wit...
Subset of OpenGL fixed function pipeline's matrix operations.
static final int GL_PROJECTION
Matrix mode projection.
static final int GL_MODELVIEW
Matrix mode modelview.
void glLoadIdentity()
Load the current matrix with the identity matrix.
void glMatrixMode(int mode)
Sets the current matrix mode.