Render with transparency

anonymous wrote on Wednesday, February 01, 2012:

I’m using glfw to render models in memory. So i’m not using a window at all.
I’m using glReadPixels() to read all the ‘rendered’ data from the back
buffer, which in return i use to display the pixels in another program. So far
so good.

The next thing i want to do is render it with a transparent background. So i’m
trying to use glClearColor with transparency, but it isn’t working. I was
hoping anyone here had an idea on how to do this.

I’m calling this every render:

void render(void)
{
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.1f,0.1f,0.1f,0.5f);
renderCube();
}

So basically what i want to achieve is that the cube is render on a
transparent background. So that i can place the read pixels ontop of another
image. But its not giving me any transparency.

Anyone any idea how to do this?

elmindreda wrote on Wednesday, February 01, 2012:

This is a question about OpenGL, not GLFW. You should ask on a forum for
OpenGL.