I load my fragment program and activate it, before use DrawPixels.
But I get only clamped value, when I use DrawPixels.
I don’t know why it doesn’t work well.
My source code is :
glEnable(GL_FRAGMENT_PROGRAM_NV);
glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, fragProgram); //==>fragProgram set fragment's color (3.0, 3.0, 3.0, 3.0)
glClearColor(3.0, 3.0, 3.0, 3.0);
glClear(GL_COLOR_BUFFER_BIT);
glReadPixels(0, 0, 64, 64, GL_RGBA, GL_FLOAT, saveImage);
for(i=0; i<64*64; i++) {
printf("%f %f %f %f
", saveImage[4i], saveImage[4i+1], saveImage[4i+2], saveImage[4i+3]);
//====>This prints 3.0 3.0 3.0 3.0
}
/******************************************************************************/
glDrawPixels(64, 64, GL_RGBA, GL_FLOAT, myImage);
// myImage is constant color image(all color is (3.0, 3.0, 3.0, 3.0)
glReadPixels(0, 0, 64, 64, GL_RGBA, GL_FLOAT, saveImage);
for(i=0; i<64*64; i++) {
printf("%f %f %f %f
", saveImage[4i], saveImage[4i+1], saveImage[4i+2], saveImage[4i+3]);
//====>This prints 1.0 1.0 1.0 1.0
}
/******************************************************************************/
glBegin(GL_QUADS);
glVertex2f(-1.0, -1.0);
glVertex2f(1.0, -1.0);
glVertex2f(1.0, 1.0);
glVertex2f(-1.0, 1.0);
glEnd();
glFlush();
glReadPixels(0, 0, 64, 64, GL_RGBA, GL_FLOAT, saveImage);
for(i=0; i<64*64; i++) {
printf("%f %f %f %f
", saveImage[4i], saveImage[4i+1], saveImage[4i+2], saveImage[4i+3]);
//====>This prints 3.0 3.0 3.0 3.0
}
/******************************************************************************/
glDisable(GL_FRAGMENT_PROGRAM_NV);