29package com.jogamp.opengl.test.junit.jogl.acore;
31import java.io.IOException;
33import com.jogamp.nativewindow.CapabilitiesImmutable;
34import com.jogamp.opengl.GLAutoDrawable;
35import com.jogamp.opengl.GLCapabilities;
36import com.jogamp.opengl.GLCapabilitiesImmutable;
37import com.jogamp.opengl.GLContext;
38import com.jogamp.opengl.GLDrawable;
39import com.jogamp.opengl.GLDrawableFactory;
40import com.jogamp.opengl.GLEventListener;
41import com.jogamp.opengl.GLProfile;
43import jogamp.opengl.GLGraphicsConfigurationUtil;
45import org.junit.Assert;
47import org.junit.FixMethodOrder;
48import org.junit.runners.MethodSorters;
50import com.jogamp.newt.opengl.GLWindow;
51import com.jogamp.opengl.JoglVersion;
52import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
53import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
54import com.jogamp.opengl.test.junit.util.GLTestUtil;
55import com.jogamp.opengl.test.junit.util.NewtTestUtil;
56import com.jogamp.opengl.test.junit.util.UITestCase;
64@FixMethodOrder(MethodSorters.NAME_ASCENDING)
66 static final int widthStep = 800/4;
67 static final int heightStep = 600/4;
68 volatile int szStep = 2;
71 void setMakeSnapshot();
76 System.err.println(
"Profile "+profile+
" n/a");
83 System.out.println(
"Requested GL Caps: "+reqGLCaps);
85 final GLCapabilitiesImmutable expGLCaps = GLGraphicsConfigurationUtil.fixGLCapabilities(reqGLCaps, factory,
null);
86 System.out.println(
"Expected GL Caps: "+expGLCaps);
91 Assert.assertNotNull(glad);
92 glad.
setSize(widthStep*szStep, heightStep*szStep);
96 System.out.println(
"Window: "+glad.getClass().getName());
100 System.out.println(
"Window Caps Pre_GL: "+chosenCaps);
101 Assert.assertNotNull(chosenCaps);
112 Assert.assertNotNull(actualDrawable);
113 System.out.println(
"Drawable Pre-GL(0): "+actualDrawable.getClass().getName()+
", "+actualDrawable.
getNativeSurface().getClass().getName());
117 System.out.println(
"Drawable Post-GL(1): "+glad.getClass().getName()+
", "+glad.
getNativeSurface().getClass().getName());
121 System.out.println(
"Chosen GL Caps(1): "+chosenGLCaps);
122 Assert.assertNotNull(chosenGLCaps);
125 Assert.assertTrue(chosenGLCaps.
getRedBits()>5);
128 Assert.assertEquals(expGLCaps.
isFBO(), chosenGLCaps.
isFBO());
140 System.out.println(
"Chosen GL CTX (2): "+context.
getGLVersion());
141 Assert.assertNotNull(context);
146 System.out.println(
"Drawable Post-GL(2): "+glad.getClass().getName()+
", "+glad.
getNativeSurface().getClass().getName());
157 Assert.assertTrue(
"Surface Size not reached: Expected "+expSurfaceSize[0]+
"x"+expSurfaceSize[1]+
", Is "+glad.
getSurfaceWidth()+
"x"+glad.
getSurfaceHeight(),
164 glad.
setSize(widthStep*szStep, heightStep*szStep);
165 expSurfaceSize[0] = widthStep*szStep;
166 expSurfaceSize[1] = heightStep*szStep;
168 Assert.assertTrue(
"Surface Size not reached: Expected "+expSurfaceSize[0]+
"x"+expSurfaceSize[1]+
", Is "+glad.
getSurfaceWidth()+
"x"+glad.
getSurfaceHeight(),
175 glad.
setSize(widthStep*szStep, heightStep*szStep);
176 expSurfaceSize[0] = widthStep*szStep;
177 expSurfaceSize[1] = heightStep*szStep;
179 Assert.assertTrue(
"Surface Size not reached: Expected "+expSurfaceSize[0]+
"x"+expSurfaceSize[1]+
", Is "+glad.
getSurfaceWidth()+
"x"+glad.
getSurfaceHeight(),
187 System.out.println(
"Fin: "+glad);
193 if(
null == reqGLCaps)
return;
201 if(
null == reqGLCaps)
return;
208 if(
null == reqGLCaps)
return;
216 if(
null == reqGLCaps)
return;
225 if(
null == reqGLCaps)
return;
235 if(
null == reqGLCaps)
return;
243 if(
null == reqGLCaps)
return;
253 if(
null == reqGLCaps)
return;
262 if(
null == reqGLCaps)
return;
272 if(
null == reqGLCaps)
return;
283 if(
null == reqGLCaps)
return;
295 if(
null == reqGLCaps)
return;
304 if(
null == reqGLCaps)
return;
314 if(
null == reqGLCaps)
return;
318 doTest(reqGLCaps,
new Gears(1));
324 if(
null == reqGLCaps)
return;
332 if(
null == reqGLCaps)
return;
339 if(
null == reqGLCaps)
return;
347 if(
null == reqGLCaps)
return;
356 if(
null == reqGLCaps)
return;
366 if(
null == reqGLCaps)
return;
374 if(
null == reqGLCaps)
return;
384 if(
null == reqGLCaps)
return;
393 if(
null == reqGLCaps)
return;
403 if(
null == reqGLCaps)
return;
414 if(
null == reqGLCaps)
return;
426 if(
null == reqGLCaps)
return;
435 if(
null == reqGLCaps)
return;
454 public static void main(
final String args[])
throws IOException {
void setBitmap(final boolean enable)
Requesting offscreen bitmap mode.
void setOnscreen(final boolean onscreen)
Sets whether the surface shall be on- or offscreen.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
final AbstractGraphicsConfiguration getGraphicsConfiguration()
Returns the graphics configuration corresponding to this window.
final int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
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 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 setPBuffer(final boolean enable)
Requesting offscreen pbuffer mode.
void setStencilBits(final int stencilBits)
Sets the number of bits requested for the stencil buffer.
void setDoubleBuffered(final boolean enable)
Enables or disables double buffering.
void setFBO(final boolean enable)
Requesting offscreen FBO mode.
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.
Abstraction for an OpenGL rendering context.
final boolean isCreated()
Indicates whether the underlying native OpenGL context has been created.
final String getGLVersion()
Returns a valid OpenGL version string, ie
static GLDrawableFactory getFactory(final GLProfile glProfile)
Returns the sole GLDrawableFactory instance.
Specifies the the OpenGL profile.
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
static final String GLES2
The embedded OpenGL profile ES 2.x, with x >= 0.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
static final String GL2
The desktop OpenGL profile 1.x up to 3.0.
Tests using a NEWT GLWindow auto drawable for on- and offscreen cases.
void testGL2OnScreenDblBuf()
void testGL2OnScreenDblBufStencil()
void testES2OffScreenFBOSglBuf()
void testES2OnScreenDblBuf()
void testGL2OffScreenFBODblBufMSAA()
void testES2OffScreenPbufferDblBuf()
void testES2OnScreenDblBufStencil()
void testES2OffScreenAutoDblBuf()
void testGL2OffScreenAutoDblBuf()
void testES2OnScreenSglBuf()
void testGL2OffScreenFBODblBuf()
static void main(final String args[])
Not implemented ! @Test public void testES2OffScreenBitmapDblBuf() throws InterruptedException { if(!...
void testGL2OffScreenPbufferSglBuf()
void testES2OffScreenFBODblBufMSAA()
void testES2OnScreenDblBufMSAA()
void testES2OffScreenFBODblBufStencil()
void testES2OffScreenFBODblBuf()
void testES2OffScreenPbufferSglBuf()
void testES2OnScreenDblBufStencilMSAA()
void testGL2OnScreenDblBufStencilMSAA()
void testGL2OffScreenFBODblBufStencil()
void testGL2OffScreenBitmapSglBuf()
void testGL2OnScreenSglBuf()
void testGL2OnScreenDblBufMSAA()
void testGL2OffScreenPbufferDblBuf()
void testGL2OffScreenFBOSglBuf()
void testES2OffScreenFBODblBufStencilMSAA()
void testGL2OffScreenFBODblBufStencilMSAA()
Gears.java author: Brian Paul (converted to Java by Ron Cemer and Sven Gothel)
static boolean waitForSize(final GLDrawable drawable, final int width, final int height, final Runnable waitAction)
static boolean waitForRealized(final Screen screen, final boolean realized, final Runnable waitAction)
static boolean waitForVisible(final Window win, final boolean visible, final Runnable waitAction)
CapabilitiesImmutable getChosenCapabilities()
Return the capabilities reflecting this graphics configuration, which may differ from the capabilitie...
Specifies an immutable set of capabilities that a window's rendering context must support,...
int getBlueBits()
Returns the number of bits for the color buffer's blue component.
boolean isBitmap()
Returns whether bitmap offscreen mode is requested, available or chosen.
int getRedBits()
Returns the number of bits for the color buffer's red component.
int getGreenBits()
Returns the number of bits for the color buffer's green component.
boolean isOnscreen()
Returns whether an on- or offscreen surface is requested, available or chosen.
int[] convertToPixelUnits(final int[] windowUnitsAndResult)
Converts the given window units into pixel units in place.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
GLContext getContext()
Returns the context associated with this drawable.
GLDrawable getDelegatedDrawable()
If the implementation uses delegation, return the delegated GLDrawable instance, otherwise return thi...
Specifies an immutable set of OpenGL capabilities.
int getDepthBits()
Returns the number of depth buffer bits.
boolean isPBuffer()
Returns whether pbuffer offscreen mode is requested, available or chosen.
GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
boolean isFBO()
Returns whether FBO offscreen mode is requested, available or chosen.
An abstraction for an OpenGL rendering target.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
NativeSurface getNativeSurface()
Returns the associated NativeSurface of this NativeSurfaceHolder.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.