# Render with transparency

**URL:** https://discourse.glfw.org/t/render-with-transparency/251
**Category:** support
**Created:** [February 1, 2012, 8:43pm UTC](https://discourse.glfw.org/t/render-with-transparency/251 "2012-02-01T20:43:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)
#### Post date: [February 1, 2012, 8:43pm UTC](https://discourse.glfw.org/t/render-with-transparency/251/1 "2012-02-01T20:43:28Z")

</div>

**anonymous** wrote on [Wednesday, February 01, 2012](https://sourceforge.net/p/glfw/discussion/247562/thread/404c4c2e/#404d):

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?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)
#### Post date: [February 1, 2012, 10:02pm UTC](https://discourse.glfw.org/t/render-with-transparency/251/2 "2012-02-01T22:02:41Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Wednesday, February 01, 2012](https://sourceforge.net/p/glfw/discussion/247562/thread/404c4c2e/#11b4):

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