Hi,
The FBO-viewport didn't work for me out of the box, as the support for
simultaneous rendering to separate color & depth textures was gone. I've
fixed it in the attached patch. (I also added a few warnings here and
there on unsupported stuff.)
I think the render() function needs some refactoring too. It's a beast
of 800 lines!
Cheers,
/Marcus
? fbo.patch
Index: OSGFBOViewport.cpp
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/System/Window/OSGFBOViewport.cpp,v
retrieving revision 1.3
diff -r1.3 OSGFBOViewport.cpp
990a991,997
>
> if (depthTex && stencilTex)
> {
> SWARNING << "Rendering to separate depth & stencil textures
> is not possible.";
> SWARNING << "Disabling stencil texture." << endLog;
>
> stencilTex = NullFC;
> }
992,993c999,1000
< // TODO; allow setting of e.g. FBO_DEPTH_32
< //if (!depthTex)
---
> // TODO; allow setting of e.g. FBO_DEPTH_32
> if (!depthTex)
994a1002
>
1009c1017
< if (colorTextures.getSize())
---
> if (!colorTextures.empty())
1029a1038,1060
> if (depthTex)
> {
> win->validateGLObject(depthTex->getGLId());
>
> target = depthTex->getTarget();
>
> if (target == GL_NONE)
> target = GL_TEXTURE_2D;
>
> setTarget(win, win->getGLObjectId(depthTex->getGLId()),
> GL_DEPTH_ATTACHMENT_EXT, target);
> }
> else if (stencilTex)
> {
> win->validateGLObject(stencilTex->getGLId());
>
> target = stencilTex->getTarget();
>
> if (target == GL_NONE)
> target = GL_TEXTURE_2D;
>
> setTarget(win, win->getGLObjectId(stencilTex->getGLId()),
> GL_STENCIL_ATTACHMENT_EXT, target);
> }
>
1033a1065
> {
1035,1050c1067,1075
< else
< glDrawBuffer ( *buffers );
< }
< else if (depthTex)
< {
< buffers[0] = GL_DEPTH_ATTACHMENT_EXT;
< numBuffers = 1;
<
< win->validateGLObject(depthTex->getGLId());
<
< target = depthTex->getTarget();
<
< if (target == GL_NONE)
< target = GL_TEXTURE_2D;
<
< setTarget(win, win->getGLObjectId(depthTex->getGLId()),
buffers[0], target);
---
> }
> else
> {
> if (numBuffers > 1)
> {
> SWARNING << "glDrawBuffersARB not supported, can't
> render to more than 1 color buffer." << endLog;
> }
> glDrawBuffer ( *buffers );
> }
1052,1053c1077,1084
< glDrawBuffer (GL_NONE);
< glReadBuffer (GL_NONE);
---
> } else {
>
> if (depthTex)
> {
> buffers[0] = GL_DEPTH_ATTACHMENT_EXT;
> numBuffers = 1;
>
> win->validateGLObject(depthTex->getGLId());
1055,1067c1086
< checkFrameBufferStatus(win);
< }
< else if (stencilTex)
< {
< buffers[0] = GL_STENCIL_ATTACHMENT_EXT;
< numBuffers = 1;
<
< win->validateGLObject(stencilTex->getGLId());
<
< target = stencilTex->getTarget();
<
< if (target == GL_NONE)
< target = GL_TEXTURE_2D;
---
> target = depthTex->getTarget();
1069c1088,1091
< setTarget(win, win->getGLObjectId(stencilTex->getGLId()),
buffers[0], target);
---
> if (target == GL_NONE)
> target = GL_TEXTURE_2D;
>
> setTarget(win, win->getGLObjectId(depthTex->getGLId()),
> buffers[0], target);
1071,1072c1093,1094
< glDrawBuffer (GL_NONE);
< glReadBuffer (GL_NONE);
---
> glDrawBuffer (GL_NONE);
> glReadBuffer (GL_NONE);
1074c1096,1116
< checkFrameBufferStatus(win);
---
> checkFrameBufferStatus(win);
> }
> else if (stencilTex)
> {
> buffers[0] = GL_STENCIL_ATTACHMENT_EXT;
> numBuffers = 1;
>
> win->validateGLObject(stencilTex->getGLId());
>
> target = stencilTex->getTarget();
>
> if (target == GL_NONE)
> target = GL_TEXTURE_2D;
>
> setTarget(win, win->getGLObjectId(stencilTex->getGLId()),
> buffers[0], target);
>
> glDrawBuffer (GL_NONE);
> glReadBuffer (GL_NONE);
>
> checkFrameBufferStatus(win);
> }
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users