27 #include <boost/lexical_cast.hpp>
29 #include <osg/Texture>
30 #include <osg/Texture2D>
32 #include "../WGETextureHud.h"
34 #include "WGEOffscreenRenderPass.h"
38 m_width( textureWidth ),
39 m_height( textureHeight ),
40 m_fbo( new osg::FrameBufferObject() ),
44 setClearColor( osg::Vec4( 0.0, 0.0, 0.0, 0.0 ) );
45 setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
46 setReferenceFrame( osg::Transform::RELATIVE_RF );
47 setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
48 setRenderOrder( osg::Camera::PRE_RENDER, num );
54 m_width( textureWidth ),
55 m_height( textureHeight ),
56 m_fbo( new osg::FrameBufferObject() ),
61 setClearColor( osg::Vec4( 0.0, 0.0, 0.0, 0.0 ) );
62 setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
63 setReferenceFrame( osg::Transform::RELATIVE_RF );
64 setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
65 setRenderOrder( osg::Camera::PRE_RENDER, num );
75 m_fbo->setAttachment( buffer, osg::FrameBufferAttachment( texture ) );
87 osg::ref_ptr< osg::Texture2D > tex;
88 if( buffer == DEPTH_BUFFER )
94 #if defined(__APPLE__)
107 if(
m_hud && osg::Camera::getBufferAttachmentMap().count( buffer ) )
109 m_hud->removeTexture( osg::Camera::getBufferAttachmentMap()[ buffer ]._texture );
112 m_fbo->setAttachment( buffer, osg::FrameBufferAttachment() );
119 osg::ref_ptr< osg::Texture2D > tex =
new osg::Texture2D;
121 tex->setInternalFormat( internalFormat );
124 tex->setFilter( osg::Texture::MIN_FILTER, osg::Texture::LINEAR );
125 tex->setFilter( osg::Texture::MAG_FILTER, osg::Texture::LINEAR );
128 tex->setWrap( osg::Texture::WRAP_S, osg::Texture::REPEAT );
129 tex->setWrap( osg::Texture::WRAP_T, osg::Texture::REPEAT );
151 this->getOrCreateStateSet()->addUniform( uniform );
162 case PACKED_DEPTH_STENCIL_BUFFER:
163 return "Depth+Stencil";