2001-09-20 05:19:47 +08:00
|
|
|
#include <osgUtil/RenderToTextureStage>
|
|
|
|
|
|
|
|
#include <osgDB/ReadFile>
|
|
|
|
|
|
|
|
using namespace osg;
|
|
|
|
using namespace osgUtil;
|
|
|
|
|
|
|
|
// register a RenderToTextureStage prototype with the RenderBin prototype list.
|
|
|
|
//RegisterRenderBinProxy<RenderToTextureStage> s_registerRenderToTextureStageProxy;
|
|
|
|
|
|
|
|
RenderToTextureStage::RenderToTextureStage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
RenderToTextureStage::~RenderToTextureStage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void RenderToTextureStage::reset()
|
|
|
|
{
|
|
|
|
RenderStage::reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RenderToTextureStage::draw(osg::State& state,RenderLeaf*& previous)
|
|
|
|
{
|
|
|
|
|
|
|
|
RenderStage::draw(state,previous);
|
|
|
|
|
|
|
|
// now copy the rendered image to attached texture.
|
2001-09-22 10:42:08 +08:00
|
|
|
if (_texture.valid())
|
|
|
|
_texture->copyTexImage2D(state,_viewport->x(),_viewport->y(),_viewport->width(),_viewport->height());
|
2001-09-20 05:19:47 +08:00
|
|
|
|
|
|
|
}
|