29package com.jogamp.opengl.demos.graph;
31import com.jogamp.opengl.GLCapabilities;
32import com.jogamp.opengl.GLProfile;
33import com.jogamp.opengl.demos.util.MiscUtils;
34import com.jogamp.common.util.InterruptSource;
35import com.jogamp.graph.curve.Region;
36import com.jogamp.newt.event.KeyAdapter;
37import com.jogamp.newt.event.KeyEvent;
38import com.jogamp.newt.event.WindowAdapter;
39import com.jogamp.newt.event.WindowEvent;
40import com.jogamp.newt.opengl.GLWindow;
41import com.jogamp.opengl.util.Animator;
51 static final boolean DEBUG =
false;
52 static final boolean TRACE =
false;
54 static int shape_ctor_mode = 1;
55 static int SceneMSAASamples = 0;
56 static int GraphVBAASamples = 4;
57 static int GraphMSAASamples = 0;
58 static boolean GraphUseWeight =
true;
60 public static void main(
final String[] args) {
61 int width = 800, height = 400;
63 if( 0 != args.length ) {
67 GraphUseWeight =
false;
69 for(
int i=0; i<args.length; i++) {
70 if(args[i].equals(
"-smsaa")) {
73 }
else if(args[i].equals(
"-gmsaa")) {
77 }
else if(args[i].equals(
"-gvbaa")) {
81 }
else if(args[i].equals(
"-gweight")) {
82 GraphUseWeight =
true;
83 }
else if(args[i].equals(
"-width")) {
86 }
else if(args[i].equals(
"-height")) {
89 }
else if(args[i].equals(
"-x")) {
92 }
else if(args[i].equals(
"-y")) {
95 }
else if(args[i].equals(
"-shape_ctor")) {
101 System.err.println(
"Desired win size "+width+
"x"+height);
102 System.err.println(
"Desired win pos "+x+
"/"+y);
103 System.err.println(
"Shape_ctor_mode "+shape_ctor_mode);
104 System.err.println(
"Scene MSAA Samples "+SceneMSAASamples);
105 System.err.println(
"Graph MSAA Samples"+GraphMSAASamples);
106 System.err.println(
"Graph VBAA Samples "+GraphVBAASamples);
107 System.err.println(
"Graph Weight Mode "+GraphUseWeight);
112 if( SceneMSAASamples > 0 ) {
116 System.out.println(
"Requested: " + caps);
118 int rmode = GraphUseWeight ? Region.VARWEIGHT_RENDERING_BIT : 0;
120 if( GraphVBAASamples > 0 ) {
122 sampleCount += GraphVBAASamples;
123 }
else if( GraphMSAASamples > 0 ) {
125 sampleCount += GraphMSAASamples;
131 window.
setTitle(
"GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+
" msaa"+GraphMSAASamples+
"], msaa "+SceneMSAASamples);
141 animator.
add(window);
145 public void keyPressed(
final KeyEvent arg0) {
148 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.
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
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 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 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.
Demonstrate the rendering of multiple outlines into one region/OutlineShape These Outlines are not ne...
Demonstrate the rendering of multiple outlines into one region/OutlineShape These Outlines are not ne...
static void main(final String[] args)
void attachInputListenerTo(final GLWindow window)
Attach the input listener to the window.
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.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.