I'm trying to move from Nate Robins' GLUT to FreeGLUT on Windows.
There seems to be some problem with FreeGLUT, I'm always seeing the
framebuffer's alpha values being set to 1.0, even though I'm rendering
with alpha 0.0.
I've given a simple C++ program below which depicts the problem. When
I use glut, the alpha values on the framebuffer are 0.0. When I use
FreeGLUT, they are always set to 1.0.
Why is this? Is there some ALPHA setting I'm missing?
#include <GL/freeglut.h> // use <GL/glut.h> for GLUT
static const unsigned int WIN_POS_X = 50;
static const unsigned int WIN_POS_Y = WIN_POS_X;
static const unsigned int WIN_WIDTH = 640;
static const unsigned int WIN_HEIGHT = WIN_WIDTH;
void initGl(int, char **);
void reshape(int, int);
int main(int argc, char * argv)
void initGl(int argc, char ** argv)
// Set white as clear color
glClearColor(1.0, 1.0, 1.0, 0.0);
gluPerspective(45.0, WIN_WIDTH / WIN_HEIGHT, 1.0, 2000.0);
gluLookAt( 0.0, 0.0, 600.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
// Render front model in light
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor4f(0.0, 1.0, 0.0, 0.0);
// imdebug debugging
GLubyte * buf = new GLubyte[4 * WIN_WIDTH * WIN_HEIGHT];
glReadPixels(0, 0, WIN_WIDTH, WIN_HEIGHT, GL_RGBA,
imdebug("rgba w=%d h=%d %p", WIN_WIDTH, WIN_HEIGHT, buf);
From: steve <sjbaker1@ai...> - 2006-06-24 14:57:35
Ashwin Nanjappa wrote:
> I'm trying to move from Nate Robins' GLUT to FreeGLUT on Windows.
> There seems to be some problem with FreeGLUT, I'm always seeing the
> framebuffer's alpha values being set to 1.0, even though I'm rendering
> with alpha 0.0.
Well, GLUT/freeglut had nothing to do with the glClearColor/glClear
commands that cleared the Alpha buffer to 0.0 - that's a GL command
- not a GLUT command - so we had nothing whatever to do with that.
So the problem must be that freeglut isn't creating an Alpha buffer
even though you said
...since it's relatively rare for people to use an Alpha buffer
these days, I could easily believe that this code had not been
Without an alpha buffer, a readback from the framebuffer could
very well set the alpha to the default (1.0) on readback - so
that's somewhat consistent with a bug in that area.
I think we have a bug.
Does anyone else use an Alpha buffer with GLUT/freeglut?