29package com.jogamp.opengl.test.junit.jogl.offscreen;
31import com.jogamp.opengl.*;
33import com.jogamp.opengl.util.GLReadBufferUtil;
36import java.io.IOException;
37import java.io.PrintWriter;
38import java.io.StringWriter;
40import com.jogamp.nativewindow.*;
44 final String filename;
50 this.filename = filename;
71 }
catch (
final IOException ex) {
72 throw new RuntimeException(
"can not write survace to file", ex);
80 if (!readBufferUtil.
isValid()) {
83 final StringWriter sw =
new StringWriter();
85 final String pfmt = alpha ?
"rgba" :
"rgb_" ;
86 new PrintWriter(sw).printf(
"%s-I_%s-%04d.png", filename, pfmt, shotNum);
88 final File file =
new File(sw.toString());
89 readBufferUtil.
write(file);
Abstraction for an OpenGL rendering context.
abstract GLDrawable getGLDrawable()
Returns the write-drawable this context uses for framebuffer operations.
static GLContext getCurrent()
Returns this thread current context.
abstract GL getGL()
Returns the GL pipeline object for this GLContext.
Surface2File(final String filename, final boolean alpha)
void dispose(final GL gl)
void surfaceUpdated(final Object updater, final NativeSurface ns, final long when)
Notification of a surface update event, eg.
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.
Provides low-level information required for hardware-accelerated rendering using a surface in a platf...
Clients may add their SurfaceUpdateListener implementation to a com.jogamp.nativewindow....
An abstraction for an OpenGL rendering target.
void glFinish()
Entry point to C language function: void {@native glFinish}() Part of GL_ES_VERSION_2_0,...