From: <Px...@ao...> - 2002-06-13 13:07:59
|
I'm writing a Java application, not applet, that draws linegraphs/scatterplots, etc. I have a swing window that has a canvas in the middle of it that displays the graph, and that canvas is a class that extends GLCanvas. Drawing the graph is fine---everything shows up perfectly. My goal and problem is in saving a screenshot of the canvas. I'm using glReadPixels but nothing's happening. I create a pixel array: byte[] pixels = new byte[getWidth() * getHeight() * 3]; Then I call gl.glReadPixels(0,0,getWidth(), getHeight(),GL_RGB,GL_UNSIGNED_BYTE,pixels); BUT, pixels--my array--remains unchanged. I've tried specifying a buffer with glReadBuffer with all possible buffers but it's still not doing anything. If a solution isn't obvious please ask me questions so I can be more specific how things are set up. I'm pretty lost here. btw I'm using a windows 2000 box with j2sdk1.4.0, and gl4java v. 2.8.2.0. Any help would be greatly appreciated. Dennis |