From bac4cfe3d56c947b17665986d22b55d740e3e011 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 2 Jun 2010 15:07:27 +0000 Subject: [PATCH] Added check for presence of extension. --- src/osg/FrameBufferObject.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/osg/FrameBufferObject.cpp b/src/osg/FrameBufferObject.cpp index 158a99f69..9990ecb82 100644 --- a/src/osg/FrameBufferObject.cpp +++ b/src/osg/FrameBufferObject.cpp @@ -561,13 +561,23 @@ void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachmen break; case Pimpl::TEXTURE3D: if (_ximpl->zoffset == Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER) - ext->glFramebufferTexture(target, attachment_point, tobj->id(), _ximpl->level); + { + if (ext->glFramebufferTexture) + { + ext->glFramebufferTexture(target, attachment_point, tobj->id(), _ximpl->level); + } + } else ext->glFramebufferTexture3D(target, attachment_point, GL_TEXTURE_3D, tobj->id(), _ximpl->level, _ximpl->zoffset); break; case Pimpl::TEXTURE2DARRAY: - if (_ximpl->zoffset == Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER) - ext->glFramebufferTexture(target, attachment_point, tobj->id(), _ximpl->level); + if (_ximpl->cubeMapFace == Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER) + { + if (ext->glFramebufferTexture) + { + ext->glFramebufferTexture(target, attachment_point, tobj->id(), _ximpl->level); + } + } else ext->glFramebufferTextureLayer(target, attachment_point, tobj->id(), _ximpl->level, _ximpl->zoffset); break; @@ -576,7 +586,12 @@ void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachmen break; case Pimpl::TEXTURECUBE: if (_ximpl->cubeMapFace == Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER) - ext->glFramebufferTexture(target, attachment_point, tobj->id(), _ximpl->level); + { + if (ext->glFramebufferTexture) + { + ext->glFramebufferTexture(target, attachment_point, tobj->id(), _ximpl->level); + } + } else ext->glFramebufferTexture2D(target, attachment_point, GL_TEXTURE_CUBE_MAP_POSITIVE_X + _ximpl->cubeMapFace, tobj->id(), _ximpl->level); break;