Re: [osg-users] Render to texture problem - resolved
OK, that sounds logical. Thank you, bye for now! Åsa -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För Robert Osfield Skickat: den 7 november 2008 14:22 Till: OpenSceneGraph Users Ämne: Re: [osg-users] Render to texture problem Hi Asa, On Fri, Nov 7, 2008 at 1:16 PM, Engvall Åsa <[EMAIL PROTECTED]> wrote: > It isn't obvious to me why the RTT camera must be under the viewer. I just > thought of the viewer as a camera which looks at the scene. Is the viewer > more like something that collects the pictures from all cameras and make them > visible to the user? It's the viewer that drivers the rendering as part of the viewer.renderingTraversals() called from the viewer.frame() method. The viewer can only render what it knows about it, Camera's don't go off rendering by themselves. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture problem
Hi Asa, On Fri, Nov 7, 2008 at 1:16 PM, Engvall Åsa <[EMAIL PROTECTED]> wrote: > It isn't obvious to me why the RTT camera must be under the viewer. I just > thought of the viewer as a camera which looks at the scene. Is the viewer > more like something that collects the pictures from all cameras and make them > visible to the user? It's the viewer that drivers the rendering as part of the viewer.renderingTraversals() called from the viewer.frame() method. The viewer can only render what it knows about it, Camera's don't go off rendering by themselves. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture problem
Thank you J P and Andreas! Now it works. It isn't obvious to me why the RTT camera must be under the viewer. I just thought of the viewer as a camera which looks at the scene. Is the viewer more like something that collects the pictures from all cameras and make them visible to the user? Trying to learn more... Åsa -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För J.P. Delport Skickat: den 7 november 2008 13:47 Till: OpenSceneGraph Users Ämne: Re: [osg-users] Render to texture problem I just read quickly, but it seems your camera is still not under the viewer, try viewer.setSceneData(root); jp Engvall Åsa wrote: > Hi again! > Now I have changed my scenegraph according to your drawing, and put > the RTT camera under a root node, but it still doesn't work. > > This time I attach all the code in my application, hope anybody has > time to have a look at it. > > Åsa > > > // Create group nodes. > osg::Group* root = new osg::Group; > osg::Group* worldParent = new osg::Group; > osg::Group* world = new osg::Group; > root->addChild(worldParent); > worldParent->addChild(world); > > // Create a sphere object. > osg::Sphere* sphere = new osg::Sphere(osg::Vec3(0, 0, 0), 10); > osg::ShapeDrawable* sphereDrawable = new osg::ShapeDrawable(sphere); > sphereDrawable->setColor(osg::Vec4(0, 0, 0, 1)); > osg::Geode* object = new osg::Geode(); > object->addDrawable(sphereDrawable); > > // Create a transform node for the sphere object. > osg::PositionAttitudeTransform* objectTransform = new > osg::PositionAttitudeTransform; > objectTransform->addChild(object); > world->addChild(objectTransform); > > // Create a viewer that looks at the world. > osgViewer::Viewer viewer; > viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); > viewer.setSceneData(worldParent); > > // Create a graphics window. > osg::ref_ptr traits = new > osg::GraphicsContext::Traits; > traits->x = 100; > traits->y = 100; > traits->width = 640; > traits->height = 480; > traits->windowDecoration = true; > traits->doubleBuffer = true; > traits->sharedContext = 0; > > // Create main camera. > osg::ref_ptr gc = > osg::GraphicsContext::createGraphicsContext(traits.get()); > osg::ref_ptr camera = viewer.getCamera(); > camera->setGraphicsContext(gc.get()); > camera->setViewport(new osg::Viewport(0, 0, traits->width, > camera->traits->height)); > GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT; > camera->setDrawBuffer(buffer); > camera->setReadBuffer(buffer); > camera->setClearColor(osg::Vec4(1,1,1,1)); > > // Camera callback for capturing the image. > osg::Image* image = new osg::Image; > camera->setPostDrawCallback(new ScreenShotCallback(traits->width, > traits->height, *image, GL_RGBA, GL_UNSIGNED_BYTE)); > > // Create shader objects. > osg::Shader* motionBlurVertexShader = new > osg::Shader(osg::Shader::VERTEX); > osg::Shader* motionBlurFragmentShader = new > osg::Shader(osg::Shader::FRAGMENT); > motionBlurVertexShader->loadShaderSourceFromFile > ("H:/My Documents/Visual Studio > 2008/Projects/osg_sfunction/osg_sfunction/motionblur.vert"); > motionBlurFragmentShader->loadShaderSourceFromFile > ("H:/My Documents/Visual Studio > 2008/Projects/osg_sfunction/osg_sfunction/motionblur.frag"); > > // Add shader objects to a program. > osg::Program* motionBlurProgram = new osg::Program; > motionBlurProgram->addShader(motionBlurVertexShader); > motionBlurProgram->addShader(motionBlurFragmentShader); > > // Define uniforms that will be passed to the shader. > osg::Uniform* numberOfTimeStepsU = new > osg::Uniform("numberOfTimeSteps", int(10)); > osg::Uniform* timeConstantU = new osg::Uniform("timeConstant", > float(0.01)); > osg::Uniform* frameTimeU = new osg::Uniform("frameTime", float(0.02)); > osg::Uniform* sceneTextureU = new osg::Uniform("sceneTexture", 0); > osg::Uniform* prevModelViewMatrixU = new > osg::Uniform(osg::Uniform::FLOAT_MAT4, "prevModelViewMatrix"); > osg::Uniform* prevModelViewProjectionMatrixU = new > osg::Uniform(osg::Uniform::FLOAT_MAT4, > "prevModelViewProjectionMatrix"); > > // Create a scene texture. > osg::Texture2D* texture = new osg::Texture2D; > texture->setResizeNonPowerOfTwoHint(false); > texture->setTextureSize(traits->width, traits->height); > texture->setInternalFormat(GL_RGBA); > texture->setFilter(osg::Texture2D::MIN_FILTER, > texture->osg::Texture2D::NEAREST); > texture->setFilter(osg::Texture2D::MAG_FILTER, > texture->osg::
Re: [osg-users] Render to texture problem
s->width, traits->height); RTTcamera->setRenderOrder(osg::Camera::PRE_RENDER); RTTcamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); RTTcamera->attach(osg::Camera::COLOR_BUFFER, texture); root->addChild(RTTcamera); RTTcamera->addChild(world); RTTcamera->attach(osg::Camera::COLOR_BUFFER, textureImage); RTTcamera->setPostDrawCallback(new ScreenShotCallback(traits->width, traits->height, *textureImage, GL_RGBA, GL_UNSIGNED_BYTE)); // Object position in world coordinates. objectTransform->setPosition(osg::Vec3(-25, 0, 0)); // Camera position in world coordinates. osg::Matrixd cameraMatrix; osg::Matrixd cameraRotation; osg::Matrixd cameraTrans; cameraRotation.makeRotate(osg::DegreesToRadians(0.0), osg::Vec3(0,1,0), // roll osg::DegreesToRadians(0.0), osg::Vec3(1,0,0), // pitch osg::DegreesToRadians(0.0), osg::Vec3(0,0,1)); // yaw cameraTrans.makeTranslate(0, -500, 0); cameraMatrix = cameraRotation*cameraTrans; // The view matrix is the inverse of the camera position matrix. osg::Matrixd viewMatrix = cameraMatrix.inverse(cameraMatrix); osg::Matrixd rotationToYUp;// Conversion to OpenGL "Y up" standard. rotationToYUp.makeRotate(-M_PI/2.0, osg::Vec3(1.0, 0.0, 0.0)); viewMatrix = viewMatrix*rotationToYUp; // Set view and projection matrices. camera->setViewMatrix(viewMatrix); camera->setProjectionMatrixAsPerspective(10., 4.0/3.0, 1., 1000.); RTTcamera->setViewMatrix(viewMatrix); RTTcamera->setProjectionMatrixAsPerspective(10., 4.0/3.0, 1., 1000.); // Create callbacks for updating uniform values. osg::NodePath np; np.push_back(objectTransform); prevModelViewMatrixU->setUpdateCallback(new UpdateUniformCallback(UpdateUniformCallback::MODEL_VIEW, np, camera.get())); prevModelViewProjectionMatrixU->setUpdateCallback(new UpdateUniformCallback(UpdateUniformCallback::MODEL_VIEW_PROJECTION, np, camera.get())); // Show first frame. if (!viewer.isRealized()) { viewer.realize(); } viewer.frame(); if (image->data()) { osgDB::writeImageFile(*image, "h:/temp/blurImage1.bmp"); } if (textureImage->data()) { osgDB::writeImageFile(*textureImage, "h:/temp/textureImage1.bmp"); } // Move the sphere object. objectTransform->setPosition(osg::Vec3(25, 0, 0)); // Show second frame. viewer.frame(); if (image->data()) { osgDB::writeImageFile(*image, "h:/temp/blurImage2.bmp"); } if (textureImage->data()) { osgDB::writeImageFile(*textureImage, "h:/temp/textureImage2.bmp"); } while (!viewer.done()) { viewer.frame(); } *Från:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *För *Andreas Lindmark *Skickat:* den 7 november 2008 10:33 *Till:* OpenSceneGraph Users *Ämne:* Re: [osg-users] Render to texture problem The camera has to be somewhere in the scenegraph under the root. Something like this: Root /\ RTTCamera Node1 \/ World Set the uniforms that you currently set at the Root in Node1 instead and they will not be used when rendering with the RTTCamera. /Andreas 2008/11/7 Engvall Åsa <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> No, it isn't. Should it be? I tried to draw the scenegraph in my first message, but it's not easy just using text. If you want more code, please tell me. Åsa -Ursprungligt meddelande- Från: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> [mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>] För J.P. Delport Skickat: den 7 november 2008 09:42 Till: OpenSceneGraph Users Ämne: Re: [osg-users] Render to texture problem Hi, is your RTT camera the child of anything? I'm just guessing without having an example to run. jp Engvall Åsa wrote: > I thought that the texture must be in RGBA to be used in a shader. The > callback was just for debugging, so I didn't think so much about the > format. Now I have changed to RGBA format in the callback too. I have > also set the viewer to singlethreaded, using this command: > viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); > > Unfortunately, the texture is still gray. > > Åsa > > -Ursprungligt meddelande- > Från: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > [mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>] För J.P. Delport > Skickat: den 7 november 2008 08:22 > Till: OpenSceneGraph Users > Ämne: Re: [osg-users] Render to texture problem > > Hi, > > any reason why you have RGBA texture, but RGB in callback? > > jp > > Engvall Åsa wrote: >> Hi! >> >> I want to render the scene to
Re: [osg-users] Render to texture problem
ModelViewProjectionMatrixU); > state->setAttributeAndModes(motionBlurProgram, osg::StateAttribute::ON); > state->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); > > // Create a camera that renders the scene to a texture. > osg::Camera* RTTcamera = new osg::Camera; > RTTcamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); // View matrix > is set manually. > RTTcamera->setClearColor(osg::Vec4(1,1,1,1)); > RTTcamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); > RTTcamera->setViewport(0, 0, traits->width, traits->height); > RTTcamera->setRenderOrder(osg::Camera::PRE_RENDER); > RTTcamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); > RTTcamera->attach(osg::Camera::COLOR_BUFFER, texture); > root->addChild(RTTcamera); > RTTcamera->addChild(world); > RTTcamera->attach(osg::Camera::COLOR_BUFFER, textureImage); > RTTcamera->setPostDrawCallback(new ScreenShotCallback(traits->width, > traits->height, *textureImage, GL_RGBA, GL_UNSIGNED_BYTE)); > > // Object position in world coordinates. > objectTransform->setPosition(osg::Vec3(-25, 0, 0)); > > // Camera position in world coordinates. > osg::Matrixd cameraMatrix; > osg::Matrixd cameraRotation; > osg::Matrixd cameraTrans; > cameraRotation.makeRotate(osg::DegreesToRadians(0.0), osg::Vec3(0,1,0), // > roll > osg::DegreesToRadians(0.0), osg::Vec3(1,0,0), // pitch > osg::DegreesToRadians(0.0), osg::Vec3(0,0,1)); // yaw > cameraTrans.makeTranslate(0, -500, 0); > cameraMatrix = cameraRotation*cameraTrans; > > // The view matrix is the inverse of the camera position matrix. > osg::Matrixd viewMatrix = cameraMatrix.inverse(cameraMatrix); > osg::Matrixd rotationToYUp;// Conversion to OpenGL "Y up" standard. > rotationToYUp.makeRotate(-M_PI/2.0, osg::Vec3(1.0, 0.0, 0.0)); > viewMatrix = viewMatrix*rotationToYUp; > > // Set view and projection matrices. > camera->setViewMatrix(viewMatrix); > camera->setProjectionMatrixAsPerspective(10., 4.0/3.0, 1., 1000.); > RTTcamera->setViewMatrix(viewMatrix); > RTTcamera->setProjectionMatrixAsPerspective(10., 4.0/3.0, 1., 1000.); > > // Create callbacks for updating uniform values. > osg::NodePath np; > np.push_back(objectTransform); > prevModelViewMatrixU->setUpdateCallback(newUpdateUniformCallback(UpdateUniformCallback::MODEL_VIEW, > np, camera.get())); > prevModelViewProjectionMatrixU->setUpdateCallback(newUpdateUniformCallback(UpdateUniformCallback::MODEL_VIEW_PROJECTION, > np, > camera.get())); > > // Show first frame. > if (!viewer.isRealized()) > { > viewer.realize(); > } > viewer.frame(); > if (image->data()) > { > osgDB::writeImageFile(*image, "h:/temp/blurImage1.bmp"); > } > if (textureImage->data()) > { > osgDB::writeImageFile(*textureImage, "h:/temp/textureImage1.bmp"); > } > > // Move the sphere object. > objectTransform->setPosition(osg::Vec3(25, 0, 0)); > > // Show second frame. > viewer.frame(); > if (image->data()) > { > osgDB::writeImageFile(*image, "h:/temp/blurImage2.bmp"); > } > if (textureImage->data()) > { > osgDB::writeImageFile(*textureImage, "h:/temp/textureImage2.bmp"); > } > while (!viewer.done()) > { > viewer.frame(); > } > > -------------- > *Från:* [EMAIL PROTECTED] [mailto: > [EMAIL PROTECTED] *För *Andreas Lindmark > *Skickat:* den 7 november 2008 10:33 > > *Till:* OpenSceneGraph Users > *Ämne:* Re: [osg-users] Render to texture problem > > The camera has to be somewhere in the scenegraph under the root. > Something like this: > > Root > /\ > RTTCamera Node1 > \/ > World > > Set the uniforms that you currently set at the Root in Node1 instead and > they will not be used when rendering with the RTTCamera. > > /Andreas > > 2008/11/7 Engvall Åsa <[EMAIL PROTECTED]> > >> No, it isn't. Should it be? >> I tried to draw the scenegraph in my first message, but it's not easy just >> using text. >> If you want more code, please tell me. >> >> Åsa >> >> -Ursprungligt meddelande- >> Från: [EMAIL PROTECTED] [mailto: >> [EMAIL PROTECTED] För J.P. Delport >> Skickat: den 7 november 2008 09:42 >> Till: OpenSceneGraph Users >> Ämne: Re: [osg-users] Render to texture problem >> >> Hi, >> >> is your RTT camera the child of anything? I'm just guessing without having >> an example to run. >> >> jp >> >> Engvall Åsa wrote: >> > I thought that the texture must
Re: [osg-users] Render to texture problem
mera::FRAME_BUFFER_OBJECT); RTTcamera->attach(osg::Camera::COLOR_BUFFER, texture); root->addChild(RTTcamera); RTTcamera->addChild(world); RTTcamera->attach(osg::Camera::COLOR_BUFFER, textureImage); RTTcamera->setPostDrawCallback(new ScreenShotCallback(traits->width, traits->height, *textureImage, GL_RGBA, GL_UNSIGNED_BYTE)); // Object position in world coordinates. objectTransform->setPosition(osg::Vec3(-25, 0, 0)); // Camera position in world coordinates. osg::Matrixd cameraMatrix; osg::Matrixd cameraRotation; osg::Matrixd cameraTrans; cameraRotation.makeRotate(osg::DegreesToRadians(0.0), osg::Vec3(0,1,0), // roll osg::DegreesToRadians(0.0), osg::Vec3(1,0,0), // pitch osg::DegreesToRadians(0.0), osg::Vec3(0,0,1)); // yaw cameraTrans.makeTranslate(0, -500, 0); cameraMatrix = cameraRotation*cameraTrans; // The view matrix is the inverse of the camera position matrix. osg::Matrixd viewMatrix = cameraMatrix.inverse(cameraMatrix); osg::Matrixd rotationToYUp;// Conversion to OpenGL "Y up" standard. rotationToYUp.makeRotate(-M_PI/2.0, osg::Vec3(1.0, 0.0, 0.0)); viewMatrix = viewMatrix*rotationToYUp; // Set view and projection matrices. camera->setViewMatrix(viewMatrix); camera->setProjectionMatrixAsPerspective(10., 4.0/3.0, 1., 1000.); RTTcamera->setViewMatrix(viewMatrix); RTTcamera->setProjectionMatrixAsPerspective(10., 4.0/3.0, 1., 1000.); // Create callbacks for updating uniform values. osg::NodePath np; np.push_back(objectTransform); prevModelViewMatrixU->setUpdateCallback(new UpdateUniformCallback(UpdateUniformCallback::MODEL_VIEW, np, camera.get())); prevModelViewProjectionMatrixU->setUpdateCallback(new UpdateUniformCallback(UpdateUniformCallback::MODEL_VIEW_PROJECTION, np, camera.get())); // Show first frame. if (!viewer.isRealized()) { viewer.realize(); } viewer.frame(); if (image->data()) { osgDB::writeImageFile(*image, "h:/temp/blurImage1.bmp"); } if (textureImage->data()) { osgDB::writeImageFile(*textureImage, "h:/temp/textureImage1.bmp"); } // Move the sphere object. objectTransform->setPosition(osg::Vec3(25, 0, 0)); // Show second frame. viewer.frame(); if (image->data()) { osgDB::writeImageFile(*image, "h:/temp/blurImage2.bmp"); } if (textureImage->data()) { osgDB::writeImageFile(*textureImage, "h:/temp/textureImage2.bmp"); } while (!viewer.done()) { viewer.frame(); } Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För Andreas Lindmark Skickat: den 7 november 2008 10:33 Till: OpenSceneGraph Users Ämne: Re: [osg-users] Render to texture problem The camera has to be somewhere in the scenegraph under the root. Something like this: Root /\ RTTCamera Node1 \/ World Set the uniforms that you currently set at the Root in Node1 instead and they will not be used when rendering with the RTTCamera. /Andreas 2008/11/7 Engvall Åsa <[EMAIL PROTECTED]> No, it isn't. Should it be? I tried to draw the scenegraph in my first message, but it's not easy just using text. If you want more code, please tell me. Åsa -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För J.P. Delport Skickat: den 7 november 2008 09:42 Till: OpenSceneGraph Users Ämne: Re: [osg-users] Render to texture problem Hi, is your RTT camera the child of anything? I'm just guessing without having an example to run. jp Engvall Åsa wrote: > I thought that the texture must be in RGBA to be used in a shader. The > callback was just for debugging, so I didn't think so much about the > format. Now I have changed to RGBA format in the callback too. I have > also set the viewer to singlethreaded, using this command: > viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); > > Unfortunately, the texture is still gray. > > Åsa > > -Ursprungligt meddelande- > Från: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] För J.P. Delport > Skickat: den 7 november 2008 08:22 > Till: OpenSceneGraph Users > Ämne: Re: [osg-users] Render to texture problem > > Hi, > > any reason why you have RGBA texture, but RGB in callback? > > jp > > Engvall Åsa wrote: >> Hi! >> >> I want to render the scene to a texture and use the texture in a shader. >> The texture image is saved to file by a postdraw callback, so I can >> look at it. I'm doing something wrong b
Re: [osg-users] Render to texture problem
The camera has to be somewhere in the scenegraph under the root. Something like this: Root /\ RTTCamera Node1 \/ World Set the uniforms that you currently set at the Root in Node1 instead and they will not be used when rendering with the RTTCamera. /Andreas 2008/11/7 Engvall Åsa <[EMAIL PROTECTED]> > No, it isn't. Should it be? > I tried to draw the scenegraph in my first message, but it's not easy just > using text. > If you want more code, please tell me. > > Åsa > > -Ursprungligt meddelande- > Från: [EMAIL PROTECTED] [mailto: > [EMAIL PROTECTED] För J.P. Delport > Skickat: den 7 november 2008 09:42 > Till: OpenSceneGraph Users > Ämne: Re: [osg-users] Render to texture problem > > Hi, > > is your RTT camera the child of anything? I'm just guessing without having > an example to run. > > jp > > Engvall Åsa wrote: > > I thought that the texture must be in RGBA to be used in a shader. The > > callback was just for debugging, so I didn't think so much about the > > format. Now I have changed to RGBA format in the callback too. I have > > also set the viewer to singlethreaded, using this command: > > viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); > > > > Unfortunately, the texture is still gray. > > > > Åsa > > > > -Ursprungligt meddelande----- > > Från: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] För J.P. Delport > > Skickat: den 7 november 2008 08:22 > > Till: OpenSceneGraph Users > > Ämne: Re: [osg-users] Render to texture problem > > > > Hi, > > > > any reason why you have RGBA texture, but RGB in callback? > > > > jp > > > > Engvall Åsa wrote: > >> Hi! > >> > >> I want to render the scene to a texture and use the texture in a shader. > >> The texture image is saved to file by a postdraw callback, so I can > >> look at it. I'm doing something wrong because the texture becomes all > gray. > >> > >> My scene graph looks like this: > >> > >> RTT camera root > >>| | > >>\/ > >> world > >> > >> The main viewer looks at the root and the shader program is applied > >> to the root stateset. Below is a code snippet. > >> > >> I would be very grateful if somebody could point out what I'm doing > wrong. > >> Thanks in advance, > >> > >> Åsa Engvall > >> > >> > >> // Create a scene texture. > >> osg::Texture2D* texture = new osg::Texture2D; > >> texture->setResizeNonPowerOfTwoHint(false); > >> texture->setTextureSize(traits->width, traits->height); > >> texture->setInternalFormat(GL_RGBA); > >> texture->setFilter(osg::Texture2D::MIN_FILTER, > >> texture->osg::Texture2D::NEAREST); > >> texture->setFilter(osg::Texture2D::MAG_FILTER, > >> texture->osg::Texture2D::NEAREST); > >> osg::Image* textureImage = new osg::Image; > >> textureImage->allocateImage(traits->width, traits->height, 1, > >> textureImage->GL_RGBA, > >> GL_UNSIGNED_BYTE); > >> texture->setImage(0, textureImage); > >> > >> // Add program and uniforms to the root's stateset. > >> osg::StateSet* state = root->getOrCreateStateSet(); > >> state->addUniform(numberOfTimeStepsU); > >> state->addUniform(timeConstantU); > >> state->addUniform(frameTimeU); > >> state->addUniform(sceneTextureU); > >> state->addUniform(prevModelViewMatrixU); > >> state->addUniform(prevModelViewProjectionMatrixU); > >> state->setAttributeAndModes(motionBlurProgram, > >> state->osg::StateAttribute::ON); setTextureAttributeAndModes(0, > >> state->texture, osg::StateAttribute::ON); > >> > >> // Create a camera that renders the scene to a texture. > >> osg::Camera* RTTcamera = new osg::Camera; > >> RTTcamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); > >> RTTcamera->setClearColor(osg::Vec4(1,1,1,1)); > >> RTTcamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); > >> RTTcamera->setViewport(0, 0, traits->width, traits->height); > >> RTTcamera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR > >> RTTcamera->) ; setRenderOrder(osg::Camera::PRE_RENDER); > >> RTTcamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OB > >> RTTcamera->J ECT
Re: [osg-users] Render to texture problem
No, it isn't. Should it be? I tried to draw the scenegraph in my first message, but it's not easy just using text. If you want more code, please tell me. Åsa -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För J.P. Delport Skickat: den 7 november 2008 09:42 Till: OpenSceneGraph Users Ämne: Re: [osg-users] Render to texture problem Hi, is your RTT camera the child of anything? I'm just guessing without having an example to run. jp Engvall Åsa wrote: > I thought that the texture must be in RGBA to be used in a shader. The > callback was just for debugging, so I didn't think so much about the > format. Now I have changed to RGBA format in the callback too. I have > also set the viewer to singlethreaded, using this command: > viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); > > Unfortunately, the texture is still gray. > > Åsa > > -Ursprungligt meddelande- > Från: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] För J.P. Delport > Skickat: den 7 november 2008 08:22 > Till: OpenSceneGraph Users > Ämne: Re: [osg-users] Render to texture problem > > Hi, > > any reason why you have RGBA texture, but RGB in callback? > > jp > > Engvall Åsa wrote: >> Hi! >> >> I want to render the scene to a texture and use the texture in a shader. >> The texture image is saved to file by a postdraw callback, so I can >> look at it. I'm doing something wrong because the texture becomes all gray. >> >> My scene graph looks like this: >> >> RTT camera root >>| | >>\/ >> world >> >> The main viewer looks at the root and the shader program is applied >> to the root stateset. Below is a code snippet. >> >> I would be very grateful if somebody could point out what I'm doing wrong. >> Thanks in advance, >> >> Åsa Engvall >> >> >> // Create a scene texture. >> osg::Texture2D* texture = new osg::Texture2D; >> texture->setResizeNonPowerOfTwoHint(false); >> texture->setTextureSize(traits->width, traits->height); >> texture->setInternalFormat(GL_RGBA); >> texture->setFilter(osg::Texture2D::MIN_FILTER, >> texture->osg::Texture2D::NEAREST); >> texture->setFilter(osg::Texture2D::MAG_FILTER, >> texture->osg::Texture2D::NEAREST); >> osg::Image* textureImage = new osg::Image; >> textureImage->allocateImage(traits->width, traits->height, 1, >> textureImage->GL_RGBA, >> GL_UNSIGNED_BYTE); >> texture->setImage(0, textureImage); >> >> // Add program and uniforms to the root's stateset. >> osg::StateSet* state = root->getOrCreateStateSet(); >> state->addUniform(numberOfTimeStepsU); >> state->addUniform(timeConstantU); >> state->addUniform(frameTimeU); >> state->addUniform(sceneTextureU); >> state->addUniform(prevModelViewMatrixU); >> state->addUniform(prevModelViewProjectionMatrixU); >> state->setAttributeAndModes(motionBlurProgram, >> state->osg::StateAttribute::ON); setTextureAttributeAndModes(0, >> state->texture, osg::StateAttribute::ON); >> >> // Create a camera that renders the scene to a texture. >> osg::Camera* RTTcamera = new osg::Camera; >> RTTcamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); >> RTTcamera->setClearColor(osg::Vec4(1,1,1,1)); >> RTTcamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); >> RTTcamera->setViewport(0, 0, traits->width, traits->height); >> RTTcamera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR >> RTTcamera->) ; setRenderOrder(osg::Camera::PRE_RENDER); >> RTTcamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OB >> RTTcamera->J ECT); attach(osg::Camera::COLOR_BUFFER, texture); >> RTTcamera->addChild(world); attach(osg::Camera::COLOR_BUFFER, >> RTTcamera->textureImage); setPostDrawCallback(new >> RTTcamera->ScreenShotCallback(traits->width, >> traits->height, *textureImage, GL_RGB, GL_UNSIGNED_BYTE)); >> >> >> >> - >> - >> -- >> >> ___ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph. >> org > > -- > This message is subject to the CSIR's copyright terms and conditions, e-mail > legal notice, and implemented Open Document Format (ODF) standard.
Re: [osg-users] Render to texture problem
Hi, is your RTT camera the child of anything? I'm just guessing without having an example to run. jp Engvall Åsa wrote: I thought that the texture must be in RGBA to be used in a shader. The callback was just for debugging, so I didn't think so much about the format. Now I have changed to RGBA format in the callback too. I have also set the viewer to singlethreaded, using this command: viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); Unfortunately, the texture is still gray. Åsa -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För J.P. Delport Skickat: den 7 november 2008 08:22 Till: OpenSceneGraph Users Ämne: Re: [osg-users] Render to texture problem Hi, any reason why you have RGBA texture, but RGB in callback? jp Engvall Åsa wrote: Hi! I want to render the scene to a texture and use the texture in a shader. The texture image is saved to file by a postdraw callback, so I can look at it. I'm doing something wrong because the texture becomes all gray. My scene graph looks like this: RTT camera root | | \/ world The main viewer looks at the root and the shader program is applied to the root stateset. Below is a code snippet. I would be very grateful if somebody could point out what I'm doing wrong. Thanks in advance, Åsa Engvall // Create a scene texture. osg::Texture2D* texture = new osg::Texture2D; texture->setResizeNonPowerOfTwoHint(false); texture->setTextureSize(traits->width, traits->height); texture->setInternalFormat(GL_RGBA); texture->setFilter(osg::Texture2D::MIN_FILTER, texture->osg::Texture2D::NEAREST); texture->setFilter(osg::Texture2D::MAG_FILTER, texture->osg::Texture2D::NEAREST); osg::Image* textureImage = new osg::Image; textureImage->allocateImage(traits->width, traits->height, 1, GL_RGBA, GL_UNSIGNED_BYTE); texture->setImage(0, textureImage); // Add program and uniforms to the root's stateset. osg::StateSet* state = root->getOrCreateStateSet(); state->addUniform(numberOfTimeStepsU); state->addUniform(timeConstantU); state->addUniform(frameTimeU); state->addUniform(sceneTextureU); state->addUniform(prevModelViewMatrixU); state->addUniform(prevModelViewProjectionMatrixU); state->setAttributeAndModes(motionBlurProgram, state->osg::StateAttribute::ON); setTextureAttributeAndModes(0, state->texture, osg::StateAttribute::ON); // Create a camera that renders the scene to a texture. osg::Camera* RTTcamera = new osg::Camera; RTTcamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); RTTcamera->setClearColor(osg::Vec4(1,1,1,1)); RTTcamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); RTTcamera->setViewport(0, 0, traits->width, traits->height); RTTcamera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR) RTTcamera->; setRenderOrder(osg::Camera::PRE_RENDER); RTTcamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJ RTTcamera->ECT); attach(osg::Camera::COLOR_BUFFER, texture); RTTcamera->addChild(world); attach(osg::Camera::COLOR_BUFFER, RTTcamera->textureImage); setPostDrawCallback(new RTTcamera->ScreenShotCallback(traits->width, traits->height, *textureImage, GL_RGB, GL_UNSIGNED_BYTE)); -- -- ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph. org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture problem
I thought that the texture must be in RGBA to be used in a shader. The callback was just for debugging, so I didn't think so much about the format. Now I have changed to RGBA format in the callback too. I have also set the viewer to singlethreaded, using this command: viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); Unfortunately, the texture is still gray. Åsa -Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För J.P. Delport Skickat: den 7 november 2008 08:22 Till: OpenSceneGraph Users Ämne: Re: [osg-users] Render to texture problem Hi, any reason why you have RGBA texture, but RGB in callback? jp Engvall Åsa wrote: > Hi! > > I want to render the scene to a texture and use the texture in a shader. > The texture image is saved to file by a postdraw callback, so I can > look at it. I'm doing something wrong because the texture becomes all gray. > > My scene graph looks like this: > > RTT camera root >| | >\/ > world > > The main viewer looks at the root and the shader program is applied to > the root stateset. Below is a code snippet. > > I would be very grateful if somebody could point out what I'm doing wrong. > Thanks in advance, > > Åsa Engvall > > > // Create a scene texture. > osg::Texture2D* texture = new osg::Texture2D; > texture->setResizeNonPowerOfTwoHint(false); > texture->setTextureSize(traits->width, traits->height); > texture->setInternalFormat(GL_RGBA); > texture->setFilter(osg::Texture2D::MIN_FILTER, > texture->osg::Texture2D::NEAREST); > texture->setFilter(osg::Texture2D::MAG_FILTER, > texture->osg::Texture2D::NEAREST); > osg::Image* textureImage = new osg::Image; > textureImage->allocateImage(traits->width, traits->height, 1, GL_RGBA, > GL_UNSIGNED_BYTE); > texture->setImage(0, textureImage); > > // Add program and uniforms to the root's stateset. > osg::StateSet* state = root->getOrCreateStateSet(); > state->addUniform(numberOfTimeStepsU); > state->addUniform(timeConstantU); > state->addUniform(frameTimeU); > state->addUniform(sceneTextureU); > state->addUniform(prevModelViewMatrixU); > state->addUniform(prevModelViewProjectionMatrixU); > state->setAttributeAndModes(motionBlurProgram, > state->osg::StateAttribute::ON); setTextureAttributeAndModes(0, > state->texture, osg::StateAttribute::ON); > > // Create a camera that renders the scene to a texture. > osg::Camera* RTTcamera = new osg::Camera; > RTTcamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); > RTTcamera->setClearColor(osg::Vec4(1,1,1,1)); > RTTcamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); > RTTcamera->setViewport(0, 0, traits->width, traits->height); > RTTcamera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR) > RTTcamera->; setRenderOrder(osg::Camera::PRE_RENDER); > RTTcamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJ > RTTcamera->ECT); attach(osg::Camera::COLOR_BUFFER, texture); > RTTcamera->addChild(world); attach(osg::Camera::COLOR_BUFFER, > RTTcamera->textureImage); setPostDrawCallback(new > RTTcamera->ScreenShotCallback(traits->width, > traits->height, *textureImage, GL_RGB, GL_UNSIGNED_BYTE)); > > > > -- > -- > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph. > org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture problem
Hi, any reason why you have RGBA texture, but RGB in callback? jp Engvall Åsa wrote: Hi! I want to render the scene to a texture and use the texture in a shader. The texture image is saved to file by a postdraw callback, so I can look at it. I'm doing something wrong because the texture becomes all gray. My scene graph looks like this: RTT camera root | | \/ world The main viewer looks at the root and the shader program is applied to the root stateset. Below is a code snippet. I would be very grateful if somebody could point out what I'm doing wrong. Thanks in advance, Åsa Engvall // Create a scene texture. osg::Texture2D* texture = new osg::Texture2D; texture->setResizeNonPowerOfTwoHint(false); texture->setTextureSize(traits->width, traits->height); texture->setInternalFormat(GL_RGBA); texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST); texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST); osg::Image* textureImage = new osg::Image; textureImage->allocateImage(traits->width, traits->height, 1, GL_RGBA, GL_UNSIGNED_BYTE); texture->setImage(0, textureImage); // Add program and uniforms to the root's stateset. osg::StateSet* state = root->getOrCreateStateSet(); state->addUniform(numberOfTimeStepsU); state->addUniform(timeConstantU); state->addUniform(frameTimeU); state->addUniform(sceneTextureU); state->addUniform(prevModelViewMatrixU); state->addUniform(prevModelViewProjectionMatrixU); state->setAttributeAndModes(motionBlurProgram, osg::StateAttribute::ON); state->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); // Create a camera that renders the scene to a texture. osg::Camera* RTTcamera = new osg::Camera; RTTcamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); RTTcamera->setClearColor(osg::Vec4(1,1,1,1)); RTTcamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); RTTcamera->setViewport(0, 0, traits->width, traits->height); RTTcamera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); RTTcamera->setRenderOrder(osg::Camera::PRE_RENDER); RTTcamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); RTTcamera->attach(osg::Camera::COLOR_BUFFER, texture); RTTcamera->addChild(world); RTTcamera->attach(osg::Camera::COLOR_BUFFER, textureImage); RTTcamera->setPostDrawCallback(new ScreenShotCallback(traits->width, traits->height, *textureImage, GL_RGB, GL_UNSIGNED_BYTE)); ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture problem
Hi, can you force single threaded osgviewer and see if it still is a problem? jp Engvall Åsa wrote: Hi! I want to render the scene to a texture and use the texture in a shader. The texture image is saved to file by a postdraw callback, so I can look at it. I'm doing something wrong because the texture becomes all gray. My scene graph looks like this: RTT camera root | | \/ world The main viewer looks at the root and the shader program is applied to the root stateset. Below is a code snippet. I would be very grateful if somebody could point out what I'm doing wrong. Thanks in advance, Åsa Engvall // Create a scene texture. osg::Texture2D* texture = new osg::Texture2D; texture->setResizeNonPowerOfTwoHint(false); texture->setTextureSize(traits->width, traits->height); texture->setInternalFormat(GL_RGBA); texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST); texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST); osg::Image* textureImage = new osg::Image; textureImage->allocateImage(traits->width, traits->height, 1, GL_RGBA, GL_UNSIGNED_BYTE); texture->setImage(0, textureImage); // Add program and uniforms to the root's stateset. osg::StateSet* state = root->getOrCreateStateSet(); state->addUniform(numberOfTimeStepsU); state->addUniform(timeConstantU); state->addUniform(frameTimeU); state->addUniform(sceneTextureU); state->addUniform(prevModelViewMatrixU); state->addUniform(prevModelViewProjectionMatrixU); state->setAttributeAndModes(motionBlurProgram, osg::StateAttribute::ON); state->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); // Create a camera that renders the scene to a texture. osg::Camera* RTTcamera = new osg::Camera; RTTcamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF); RTTcamera->setClearColor(osg::Vec4(1,1,1,1)); RTTcamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); RTTcamera->setViewport(0, 0, traits->width, traits->height); RTTcamera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); RTTcamera->setRenderOrder(osg::Camera::PRE_RENDER); RTTcamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); RTTcamera->attach(osg::Camera::COLOR_BUFFER, texture); RTTcamera->addChild(world); RTTcamera->attach(osg::Camera::COLOR_BUFFER, textureImage); RTTcamera->setPostDrawCallback(new ScreenShotCallback(traits->width, traits->height, *textureImage, GL_RGB, GL_UNSIGNED_BYTE)); ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to texture problem
On Thu, Nov 6, 2008 at 5:16 PM, Engvall Åsa <[EMAIL PROTECTED]> wrote: > > I want to render the scene to a texture and use the texture in a shader. The > texture image is saved to file by a postdraw callback, so I can look at it. > I'm doing something wrong because the texture becomes all gray. I have the same problem. To make things worse, I have modified the osgdistortion example and that works. Unfortunately I was unable to pinpoint the difference between my application and the working example. I hope maybe somebody can list known caveats/requirements to using image attach. FWIW, it works if I don't attach the image, and use readPixels in a final draw callback. But I assume that is suboptimal (it does cause significant increase in the draw times). -- Csaba ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render To Texture problem in a Reflection algorithm
Hi, do both graphics cards support Frame_Buffer_object ? The problem could be in the renderfallback (i.e. PIXEL_BUFFER_RTT) if they do not support it? Try the different RTT methods if these seems to be the problem. Also , i think you maust set the viewport for FBO to work (i suppose it is set in another place also)...Also, you can set the notifylevel of OSG to WARN or DEBUG and see what is really happens. Good luck. Himar. 2007/12/3, zhangguilian <[EMAIL PROTECTED]>: > > Hi, > In an algorithm of reflection I used Render To Texture, part of the code > is: > > Texture2D* reflectionTex=new Texture2D;//rtt texture > reflectionTex->setTextureSize(512, 512); > reflectionTex->setInternalFormat(GL_RGBA); > > reflectionTex->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); > > reflectionTex->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); > > > reflectionTex->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE); > > > reflectionTex->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE); > > CameraNode * rttcamera=new CameraNode;//rttcam > rttcamera->setCullingMode(CullSettings::NO_CULLING); > rttcamera->setCullingActive(false); > rttcamera->setClearMask(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); > // rttcamera->setViewport(0,0,512,512); > rttcamera->setRenderOrder(CameraNode::PRE_RENDER); > > > rttcamera->setRenderTargetImplementation(CameraNode::FRAME_BUFFER_OBJECT,CameraNode::PIXEL_BUFFER_RTT); > rttcamera->attach(osg::CameraNode::COLOR_BUFFER,reflectionTex); > > osg::ClipNode* clipNode = new osg::ClipNode; > osg::ClipPlane* clipplane = new osg::ClipPlane; > Plane pl(normal,point); > clipplane->setClipPlane(pl); > clipplane->setClipPlaneNum(0); > clipNode->addClipPlane(clipplane); > clipNode->addChild(reflectTransform); > rttcamera->addChild(clipNode); > > I don't know why it running well on a GeForce 8800 GTS/PCI/SSE2 > from NVIDIA Corporation but doesn't have any reflection effect on a GeForce4 > MX 440/AGP/SSE2 from NVIDIA Corporation, > and while I add a line:rttcamera->setViewport(0,0,512,512),the later > machine(GeForce4 MX 440/AGP/SSE2 from NVIDIA Corporation) can have reflect > effect,but a strange phenomena appears: > an arbitrary window(relative or irrelative with the program) over it will > destroy the reflction map and the area destroyed will move with the > window over it > (once the window over it moves ,the destroyed area move too) , I don't > know what have happend and I eagerly to know how to solve the problem. > > Thanks very much! > zhangguilian > 2007.12.3 > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org