🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

glClear alpha on render target

Started by
-1 comments, last by Craig_jb 13 years, 11 months ago
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 textureglGenFramebuffersOES(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);

This topic is closed to new replies.

Advertisement