Check it.
A roughly analagous Obj-C solution works fine. Let me know if I’m just doing something stupid (I hope) 
Corwin
import net.java.games.jogl.*;
import javax.swing.;
import javax.imageio.ImageIO;
import java.awt.image.;
import java.io.File;
public class JReadPixelsTest extends JFrame implements GLEventListener {
GLCanvas canvas = null;
public static void main(String[] args) {
JReadPixelsTest frame = new JReadPixelsTest();
frame.setBounds(0, 0, 480, 360);
frame.show();
}
JReadPixelsTest() {
canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
this.getContentPane().add(canvas);
canvas.addGLEventListener(this);
}
public void init(GLDrawable drawable)
{
}
public void display(GLDrawable drawable)
{
GL gl = drawable.getGL();
GLU glu = drawable.getGLU();
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluOrtho2D(0, 480, 0, 360);
gl.glBegin(GL.GL_QUADS); {
gl.glColor4d(1.0, 0.0, 0.0, 1.0);
gl.glVertex2d(50.0, 50.0);
gl.glVertex2d(430.0, 50.0);
gl.glVertex2d(430.0, 310.0);
gl.glVertex2d(50.0, 310.0);
} gl.glEnd();
gl.glFlush();
SwingUtilities.invokeLater(new Runnable() { public void run() { saveAJpeg(); } });
}
public void reshape(GLDrawable drawable, int x, int y, int width, int height)
{
}
public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged)
{
}
public void saveAJpeg()
{
GL gl = canvas.getGL();
gl.glReadBuffer(GL.GL_BACK);
BufferedImage imageBack = new BufferedImage(480, 360, BufferedImage.TYPE_INT_ARGB);
DataBufferInt awfulBufferBack = (DataBufferInt) imageBack.getRaster().getDataBuffer();
gl.glReadPixels(0, 0, 480, 360, GL.GL_RGBA, GL.GL_UNSIGNED_INT_8_8_8_8_REV, awfulBufferBack.getData());
gl.glFinish();
try {
ImageIO.write(imageBack, "jpeg", new File("/tmp/JReadPixelsTestBack.jpeg"));
} catch (Exception e) {
System.err.println("I am an exception, hear me roar????");
}
gl.glReadBuffer(GL.GL_FRONT);
BufferedImage imageFront = new BufferedImage(480, 360, BufferedImage.TYPE_INT_ARGB);
DataBufferInt awfulBufferFront = (DataBufferInt) imageFront.getRaster().getDataBuffer();
gl.glReadPixels(0, 0, 480, 360, GL.GL_RGBA, GL.GL_UNSIGNED_INT_8_8_8_8_REV, awfulBufferFront.getData());
gl.glFinish();
try {
ImageIO.write(imageFront, "jpeg", new File("/tmp/JReadPixelsTestFront.jpeg"));
} catch (Exception e) {
System.err.println("I am an exception, hear me roar????");
}
}
}