thogarth - added ovr_multiview support to FrameBufferObject and const to camera to enable the extension on attachments

This commit is contained in:
John W. Terrell 2019-11-14 11:18:34 -08:00 committed by Robert Osfield
parent a13f8cf4b4
commit 7d34a54a3b
5 changed files with 12 additions and 0 deletions

View File

@ -347,6 +347,7 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
};
static const unsigned int FACE_CONTROLLED_BY_GEOMETRY_SHADER;
static const unsigned int FACE_CONTROLLED_BY_MULTIVIEW_SHADER;
/** Attach a buffer with specified OpenGL internal format.*/
void attach(BufferComponent buffer, GLenum internalFormat);

View File

@ -680,6 +680,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
void (GL_APIENTRY * glFramebufferTexture) (GLenum, GLenum, GLint, GLint);
void (GL_APIENTRY * glFramebufferTextureLayer) (GLenum, GLenum, GLuint, GLint, GLint);
void (GL_APIENTRY * glFramebufferTextureFace)( GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face );
void (GL_APIENTRY * glFramebufferTextureMultiviewOVR) (GLenum, GLenum, GLenum, GLuint, GLint, GLint);
void (GL_APIENTRY * glFramebufferRenderbuffer) (GLenum, GLenum, GLenum, GLuint);
void (GL_APIENTRY * glGenerateMipmap) (GLenum);

View File

@ -23,6 +23,7 @@
using namespace osg;
const unsigned int Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER = 0xffffffff;
const unsigned int Camera::FACE_CONTROLLED_BY_MULTIVIEW_SHADER = 0xfffffff0;
Camera::Camera():
_view(0),

View File

@ -492,6 +492,13 @@ void FrameBufferAttachment::attach(State &state, GLenum target, GLenum attachmen
case Pimpl::TEXTURE2DARRAY:
if (_ximpl->zoffset == Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER)
ext->glFramebufferTexture(target, attachment_point, tobj->id(), _ximpl->level);
else if(_ximpl->zoffset == Camera::FACE_CONTROLLED_BY_MULTIVIEW_SHADER)
{
if (ext->glFramebufferTextureMultiviewOVR)
{
ext->glFramebufferTextureMultiviewOVR(target, attachment_point, tobj->id(), _ximpl->level, 0, 2);
}
}
else
ext->glFramebufferTextureLayer(target, attachment_point, tobj->id(), _ximpl->level, _ximpl->zoffset);
break;

View File

@ -1099,6 +1099,8 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
setGLExtensionFuncPtr(glFramebufferTextureLayer, "glFramebufferTextureLayer", "glFramebufferTextureLayerEXT", "glFramebufferTextureLayerOES", validContext);
setGLExtensionFuncPtr(glFramebufferTextureFace, "glFramebufferTextureFace", "glFramebufferTextureFaceEXT", "glFramebufferTextureFaceOES" , validContext);
setGLExtensionFuncPtr(glFramebufferRenderbuffer, "glFramebufferRenderbuffer", "glFramebufferRenderbufferEXT", "glFramebufferRenderbufferOES", validContext);
setGLExtensionFuncPtr(glFramebufferTextureMultiviewOVR, "glFramebufferTextureMultiviewOVR", validContext);
//ARB_framebuffer_no_attachments
//OpenGL 4.3
setGLExtensionFuncPtr(glFramebufferParameteri, "glFramebufferParameteri", "glFramebufferParameteriARB", "glFramebufferParameteriOES", validContext);