28package com.jogamp.opengl.demos.graph;
30import com.jogamp.opengl.GLCapabilities;
31import com.jogamp.opengl.GLProfile;
32import com.jogamp.opengl.demos.util.MiscUtils;
35import java.io.IOException;
37import com.jogamp.common.util.InterruptSource;
38import com.jogamp.graph.curve.Region;
39import com.jogamp.graph.font.Font;
40import com.jogamp.graph.font.FontFactory;
41import com.jogamp.graph.font.FontScale;
42import com.jogamp.math.geom.AABBox;
43import com.jogamp.newt.MonitorDevice;
44import com.jogamp.newt.event.KeyAdapter;
45import com.jogamp.newt.event.KeyEvent;
46import com.jogamp.newt.event.WindowAdapter;
47import com.jogamp.newt.event.WindowEvent;
48import com.jogamp.newt.opengl.GLWindow;
49import com.jogamp.opengl.util.Animator;
62 static final boolean DEBUG =
false;
63 static final boolean TRACE =
false;
65 static int SceneMSAASamples = 0;
66 static int GraphVBAASamples = 4;
67 static int GraphMSAASamples = 0;
69 public static void main(
final String[] args)
throws IOException {
71 int opt_fontSizeHead = -1;
72 int width = 800, height = 400;
74 if( 0 != args.length ) {
75 for(
int i=0; i<args.length; i++) {
76 if(args[i].equals(
"-smsaa")) {
81 }
else if(args[i].equals(
"-gmsaa")) {
86 }
else if(args[i].equals(
"-gvbaa")) {
91 }
else if(args[i].equals(
"-width")) {
94 }
else if(args[i].equals(
"-height")) {
97 }
else if(args[i].equals(
"-x")) {
100 }
else if(args[i].equals(
"-y")) {
103 }
else if(args[i].equals(
"-font")) {
106 }
else if(args[i].equals(
"-fontSize")) {
108 opt_fontSizeHead =
MiscUtils.
atoi(args[i], opt_fontSizeHead);
112 System.err.println(
"Desired win size "+width+
"x"+height);
113 System.err.println(
"Desired win pos "+x+
"/"+y);
114 System.err.println(
"Scene MSAA Samples "+SceneMSAASamples);
115 System.err.println(
"Graph MSAA Samples "+GraphMSAASamples);
116 System.err.println(
"Graph VBAA Samples "+GraphVBAASamples);
122 if( SceneMSAASamples > 0 ) {
126 System.out.println(
"Requested: " + caps);
130 if( GraphVBAASamples > 0 ) {
132 sampleCount += GraphVBAASamples;
133 }
else if( GraphMSAASamples > 0 ) {
135 sampleCount += GraphMSAASamples;
141 window.
setTitle(
"GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+
" msaa"+GraphMSAASamples+
"], msaa "+SceneMSAASamples);
144 textGLListener.
setFont(opt_font);
153 final float font_ptpi = 12f;
156 System.err.println(
"GPU Text Newt Demo: "+font2.
fullString());
157 System.err.println(
"GPU Text Newt Demo: screen-dpi: "+sDPI[0]+
"x"+sDPI[1]+
", font "+font_ptpi+
" pt, "+font_ppi+
" pixel");
158 System.err.println(
"GPU Text Newt Demo: textX2: "+fontNameBox+
" em, "+fontNameBox.
scale(font_ppi)+
" px");
160 System.err.println(
"GPU Text Newt Demo: "+monitor);
167 animator.
add(window);
171 public void keyPressed(
final KeyEvent arg0) {
174 new InterruptSource.Thread( () -> { window.
destroy(); } ).start();
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
static final int MSAA_RENDERING_BIT
Rendering-Mode bit for Region.
static final int DEFAULT_AA_QUALITY
Default pass2 AA-quality rendering {@value} for Graph Region AA render-modes: VBAA_RENDERING_BIT.
static final int VBAA_RENDERING_BIT
Rendering-Mode bit for Region.
The optional property jogamp.graph.font.ctor allows user to specify the FontConstructor implementatio...
static final FontSet get(final int font)
Simple static font scale methods for unit conversions.
static float[] ppmmToPPI(final float[] ppmm)
Converts [1/mm] to [1/inch] in place.
static float toPixels(final float points, final float res_dpi)
Converts typical font size in points and screen resolution in dpi (pixels-per-inch) to font size in p...
Axis Aligned Bounding Box.
final AABBox scale(final float s)
Scale this AABBox by a constant around fixed center.
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
Visual output device, i.e.
static final short VK_F4
Constant for the F4 function key.
static final short VK_ESCAPE
Constant for the ESCAPE function key.
final short getKeySymbol()
Returns the virtual key symbol reflecting the current keyboard layout.
static final short VK_Q
See VK_A.
NEWT Window events are provided for notification purposes ONLY.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final void setPosition(final int x, final int y)
Sets the location of the window's client area excluding insets (window decorations) in window units.
final void setTitle(final String title)
final float[] getPixelsPerMM(final float[] ppmmStore)
Returns the pixels per millimeter of this window's NativeSurface according to the main monitor's curr...
final void addKeyListener(final KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
final void setSize(final int width, final int height)
Sets the size of the window's client area in window units, excluding decorations.
final MonitorDevice getMainMonitor()
Returns the MonitorDevice with the highest viewport coverage of this window.
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
final void addWindowListener(final WindowListener l)
Appends the given com.jogamp.newt.event.WindowListener to the end of the list.
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
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 setNumSamples(final int numSamples)
If sample buffers are enabled, indicates the number of buffers to be allocated.
void setSampleBuffers(final boolean enable)
Defaults to false.
Specifies the the OpenGL profile.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
static void main(final String[] args)
GPURendererListenerBase01 Keys:
void setFontHeadSize(final int v)
boolean setFont(final Font _font)
static final String textX1
static int atoi(final String str, final int def)
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.
Interface wrapper for font implementation.
AABBox getMetricBounds(final CharSequence string)
Returns metric-bounds in font em-size.
String fullString()
Returns all font details as string.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.