Hello,
I want to record more than four elements by writing to "out variable"
in fragment shader.
I notice that FBO can connect to many buffers, so I define two images
which are respectively attached to a color buffer and a depth buffer.
osg source code are as follows:
osg::Image *imageDepth=new osg::Image();
imageDepth->allocateImage((int)subXRes, (int)subYRes, 1, GL_RGBA,
GL_FLOAT);
camera->attach(osg::CameraNode::DEPTH_BUFFER, imageDepth);
osg::Image * image = new osg::Image();
image->allocateImage((int)subXRes, (int)subYRes, 1, GL_RGBA, GL_FLOAT);
camera->attach(osg::CameraNode::COLOR_BUFFER, image);
fragment shader is as follows:
gl_FragColor = vec4(1,0,0,1);
gl_FragDepth=0.3;
But it doesn't work: application output:
Warning: detected OpenGL error 'invalid operation' at after
RenderBin::draw(..)
then I change the internal format of imagedepth to GL_DEPTH. it still
doesn't work. and the system says, the framebuffer is attatched to an
empty image.
So how can I get more than four elements via fragment shader?
Thank you very much in advance!
Shuiying
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org