glColor4f(0.6,0.6,0.6,0.5);
// draw something
…
…
glFinish();
// now we want to get the pixels in frame buffer
glReadPixels(0,0,win_sizex,win_sizey,GL_RGBA,
GL_UNSIGNED_BYTE,pixel_buf);
…
…
code is finished,but whatever we set the params in glColor4f, the alpha value stored in
the pixel_buf is always 1.0, so how can i properly get the alpha value in the frame buffer?
You need to make certain that your window is supplying an alpha channel. This is done in the Windows pixelformat definition or in GLUT you need to specify GLUT_RGBA and GLUT_ALPHA when you create your window.