From: Erwin V. <er...@cs...> - 2000-02-08 18:32:53
|
Hello all, I've got a problem reading the OpenGL frame buffer using GL4Java. In my program (the Java MD3 Model Viewer - http://fragland.net/md3view) I use the following piece of code to do this: public class MD3GLCanvas extends GLAnimCanvas { ... public void dumpCanvasToTGA(String filename) throws java.io.IOException { byte[] pixels=new byte[this.getWidth() * this.getHeight() * 3]; sDisplay(); // make sure the image on the canvas is properly drawn! // get viewport data gl.glReadBuffer(GL_BACK); gl.glReadPixels(0, 0, this.getWidth(), this.getHeight(), GL_RGB, GL_UNSIGNED_BYTE, pixels); ... } } This works just fine, but from time to time the retreived image data is screwed up (look at the example I've attached to this mail). My guess is that I should somehow synchronise my reading of the frame buffer? Any ideas what might be causing this or how I can fix it? Erwin 'KLR8' Vervaet er...@cs... |