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;
68 System.out.println(
"Requested GL Caps: "+reqGLCaps);
70 final GLCapabilitiesImmutable expGLCaps = GLGraphicsConfigurationUtil.fixGLCapabilities(reqGLCaps, factory,
null);
71 System.out.println(
"Expected GL Caps: "+expGLCaps);
79 Assert.assertNotNull(glad);
80 System.out.println(
"Drawable Pre-GL(0): "+glad.getClass().getName()+
", "+glad.
getNativeSurface().getClass().getName());
85 System.out.println(
"Drawable Caps Pre_GL : "+chosenCaps);
86 Assert.assertNotNull(chosenCaps);
96 System.out.println(
"Chosen GL Caps(1): "+chosenGLCaps);
99 Assert.assertNotNull(chosenGLCaps);
102 Assert.assertTrue(chosenGLCaps.
getRedBits()>4);
105 Assert.assertEquals(expGLCaps.
isFBO(), chosenGLCaps.
isFBO());
146 System.out.println(
"Fin Drawable: "+glad);
155 doTest(reqGLCaps,
new Gears(1));
166 doTest(reqGLCaps,
new Gears(1));
169 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.
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.
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 GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
Toolkit agnostic GLOffscreenAutoDrawable tests using the factory model.
void testGL2OffScreenBitmapDblBuf()
static void main(final String args[])
void testGL2OffScreenBitmapDblBufMSAA()
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.