I recently gave up on trying to get fixed function user clip planes into the right transformation space under opengl Irrlicht 1.7 and just put the clip space clipping plane in the vertex shader and then discarded the dotted result in the pixel shader. But that resulted in some depth clip aliasing issues on Mac. I eventually found the problem. When creating a COpenGLFBODepthTexture (line 819 in COpenGLTexture.cpp on svn) Irrlicht 1.7 and 1.8 calls glRenderBufferStorage with GL_DEPTH_COMPONENT.
Code: Select all
Driver->extGlRenderbufferStorage(GL_RENDERBUFFER_EXT,
GL_DEPTH_COMPONENT, ImageSize.Width,
ImageSize.Height);
I believe GL_DEPTH_COMPONENT is supposed to select the "optimal" depth component available. Unfortunately what is optimal is OS/Driver dependent. So on Windows 7 on my ATI card OpenGL 4 it selects the highest one available (32-bit). The same computer on OSX 10.7 OpenGL 2 it selects 16-bit. I don't know what the best solution to this is. You could allow users to give a depth hint/argument when creating the render buffer texture, try to create the highest (32-bit) by default and trying lower values if this fails, or get the current depth of the screen and use that. Just using GL_DEPTH_COMPONENT24 fixes all of my problems:
Code: Select all
Driver->extGlRenderbufferStorage(GL_RENDERBUFFER_EXT,
GL_DEPTH_COMPONENT24, ImageSize.Width,
ImageSize.Height);
OSX 10.7 (Macbook Pro 2011):
Windows 7 (Same Macbook Pro 2011):