29package com.jogamp.opengl.test.junit.jogl.acore;
31import java.io.IOException;
33import com.jogamp.nativewindow.CapabilitiesImmutable;
34import com.jogamp.opengl.GLCapabilities;
35import com.jogamp.opengl.GLCapabilitiesImmutable;
36import com.jogamp.opengl.GLContext;
37import com.jogamp.opengl.GLDrawableFactory;
38import com.jogamp.opengl.GLEventListener;
39import com.jogamp.opengl.GLOffscreenAutoDrawable;
40import com.jogamp.opengl.GLProfile;
42import jogamp.opengl.GLGraphicsConfigurationUtil;
44import org.junit.Assert;
46import org.junit.FixMethodOrder;
47import org.junit.runners.MethodSorters;
49import com.jogamp.opengl.JoglVersion;
50import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
51import com.jogamp.opengl.test.junit.util.GLTestUtil;
52import com.jogamp.opengl.test.junit.util.UITestCase;
61@FixMethodOrder(MethodSorters.NAME_ASCENDING)
63 static final int widthStep = 800/4;
64 static final int heightStep = 600/4;
65 volatile int szStep = 2;
69 System.err.println(
"Profile "+profile+
" n/a");
76 System.out.println(
"Requested GL Caps: "+reqGLCaps);
78 final GLCapabilitiesImmutable expGLCaps = GLGraphicsConfigurationUtil.fixGLCapabilities(reqGLCaps, factory,
null);
79 System.out.println(
"Expected GL Caps: "+expGLCaps);
87 Assert.assertNotNull(glad);
88 System.out.println(
"Drawable Pre-GL(0): "+glad.getClass().getName()+
", "+glad.
getNativeSurface().getClass().getName());
93 System.out.println(
"Drawable Caps Pre_GL : "+chosenCaps);
94 Assert.assertNotNull(chosenCaps);
104 System.out.println(
"Chosen GL Caps(1): "+chosenGLCaps);
107 Assert.assertNotNull(chosenGLCaps);
110 Assert.assertTrue(chosenGLCaps.
getRedBits()>4);
113 Assert.assertEquals(expGLCaps.
isFBO(), chosenGLCaps.
isFBO());
154 System.out.println(
"Fin Drawable: "+glad);
160 if(
null == reqGLCaps)
return;
162 doTest(reqGLCaps,
new Gears(1));
168 if(
null == reqGLCaps)
return;
171 doTest(reqGLCaps,
new Gears(1));
177 if(
null == reqGLCaps)
return;
181 doTest(reqGLCaps,
new Gears(1));
187 if(
null == reqGLCaps)
return;
191 doTest(reqGLCaps,
new Gears(1));
197 if(
null == reqGLCaps)
return;
202 doTest(reqGLCaps,
new Gears(1));
208 if(
null == reqGLCaps)
return;
214 doTest(reqGLCaps,
new Gears(1));
220 if(
null == reqGLCaps)
return;
223 doTest(reqGLCaps,
new Gears(1));
229 if(
null == reqGLCaps)
return;
233 doTest(reqGLCaps,
new Gears(1));
240 if(
null == reqGLCaps)
return;
244 doTest(reqGLCaps,
new Gears(1));
251 if(
null == reqGLCaps)
return;
256 doTest(reqGLCaps,
new Gears(1));
263 if(
null == reqGLCaps)
return;
269 doTest(reqGLCaps,
new Gears(1));
277 if(
null == reqGLCaps)
return;
280 doTest(reqGLCaps,
new Gears(1));
286 if(
null == reqGLCaps)
return;
293 doTest(reqGLCaps,
new Gears(1));
299 if(
null == reqGLCaps)
return;
306 doTest(reqGLCaps,
new Gears(1));
312 if(
null == reqGLCaps)
return;
319 doTest(reqGLCaps,
new Gears(1));
325 if(
null == reqGLCaps)
return;
329 doTest(reqGLCaps,
new Gears(1));
336 if(
null == reqGLCaps)
return;
340 doTest(reqGLCaps,
new Gears(1));
347 if(
null == reqGLCaps)
return;
352 doTest(reqGLCaps,
new Gears(1));
359 if(
null == reqGLCaps)
return;
365 doTest(reqGLCaps,
new Gears(1));
368 public static void main(
final String args[])
throws IOException {
void setRedBits(final int redBits)
Sets the number of bits requested for the color buffer's red component.
void setBitmap(final boolean enable)
Requesting offscreen bitmap mode.
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.
void setOnscreen(final boolean onscreen)
Sets whether the surface shall be on- or offscreen.
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.
final String getGLVersion()
Returns a valid OpenGL version string, ie
abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, int width, int height)
Creates a realized GLOffscreenAutoDrawable incl it's offscreen NativeSurface with the given capabilit...
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 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.
Toolkit agnostic GLOffscreenAutoDrawable tests using the factory model.
void testGL2OffScreenFBODblBufStencilMSAA()
void testGL2OffScreenBitmapDblBufRGBA8881()
static void main(final String args[])
void testGL2OffScreenBitmapDblBufRGBA5551()
void testGL2OffScreenPbufferDblBufMSAA()
void testGL2OffScreenFBODblBuf()
void testGL2OffScreenBitmapDblBufStencil()
void testGL2OffScreenBitmapDblBufMSAA()
void testGL2OffScreenFBODblBufMSAA()
void testGL2OffScreenBitmapDblBufStencilMSAA()
void testGL2OffScreenFBOSglBuf()
void testGL2OffScreenBitmapDblBufRGB555()
void testGL2OffScreenPbufferSglBuf()
void testGL2OffScreenBitmapDblBuf()
void testGL2OffScreenPbufferDblBuf()
void testGL2OffScreenBitmapSglBuf()
void testGL2OffScreenFBODblBufStencil()
void testGL2OffScreenPbufferDblBufStencil()
void testGL2OffScreenAutoDblBuf()
void testGL2OffScreenPbufferDblBufStencilMSAA()
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)
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.
AbstractGraphicsConfiguration getGraphicsConfiguration()
Returns the graphics configuration corresponding to this window.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
GLContext getContext()
Returns the context associated with this drawable.
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.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
boolean isRealized()
Returns true if this drawable is realized, otherwise false.
NativeSurface getNativeSurface()
Returns the associated NativeSurface of this NativeSurfaceHolder.
int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
Platform-independent GLAutoDrawable specialization, exposing offscreen functionality.
void setSurfaceSize(int newWidth, int newHeight)
Resize this GLAutoDrawable's surface.