RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd6

RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd6
Warning: RenderStage::runCameraSetUp(State&) Pbuffer does not support multiple color outputs.

1、attach(BufferComponent buffer, osg::Texture* texture…)

经测试,相同的源码osg3.4版本报错,osg3.6版本正常。后来经过对3.4版本下,rtt、mtr横向对比,发现出问题的原因是{
osg::Texture2D::setInternalFormat(internalFormat);
osg::Texture2D::setSourceFormat(GL_RGBA);
osg::Texture2D::setSourceType(GL_FLOAT);
}代码段,3.4版本必须明确指定多目标的输出格式如:osg::Texture2D::setSourceFormat(GL_RGBA);而3.6则不用,从此可见 osg不同版本对glsl的支持是有差异的。

2、attach(BufferComponent buffer, osg::Image* image…)

attach到image,但image没有分配内存,错误示例:
	osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
	texture->setInternalFormat(GL_RGBA32F_ARB);
    texture->setSourceFormat(GL_RGBA);
    texture->setSourceType(GL_FLOAT);
    texture->setTextureSize(s, t);
    ...
    pCamera->attach(osg::Camera::COLOR_BUFFER1, texture ->getImage());

正确示例:

	osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
	osg::ref_ptr<osg::Image> img = new osg::Image;
    img->allocateImage(s, t, 1, GL_RGBA, GL_FLOAT);
    img->setInternalTextureFormat(GL_RGBA32F_ARB);
    texture->setImage(img);
    ...
    pCamera->attach(osg::Camera::COLOR_BUFFER1, texture ->getImage());
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值