Hi Everyone,
Can any body tell me when is the appropriate time to delete the render buffer which attach to the frame buffer object as a depth attachment on SGX GPU from PowerVR on Android platform?
I come across this question when I use render to texture. I delete the render buffer(depth attachment of FBO) immediately after the process of render to texture, and then use the texture for other rendering process, a strange problem occur on Android
platform. Nothing is rendered and the screen become black. It seem glClear neither have any effect. I test the same code in GLES2 pc emulation and desktop OGL, everything is ok, but on SGX GPU from PowerVR on Android platform, I got nothing but a black screen. I port the same code on SGX530 GPU(<i =“name”>Samsung Galaxy S I9008), SGX540 GPU(LG Optimus 3D) and other SGX GPUs, All return me the black screen. However When I test the same code on Adreno GPU from Qualcomm, Everying is ok. So Is this an Issue of SGX GPU? And can anyone tell me when is the appropriate time to delete the render buffer in FBO?
If the PowerVR Technique Support want the code I use to reproduce the problem, Please concast me by this email: freedayman@gmail.com
Following are the some codes I use to render to texture.
Code to creat the frame buffer object:
{
// create a render buffer to used as the depth buffer
glGenRenderbuffers(1, &depthBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, depthBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, texSize, texSize);
// create a blank texture to used as the color buffer
glGenTextures(1, &colorBuffer);
glBindTexture(GL_TEXTURE_2D, colorBuffer);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texSize, texSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// create the frame buffer
glGenFramebuffers(1, &frameBuffer);
glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorBuffer, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBuffer);
glCheckFramebufferStatus(GL_FRAMEBUFFER);
}
Code to delete the render buffer and frame buffer after render to texture process
{
if (0 != frameBuffer)
glDeleteFramebuffers(1, &frameBuffer);
if (0 != depthBuffer)
glDeleteRenderbuffers(1, &depthBuffer);
// do not delete the texture so as to use the result of render to texture
}
Any news on this issue?
Have you found a way to resolve it?
Have you found the solution?