29package com.jogamp.opengl.test.junit.jogl.offscreen;
31import com.jogamp.newt.Display;
32import com.jogamp.newt.NewtFactory;
33import com.jogamp.newt.Screen;
34import com.jogamp.newt.Window;
35import com.jogamp.newt.opengl.GLWindow;
36import org.junit.AfterClass;
37import org.junit.Assert;
38import org.junit.Before;
39import org.junit.BeforeClass;
41import org.junit.FixMethodOrder;
42import org.junit.runners.MethodSorters;
44import com.jogamp.opengl.*;
46import com.jogamp.opengl.test.junit.util.UITestCase;
47import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
48import java.io.IOException;
50@FixMethodOrder(MethodSorters.NAME_ASCENDING)
54 static int width, height;
60 Assert.assertNotNull(glpDefault);
62 System.out.println(
"INFO: PBuffer supported: "+ glDrawableFactory.
canCreateGLPbuffer(
null, glpDefault));
74 Assert.assertNotNull(capsDefault);
78 private void do01OffscreenWindowPBuffer(
final GLCapabilities caps) {
80 Assert.assertNotNull(display);
82 Assert.assertNotNull(screen);
84 Assert.assertNotNull(window);
87 Assert.assertNotNull(glWindow);
115 System.out.println(
"WARNING: PBuffer not supported on this platform - cannot test");
119 do01OffscreenWindowPBuffer(caps2);
125 System.out.println(
"WARNING: PBuffer not supported on this platform - cannot test");
130 do01OffscreenWindowPBuffer(caps2);
136 System.out.println(
"WARNING: PBuffer not supported on this platform - cannot test");
142 do01OffscreenWindowPBuffer(caps2);
148 System.out.println(
"WARNING: PBuffer not supported on this platform - cannot test");
155 do01OffscreenWindowPBuffer(caps2);
161 System.out.println(
"WARNING: PBuffer not supported on this platform - cannot test");
165 final int winnum = 3;
172 Assert.assertNotNull(display);
174 Assert.assertNotNull(screen);
176 for(i=0; i<winnum; i++) {
177 System.out.println(
"Create Window "+i);
179 Assert.assertNotNull(windows[i]);
180 windows[i].
setSize(width, height);
182 Assert.assertNotNull(glWindows[i]);
190 while ( glWindows[0].getTotalFPSFrames() < 2) {
191 for(i=0; i<winnum; i++) {
196 for(i=0; i<winnum; i++) {
197 if(
null!=glWindows[i]) {
200 if(
null!=windows[i]) {
215 System.out.println(
"WARNING: PBuffer not supported on this platform - cannot test");
219 final int winnum = 3;
227 for(i=0; i<winnum; i++) {
228 System.out.println(
"Create Window "+i);
230 Assert.assertNotNull(displays[i]);
232 Assert.assertNotNull(screens[i]);
234 Assert.assertNotNull(windows[i]);
235 windows[i].
setSize(width, height);
237 Assert.assertNotNull(glWindows[i]);
244 while ( glWindows[0].getTotalFPSFrames() < 2) {
245 for(i=0; i<winnum; i++) {
250 for(i=0; i<winnum; i++) {
251 if(
null!=glWindows[i]) {
254 if(
null!=windows[i]) {
257 if(
null!=screens[i]) {
260 if(
null!=displays[i]) {
269 System.out.println(
"WARNING: PBuffer not supported on this platform - cannot test");
274 System.out.println(
"Create Window 1");
276 Assert.assertNotNull(display);
278 Assert.assertNotNull(screen);
280 Assert.assertNotNull(window);
283 Assert.assertNotNull(glWindow);
303 public static void main(
final String args[])
throws IOException {
305 org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
main(
new String[] {
309 "haltOnFailure=false",
311 "outputtoformatters=true",
312 "logfailedtests=true",
313 "logtestlistenerevents=true",
314 "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
315 "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+
".xml" } );
void setRedBits(final int redBits)
Sets the number of bits requested for the color buffer's red component.
void setGreenBits(final int greenBits)
Sets the number of bits requested for the color buffer's green component.
void setBlueBits(final int blueBits)
Sets the number of bits requested for the color buffer's blue component.
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
abstract void destroy()
Manually trigger the destruction, incl.
static Display createDisplay(final String name)
Create a Display entity.
static Window createWindow(final CapabilitiesImmutable caps)
Create a top level Window entity on the default Display and default Screen.
static Screen createScreen(final Display display, final int index)
Create a Screen entity.
A screen may span multiple MonitorDevices representing their combined virtual size.
abstract void destroy()
Manually trigger the destruction, incl.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
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 setStencilBits(final int stencilBits)
Sets the number of bits requested for the stencil buffer.
final GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp)
Returns true if it is possible to create an pbuffer surface.
static GLDrawableFactory getFactory(final GLProfile glProfile)
Returns the sole GLDrawableFactory instance.
Specifies the the OpenGL profile.
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
void test01bOffscreenWindowPBufferStencil()
static void releaseClass()
void test01aOffscreenWindowPBuffer()
void test01cOffscreenWindowPBufferStencilAlpha()
void test04OffscreenSnapshotWithDemoPBuffer()
static void main(final String args[])
void test03Offscreen3Windows3DisplaysPBuffer()
void test01cOffscreenWindowPBuffer555()
void test02Offscreen3Windows1DisplayPBuffer()
static void setDemoFields(final GLEventListener demo, final Window window, final GLWindow glWindow, final boolean debug)
static void run(final String testName, final GLWindow windowOffScreen, final GLEventListener demo, final GLWindow windowOnScreenBlit, final WindowListener wl, final MouseListener ml, final SurfaceUpdatedListener ul, final int frames, final boolean snapshot, final boolean debug)
static GLCapabilities fixCaps(final GLCapabilities caps, final boolean onscreen, final boolean pbuffer, final boolean undecorated)
Specifying NEWT's Window functionality:
void setSize(int width, int height)
Sets the size of the window's client area in window units, excluding decorations.
void destroy()
Destroys this window incl.releasing all related resources.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.