28package com.jogamp.opengl.test.junit.jogl.caps;
30import java.nio.ByteBuffer;
32import com.jogamp.opengl.GL;
33import com.jogamp.opengl.GL2;
34import com.jogamp.opengl.GLAutoDrawable;
35import com.jogamp.opengl.GLCapabilities;
36import com.jogamp.opengl.GLCapabilitiesImmutable;
37import com.jogamp.opengl.GLDrawableFactory;
38import com.jogamp.opengl.GLEventListener;
39import com.jogamp.opengl.GLProfile;
40import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
42import org.junit.Assert;
44import org.junit.FixMethodOrder;
45import org.junit.runners.MethodSorters;
47import com.jogamp.opengl.test.junit.util.UITestCase;
48import com.jogamp.opengl.util.GLReadBufferUtil;
50@FixMethodOrder(MethodSorters.NAME_ASCENDING)
86 public void reshape(
final GLAutoDrawable glDrawable,
final int x,
final int y,
final int w,
final int h) {}
87 public void displayChanged(
final GLAutoDrawable drawable,
final boolean modeChanged,
final boolean deviceChanged) {}
91 static final int green = 0x0000ff00;
92 static final int red = 0x00ff0000;
94 private int getRGB(
final ByteBuffer bb,
final int o) {
95 return ( bb.get(o+0) & 0x000000ff ) << 16 |
96 ( bb.get(o+1) & 0x000000ff ) << 8 |
97 ( bb.get(o+2) & 0x000000ff );
100 private void testFlipped(
final ByteBuffer bb,
final int width,
final int height,
final int comp) {
104 final int below = getRGB(bb, 0);
105 System.err.println(
"below: 0x"+Integer.toHexString(below));
108 final int above= getRGB(bb, ( height - 1 ) * ( width * comp ));
109 System.err.println(
"above: 0x"+Integer.toHexString(above));
111 if (above == green && below == red) {
112 System.out.println(
"Image right side up");
113 }
else if (above == red && below == green) {
114 Assert.assertTrue(
"Image is flipped",
false);
116 Assert.assertTrue(
"Error in test",
false);
124 final FlippedImageTest tglel =
new FlippedImageTest();
176 public static void main(
final String[] args) {
Specifies a set of OpenGL capabilities.
void setPBuffer(final boolean enable)
Requesting offscreen pbuffer mode.
void setAccumRedBits(final int accumRedBits)
Sets the number of bits requested for the accumulation buffer's red component.
void setStencilBits(final int stencilBits)
Sets the number of bits requested for the stencil buffer.
void setAccumGreenBits(final int accumGreenBits)
Sets the number of bits requested for the accumulation buffer's green component.
void setFBO(final boolean enable)
Requesting offscreen FBO mode.
void setAccumBlueBits(final int accumBlueBits)
Sets the number of bits requested for the accumulation buffer's blue component.
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 get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
static final String GL2
The desktop OpenGL profile 1.x up to 3.0.
void test01DefaultPBuffer()
static void main(final String[] args)
void test01AccumStencilPBuffer()
void setMakeSnapshotAlways(final boolean v)
final Buffer buffer
Buffer holding the pixel data.
Utility to read out the current FB to TextureData, optionally writing the data back to a texture obje...
GLPixelBuffer getPixelBuffer()
Returns the GLPixelBuffer, created and filled by readPixels(GLAutoDrawable, boolean).
static final int GL_ACCUM_BUFFER_BIT
GL_VERSION_1_0 Define "GL_ACCUM_BUFFER_BIT" with expression '0x00000200', CType: int
static final int GL_ACCUM
GL_VERSION_1_0 Define "GL_ACCUM" with expression '0x0100', CType: int
static final int GL_RETURN
GL_VERSION_1_0 Define "GL_RETURN" with expression '0x0102', CType: int
void glAccum(int op, float value)
Entry point to C language function: void {@native glAccum}(GLenum op, GLfloat value) Part of GL_VE...
void glColor3f(float red, float green, float blue)
Entry point to C language function: void {@native glColor3f}(GLfloat red, GLfloat green,...
void glRectf(float x1, float y1, float x2, float y2)
Entry point to C language function: void {@native glRectf}(GLfloat x1, GLfloat y1,...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
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.
GL2 getGL2()
Casts this object to the GL2 interface.
Specifies an immutable set of OpenGL capabilities.
int getAccumGreenBits()
Returns the number of bits for the accumulation buffer's green component.
GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
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.
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.
static final int GL_VERSION
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_VERSION" with express...
static final int GL_COLOR_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_COLOR_BUFFER_BIT" wit...
void glClearColor(float red, float green, float blue, float alpha)
Entry point to C language function: void {@native glClearColor}(GLfloat red, GLfloat green,...
String glGetString(int name)
Entry point to C language function: const GLubyte * {@native glGetString}(GLenum name) Part of GL_...
static final int GL_RENDERER
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_RENDERER" with expres...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
void glFinish()
Entry point to C language function: void {@native glFinish}() Part of GL_ES_VERSION_2_0,...
static final int GL_STENCIL_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_STENCIL_BUFFER_BIT" w...
static final int GL_DEPTH_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_BUFFER_BIT" wit...
Subset of OpenGL fixed function pipeline's matrix operations.
static final int GL_PROJECTION
Matrix mode projection.
static final int GL_MODELVIEW
Matrix mode modelview.
void glLoadIdentity()
Load the current matrix with the identity matrix.
void glMatrixMode(int mode)
Sets the current matrix mode.