Hi!
I want to read floating point pixels in a WGL_ATI_pixel_format_float pbuffer. The extension doc tells me that if the extension is set, floating point values will not be clamped. But I can not get those unclamped value by glReadPixels.
My code:
//-----------------------------------------
const int attr[] = {
WGL_DRAW_TO_PBUFFER_ARB , GL_TRUE ,
WGL_SUPPORT_OPENGL_ARB , GL_TRUE ,
WGL_PIXEL_TYPE_ARB , WGL_TYPE_RGBA_FLOAT_ATI ,
WGL_COLOR_BITS_ARB , 128 ,
WGL_RED_BITS_ARB , 32 ,
WGL_GREEN_BITS_ARB , 32 ,
WGL_BLUE_BITS_ARB , 32 ,
WGL_ALPHA_BITS_ARB , 32 ,
WGL_DEPTH_BITS_ARB , 24 ,
WGL_AUX_BUFFERS_ARB , 3 ,
0 , 0 ,
};
int fmts[200];
UINT nfmt = 0;
BOOL res = wglChoosePixelFormatARB( dc , attr , NULL , 200 , fmts , &nfmt );
if( !res )
{
WINERROR();
exit( 0 );
}
HPBUFFERARB pbf = wglCreatePbufferARB( dc , fmts[0] , wsize , wsize , NULL );
if( !pbf )
{
WINERROR();
exit( 0 );
}
HDC pfdc = wglGetPbufferDCARB( pbf );
HGLRC pfrc = wglCreateContext( pfdc );
wglMakeCurrent( pfdc , pfrc );
// do some drawing here
glFinish();
// try to get pixels
float * f = (float*)malloc( wsize * wsize * 4 * sizeof(float) );
glReadPixels( 0 , 0 , wsize , wsize , GL_RGBA , GL_FLOAT , f );
//-----------------------------------------
Is there anyother way of reading floating point pixels?
Thank you!