Hi,
It may be a simple one, but I am struggling since two days.
I am using a osg::Switch to load multiple models. It loads OSG models for some
options time and videos for some options.
When I loaded models the model displayed in the middle of the screen. If I
display the video it is not in the scope of the screen. I took transformation
matrix and did some rotations and transilations but i am unable to place the
video at the center of the screen. can any one help me how to bring the video
to the center of the screen.
My Viewer Settings
Code:
viewer = new osgViewer::Viewer();
viewer->setUpViewInWindow (200, 200, videoXRes, videoYRes);
viewer->getCamera()->setViewport(0,0,videoXRes,videoYRes);
viewer->setLightingMode(osg::View::HEADLIGHT);
viewer->addEventHandler(new CSimpleWndSizeHandler(videoXRes,videoYRes));
/*p is projection matrix from camera*/
viewer->getCamera()->setProjectionMatrix(osg::Matrix(p));
When I switch from model to video my code is as follwos
Code:
modelSwitch->setAllChildrenOff();
modelSwitch->setChildValue(videoTransMat,1);
/*Here i am doing some rotationa and transform operations on "videoTransMAt".
but i am unable to center to it*/
As in the OsgMovie example i created a 2d Texture and playing movie.
It is as follows
Code:
img = osgDB::readImageFile(filename);
videoStrm = dynamic_cast<osg::ImageStream*>(img);
videoStrm->setLoopingMode(osg::ImageStream::LoopingMode::LOOPING);
mVideoTexture = new osg::Texture2D;
geode = new osg::Geode;
mVideoTexture->setImage(videoStrm.get() );
geode->addDrawable(osg::createTexturedQuadGeometry(
osg::Vec3(0, 0, 0),
osg::Vec3(videoWidth, 0, 0),
osg::Vec3(0, 0, videoHeight)
));
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, mVideoTexture,
osg::StateAttribute::ON );
videoTransMat = new osg::MatrixTransform();
videoTransMat->addChild(geode.get());
modelSwitch->addChild(videoTransMat);
...
I am getting error when the video reaches to the end. My video is not in loop.
But I set looping mode to osg::ImageStream::LoopingMode::LOOPING
Can you please help me how to play the video in the center of the screen and
set the video in loop.
Thank you!
Cheers,
Koduri
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47638#47638
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org