Hi,

I followed your advice and applied directly the cubemap on the quad using 3D 
texture coordinates.

Allow me to ask another question are things are very weird !

I render the scene in the CubeMap

Code:

 reflectionMap = new osg::TextureCubeMap;
    reflectionMap->setTextureSize( 256, 256 );
    reflectionMap->setInternalFormat( GL_RGBA);

    camerasRoot = new osg::Group;

    for(int i=0;i<6;i++){


        osg::ref_ptr<osg::Camera> camera = new osg::Camera;
        camera->setViewport( 0, 0, 256, 256 );
        camera->setClearMask( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );

        camera->setRenderOrder( osg::Camera::PRE_RENDER );
        camera->setRenderTargetImplementation(
        osg::Camera::FRAME_BUFFER_OBJECT );
        camera->attach( osg::Camera::COLOR_BUFFER, reflectionMap,0,i );

        camera->setReferenceFrame( osg::Camera::ABSOLUTE_RF );
        camera->addChild( m_sceneroot );

        camera->setPreDrawCallback(pre_cam);
         camera->setPostDrawCallback(post_cam);

        camera->setProjectionMatrixAsPerspective(90.0,1.0,1.0,1000000.0);

        camerasRoot->addChild(camera);
        cameras.push_back(camera);

  }




Then this CubeMap is used twice per cycle.

First on a object, via shaders.
Second on two quads,displayed by a HUD camera (in order to see what is in the 
map).

On the object, a still image is displayed corresponding to a render from a 
previous execution of the application !

On the quads, this image is blended with the correct texture being rendered.

Each time I restart the application, a image of the previous execution is used.

It is sort of confusing.

Thank you!

Cheers,
Gaëtan[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=54516#54516





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to