29package com.jogamp.opengl.test.junit.jogl.awt.text;
32import java.io.OutputStream;
33import java.io.PrintStream;
35import com.jogamp.opengl.util.awt.TextRenderer;
37import com.jogamp.opengl.GL2ES1;
38import com.jogamp.opengl.GL2;
39import com.jogamp.opengl.GLAutoDrawable;
40import com.jogamp.opengl.GLEventListener;
41import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
42import com.jogamp.opengl.glu.GLU;
44import org.junit.Assert;
62 private final GLU glu =
new GLU();
65 private String disallowedMethodCalls;
66 private final int testNumber;
69 this.disallowedMethodCalls =
"";
70 this.testNumber = testNumber;
74 renderer =
new TextRenderer(
new Font(
"SansSerif", Font.BOLD, 36));
76 Assert.assertNotNull(renderer);
81 final PrintStream nullStream =
new PrintStream(
new OutputStream(){
public void write(
final int b){}});
85 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) {
99 if (disallowedMethodCalls.equals(
"")) {
100 if (testNumber == 1) {
102 renderer.
setColor(1.0f, 1.0f, 1.0f, 1.0f);
103 renderer.
draw(text, 0, 0);
106 if (testNumber == 2) {
108 renderer.
setColor(1.0f, 1.0f, 1.0f, 1.0f);
109 renderer.
draw3D(text, 0, 0, 0, 0.002f);
116 if (!disallowedMethodCalls.equals(
"")) {
117 disallowedMethodCalls +=
", ";
119 disallowedMethodCalls += method;
123 return this.disallowedMethodCalls;
Provides access to the OpenGL Utility Library (GLU).
void gluOrtho2D(float left, float right, float bottom, float top)
TextRendererGLEventListener01(final int testNumber)
void disallowedMethodCalled(final String method)
void display(final GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
void dispose(final GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
String getDisallowedMethodCalls()
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.
Renders bitmapped Java 2D text into an OpenGL window with high performance, full Unicode support,...
void beginRendering(final int width, final int height)
Begins rendering with this TextRenderer into the current OpenGL drawable, pushing the projection and ...
void endRendering()
Ends a render cycle with this TextRenderer.
void draw(final CharSequence str, final int x, final int y)
Draws the supplied CharSequence at the desired location using the renderer's current color.
void begin3DRendering()
Begins rendering of 2D text in 3D with this TextRenderer into the current OpenGL drawable.
void setColor(final Color color)
Changes the current color of this TextRenderer to the supplied one.
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 setUseVertexArrays(final boolean useVertexArrays)
Sets whether vertex arrays are being used internally for rendering, or whether text is rendered using...
void end3DRendering()
Ends a 3D render cycle with this TextRenderer.
void dispose()
Disposes of all resources this TextRenderer is using.
final boolean getUseVertexArrays()
Indicates whether vertex arrays are being used internally for rendering, or whether text is rendered ...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
GL setGL(GL gl)
Sets the GL pipeline object this GLAutoDrawable uses.
GL2 getGL2()
Casts this object to the GL2 interface.
int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
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.