Jump to content
  • Advertisement
Sign in to follow this  
Craig_jb

glClear alpha on render target

This topic is 2864 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all,

I am rendering brush strokes in an application to a secondary framebuffer to later render them onto the main framebuffer. However, I am getting weird behavior when clearing the framebuffer. The alpha channel doesn't appear to clear to 0. When I render it, the texture is completely white with alpha of 1.0 it seems. Code below:


// clears the brush strokes from the secondary framebuffer
- (void) clearBrushStrokes
{
glEnable(GL_BLEND);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, renderFrameBuffer);
glClearColor(1.0, 1.0, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
}

// snippet of creation of the render texture
glGenFramebuffersOES(1, &renderFrameBuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, renderFrameBuffer);
glGenTextures(1, &renderTexture);
glBindTexture(GL_TEXTURE_2D, renderTexture);

NSInteger deviceSize = [iChalkDrawingModel sharediChalkDrawingModel].powerOfTwoSize;

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, deviceSize, deviceSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, renderTexture, 0);

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!