28package com.jogamp.opengl.test.junit.graph;
30import java.io.IOException;
32import com.jogamp.opengl.GLAutoDrawable;
33import com.jogamp.opengl.GLCapabilities;
34import com.jogamp.opengl.GLCapabilitiesImmutable;
35import com.jogamp.opengl.GLEventListener;
36import com.jogamp.opengl.GLException;
37import com.jogamp.opengl.GLProfile;
39import jogamp.common.os.PlatformPropsImpl;
41import org.junit.Assert;
43import org.junit.FixMethodOrder;
44import org.junit.runners.MethodSorters;
46import com.jogamp.common.os.Platform;
47import com.jogamp.graph.curve.Region;
48import com.jogamp.newt.opengl.GLWindow;
49import com.jogamp.opengl.test.junit.util.UITestCase;
52@FixMethodOrder(MethodSorters.NAME_ASCENDING)
55 public static void main(
final String args[])
throws IOException {
57 org.junit.runner.JUnitCore.
main(tstname);
60 static void destroyWindow(
final GLWindow window) {
66 static GLWindow createWindow(
final String title,
final GLCapabilitiesImmutable caps,
final int width,
final int height) {
67 Assert.assertNotNull(caps);
69 final GLWindow window = GLWindow.
create(caps);
71 window.setPosition(10, 10);
72 window.setTitle(title);
73 Assert.assertNotNull(window);
74 window.setVisible(
true);
86 final GLWindow window = createWindow(
"t00-shape-vbaa0-msaa0", caps, 800, 400);
92 final RegionGLListener listener =
new RegionGLListener(demo01Listener, window.
getTitle(),
"GPURegion01");
95 listener.setTech(-20, 0, -300, 0f, 2);
98 listener.setTech(-20, 0, -150, 0f, 3);
101 listener.setTech(-20, 0, -50, 0f, 4);
104 destroyWindow(window);
109 if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) {
112 System.err.println(
"disabled on non desktop (x86) arch for now ..");
119 final GLWindow window = createWindow(
"t01-shape-vbaa0-msaa0", caps, 800, 400);
125 final RegionGLListener listener =
new RegionGLListener(demo01Listener, window.
getTitle(),
"GPURegion02");
128 listener.setTech(-20, 0, -300, 0f, 2);
131 listener.setTech(-20, 0, -150, 0f, 3);
134 listener.setTech(-20, 0, -50, 0f, 4);
137 destroyWindow(window);
149 final GLWindow window = createWindow(
"t10-shape-vbaa0-msaa1", caps, 800, 400);
155 final RegionGLListener listener =
new RegionGLListener(demo01Listener, window.
getTitle(),
"GPURegion01");
158 listener.setTech(-20, 00, -300, 0f, 2);
161 listener.setTech(-20, 00, -150, 0f, 3);
164 listener.setTech(-20, 00, -50, 0f, 4);
167 destroyWindow(window);
172 if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) {
175 System.err.println(
"disabled on non desktop (x86) arch for now ..");
184 final GLWindow window = createWindow(
"t11-shape-vbaa0-msaa1", caps, 800, 400);
190 final RegionGLListener listener =
new RegionGLListener(demo01Listener, window.
getTitle(),
"GPURegion02");
193 listener.setTech(-20, 00, -300, 0f, 2);
196 listener.setTech(-20, 00, -150, 0f, 3);
199 listener.setTech(-20, 00, -50, 0f, 4);
202 destroyWindow(window);
207 if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) {
209 System.err.println(
"disabled on non desktop (x86) arch for now ..");
218 final GLWindow window = createWindow(
"t20-shape-vbaa1-msaa0", caps, 800,400);
223 final RegionGLListener listener =
new RegionGLListener(demo02Listener, window.
getTitle(),
"GPURegionNewtDemo02");
226 listener.setTech(-20, 00, -300, 0f, 2);
229 listener.setTech(-20, 00, -150, 0f, 3);
232 listener.setTech(-20, 00, -50, 0f, 4);
235 destroyWindow(window);
238 private void test30RegionRendererShapesImpl(
final GLCapabilities caps,
final int shape_ctor_mode)
throws InterruptedException {
239 final GLWindow window = createWindow(
"t30-shape0"+shape_ctor_mode+
"-vbaa0-msaa1", caps, 800, 400);
245 final RegionGLListener listener =
new RegionGLListener(demo01Listener, window.
getTitle(),
"GPURegion01");
249 listener.setTech(-20, 00, -50, 0f, 4);
252 destroyWindow(window);
264 test30RegionRendererShapesImpl(caps, 1);
265 test30RegionRendererShapesImpl(caps, 2);
266 test30RegionRendererShapesImpl(caps, 3);
267 test30RegionRendererShapesImpl(caps, 4);
277 this.winTitle = title;
281 public void setTech(
final float xt,
final float yt,
final int zt,
final float angle,
final int sampleCount){
296 impl.
printScreen(drawable,
"./", winTitle, name,
false);
297 }
catch (
final GLException e) {
299 }
catch (
final IOException e) {
305 public void dispose(
final GLAutoDrawable drawable) {
311 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) {
312 impl.
reshape(drawable, x, y, width, height);
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
static final int VARWEIGHT_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.
final int setSampleCount(final int v)
Sets pass2 AA sample count clipped to the range [Region#MIN_AA_SAMPLE_COUNT..Region#MAX_AA_SAMPLE_COU...
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
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 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 final String GL2ES2
The intersection of the desktop GL3, GL2 and embedded ES2 profile.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
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 OutlineShapes into one region.
void setMatrix(final float xtrans, final float ytrans, final float zTran, final float angle)
void dispose(final GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
void reshape(final GLAutoDrawable drawable, final int xstart, final int ystart, final int width, final int height)
Called by the drawable during the first repaint after the component has been resized.
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha)
void attachInputListenerTo(final GLWindow window)
Attach the input listener to the window.
final RegionRenderer getRenderer()
void test20RegionRendererR2T01()
void test10RegionRendererMSAA01()
void test30RegionRendererShapes()
void test01RegionRendererNONE02()
static void main(final String args[])
void test11RegionRendererMSAA02()
void test00RegionRendererNONE01()
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Specifies an immutable set of OpenGL capabilities.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
void display(GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.