zbuffer disabled when shader enabled
category: code [glöplog]
HEJ pouet people!
I got a problem in my lousy code, I enabled the zbuffer and it works perfectly when the shaders aren't enabled (front objects hides objects on the background as usual) but when the shaders are active (I press a key on my code) the zbuffer is instantly disabled and the objects are sorted by their order of creation :(
Any ideas of possible errors I did in teh shaders who can cause that error?
Zavie said it's perhaps because I didn't close properly a FBO but I think I'm ok (but I will try to look deeper in case of).
Thank in advance!
I got a problem in my lousy code, I enabled the zbuffer and it works perfectly when the shaders aren't enabled (front objects hides objects on the background as usual) but when the shaders are active (I press a key on my code) the zbuffer is instantly disabled and the objects are sorted by their order of creation :(
Any ideas of possible errors I did in teh shaders who can cause that error?
Zavie said it's perhaps because I didn't close properly a FBO but I think I'm ok (but I will try to look deeper in case of).
Thank in advance!
Does your FBO have a depth-buffer?
ermm, I think... NOT :D
Hahaha.. if I had a nickel for every time I made that mistake...
I got that to create my FBO (I didn't touched this part myself)
And I create the FBOs like following:
fbo_back=glsl.CreateFBO(screen_w,screen_h);
I'm sure I forgot something, but I'm too lame to know what :D
Code:
FBO* GLSL::CreateFBO(int _Width,int _Height,GLenum _Format,GLenum _WrapMode,GLenum _FilteringMode)
{
return CreateFBOWithDepthBuffer(_Width,_Height,_Format,GL_INVALID_INDEX,_WrapMode,_FilteringMode);
}
FBO* GLSL::CreateFBOWithDepthBuffer(int _Width,int _Height,GLenum _Format,GLenum _DepthFormat,GLenum _WrapMode,GLenum _FilteringMode)
{
FBO* pResult=new FBO(_Width,_Height,_Format,_DepthFormat,_WrapMode,_FilteringMode); // create the FBO object
if(m_pRootFBO!= NULL) m_pRootFBO->m_pPrevious=pResult; // link it to the list of existing FBOs
pResult->m_pNext=m_pRootFBO;
m_pRootFBO=pResult;
return pResult;
}
And I create the FBOs like following:
fbo_back=glsl.CreateFBO(screen_w,screen_h);
I'm sure I forgot something, but I'm too lame to know what :D
Hehe. Me too. I actually HAD a z-Buffer, but forgot to glEnable it... ;D
Try this