- Fixed problem with a wrong type of GL_DEPTH_COMPONENT on MacOSX.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4326 dfc29bdd-3216-0410-991c-e03cc46cb475
master
Nadro 2012-10-11 16:02:01 +00:00
parent b5539bdfe6
commit 40933b9ef6
3 changed files with 26 additions and 2 deletions

View File

@ -4707,6 +4707,27 @@ GLenum COpenGLDriver::getGLBlend(E_BLEND_FACTOR factor) const
return r;
}
GLenum COpenGLDriver::getZBufferBits() const
{
GLenum bits = 0;
switch (Params.ZBufferBits)
{
case 16:
bits = GL_DEPTH_COMPONENT16;
break;
case 24:
bits = GL_DEPTH_COMPONENT24;
break;
case 32:
bits = GL_DEPTH_COMPONENT32;
break;
default:
bits = GL_DEPTH_COMPONENT;
break;
}
return bits;
}
#ifdef _IRR_COMPILE_WITH_CG_
const CGcontext& COpenGLDriver::getCgContext()
{

View File

@ -402,6 +402,9 @@ namespace video
//! Convert E_BLEND_FACTOR to OpenGL equivalent
GLenum getGLBlend(E_BLEND_FACTOR factor) const;
//! Get ZBuffer bits.
GLenum getZBufferBits() const;
//! Get Cg context
#ifdef _IRR_COMPILE_WITH_CG_
const CGcontext& getCgContext();

View File

@ -797,7 +797,7 @@ COpenGLFBODepthTexture::COpenGLFBODepthTexture(
#endif
{
// generate depth texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, ImageSize.Width,
glTexImage2D(GL_TEXTURE_2D, 0, Driver->getZBufferBits(), ImageSize.Width,
ImageSize.Height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);
// generate stencil texture
@ -817,7 +817,7 @@ COpenGLFBODepthTexture::COpenGLFBODepthTexture(
Driver->extGlGenRenderbuffers(1, &DepthRenderBuffer);
Driver->extGlBindRenderbuffer(GL_RENDERBUFFER_EXT, DepthRenderBuffer);
Driver->extGlRenderbufferStorage(GL_RENDERBUFFER_EXT,
GL_DEPTH_COMPONENT, ImageSize.Width,
Driver->getZBufferBits(), ImageSize.Width,
ImageSize.Height);
}
#endif