Hi,
I am trying to use a fragment program with the glDrawPixels and glCopyPixels calls, in JOGL. I have no problem getting my fragment programs to be invoked when rendering polygons, but they don’t seem to run when I use glDrawPixels or glCopyPixels. (Really, I’m only interested in the latter, in order to feed color data from the framebuffer back into my fragment program.)
I am wondering which of the following is the case:
-
My interpretation of the GL spec (that DrawPixels and CopyPixels feed fragments back through the fragment program) is incorrect. I shouldn’t expect this to happen.
-
The GL drivers on my machine are broken somehow.
-
This is a JOGL problem, and has to do with some fancy internal management of the framebuffer, or some such.
If the answer is 1 or 2, I apologize in advance for the off topic post.
Below is an excerpt of the code I am using. I am using the DebugGL debugging wrapper, and no exceptions are being raised during the execution of my program.
TIA,
Kevin
– code excerpt –
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
String prog = … long fragment program …
gl.glProgramStringARB(
GL.GL_FRAGMENT_PROGRAM_ARB,
GL.GL_PROGRAM_FORMAT_ASCII_ARB,
prog.length(),
prog
);
gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
// generate some random pixels
Random rand = new Random();
ByteBuffer data = ByteBuffer.allocate(64*64);
for (int i = 0; i < 64; ++i) {
for (int j = 0; j < 64; ++j) {
data.put((byte)rand.nextInt());
}
}
data.flip();
gl.glRasterPos2i(500, 200);
// here, pixels are in fact copied out of my ByteBuffer,
// but without passing through the fragment program
gl.glDrawPixels(64, 64, GL.GL_LUMINANCE, GL.GL_UNSIGNED_BYTE, data);
// and here, pixels are in fact being read from the frame buffer,
// but without passing through the fragment program
gl.glCopyPixels(500, 500, 100, 100, GL.GL_COLOR);
// here, the pixels of the rectangle do pass through the fragment program
// (as can be verified by messing with it to set the color of the fragments to red, or whatever)
gl.glRecti(100, 100, 200, 200);
– info strings for my crappy laptop’s onboard GPU –
– generated during execution of the above program –
INIT GL IS: javax.media.opengl.DebugGL
GL_VENDOR: Intel
GL_RENDERER: Intel 915GM
GL_VERSION: 1.4.0 - Build 4.14.10.3984