28package com.jogamp.opengl.test.junit.jogl.acore;
30import java.awt.image.BufferedImage;
32import java.io.IOException;
34import javax.imageio.ImageIO;
35import com.jogamp.opengl.GL;
36import com.jogamp.opengl.GL2;
37import com.jogamp.opengl.GLCapabilities;
38import com.jogamp.opengl.GLContext;
39import com.jogamp.opengl.GLDrawable;
40import com.jogamp.opengl.GLDrawableFactory;
41import com.jogamp.opengl.GLProfile;
42import com.jogamp.opengl.fixedfunc.GLLightingFunc;
44import org.junit.FixMethodOrder;
46import org.junit.runners.MethodSorters;
48import com.jogamp.opengl.test.junit.util.UITestCase;
49import com.jogamp.opengl.util.GLReadBufferUtil;
50import com.jogamp.opengl.util.awt.AWTGLReadBufferUtil;
52@FixMethodOrder(MethodSorters.NAME_ASCENDING)
83 ImageIO.write(image,
"PNG",
new File(getSimpleTestName(
".")+
"-AWTImageIO.png"));
84 }
catch (
final IOException e) {
88 if(readBufferUtilRGB888.
readPixels(gl2,
false)) {
89 readBufferUtilRGB888.
write(
new File(getSimpleTestName(
".")+
"-PNGJ-rgb_.png"));
91 readBufferUtilRGB888.
dispose(gl2);
92 if(readBufferUtilRGBA8888.
readPixels(gl2,
false)) {
93 readBufferUtilRGBA8888.
write(
new File(getSimpleTestName(
".")+
"-PNGJ-rgba.png"));
95 readBufferUtilRGBA8888.
dispose(gl2);
99 System.out.println(
"Done!");
102 public static void main(
final String[] args) {
Specifies a set of OpenGL capabilities.
void setDoubleBuffered(final boolean enable)
Enables or disables double buffering.
Abstraction for an OpenGL rendering context.
abstract int makeCurrent()
Makes this GLContext current on the calling thread.
abstract void destroy()
Destroys this OpenGL context and frees its associated resources.
abstract GL getGL()
Returns the GL pipeline object for this GLContext.
abstract GLDrawable createOffscreenDrawable(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, int width, int height)
Creates an unrealized offscreen GLDrawable 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 getMaxFixedFunc(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile, implementing the fixed function pipeline.
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
static void main(final String[] args)
void test01GLOffscreenDrawable()
Utility to read out the current FB to TextureData, optionally writing the data back to a texture obje...
void write(final File dest)
Write the TextureData filled by readPixels(GLAutoDrawable, boolean) to file.
void dispose(final GL gl)
boolean readPixels(final GL gl, final boolean mustFlipVertically)
Read the drawable's pixels to TextureData and Texture, if requested at construction.
GLReadBufferUtil specialization allowing to read out a frambuffer to an AWT BufferedImage utilizing A...
BufferedImage readPixelsToBufferedImage(final GL gl, final boolean awtOrientation)
Read the drawable's pixels to TextureData and Texture, if requested at construction,...
void glClearDepth(double depth)
Aliased entrypoint of void {@native glClearDepth}(GLclampd depth); and void {@native glClearDepthf...
GL2 getGL2()
Casts this object to the GL2 interface.
An abstraction for an OpenGL rendering target.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
void setRealized(boolean realized)
Indicates to GLDrawable implementations whether the underlying surface has been created and can be dr...
GLContext createContext(GLContext shareWith)
Creates a new context for drawing to this drawable that will optionally share buffer objects,...
GLProfile getGLProfile()
Fetches the GLProfile for this drawable.
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,...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
void glViewport(int x, int y, int width, int height)
Entry point to C language function: void {@native glViewport}(GLint x, GLint y, GLsizei width,...
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...
static final int GL_SMOOTH
void glShadeModel(int mode)
void glLoadIdentity()
Load the current matrix with the identity matrix.