Pertur wrote:
> I´m trying to implement osg with CEGUI 0.7.1... we have the osgcegui.cpp
> example but is based on older version.!
I'm trying to do similar thing with CEGUI 0.7.1, I've got the code which worked
under plain OpenGL, but under OSG I've got white textures (geometry seems to be
ok, because I've got nice wireframes ;) ).
Anyway first thing, under CEGUI in resize event I have to get GL renderer and
notify CEGUI about window change size.
Code:
CEGUI::OpenGLRenderer *glRenderer=static_cast<CEGUI::OpenGLRenderer
*>(CEGUI::System::getSingleton().getRenderer());
glRenderer->grabTextures();
CEGUI::System::getSingleton().notifyDisplaySizeChanged(CEGUI::Size((float)size.width(),(float)size.height()));
glRenderer->restoreTextures();
Problem is that notifyDisplaySizeChanged() gives me exception:
Code:
terminate called after throwing an instance of 'CEGUI::RendererException
CEGUI::RendererException'
what(): CEGUI::RendererException in file CEGUIOpenGLTexture.cpp(204) :
OpenGLTexture::setTextureSize: size too big
CEGUI::RendererException in file CEGUIOpenGLTexture.cpp(204) :
OpenGLTexture::setTextureSize: size too big
I'm adding CEGUI drawable like this:
Code:
root=new osg::Group;
scene= new osg::Group;
string str;
gui=new osg::Group;
osg::setNotifyLevel(osg::ALWAYS );
osg::ref_ptr<osg::Geode> guiGeom=new osg::Geode;
osg::ref_ptr<osg::Camera> HUDcam = new osg::Camera;
HUDcam->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
HUDcam->setClearMask(0);
HUDcam->setRenderOrder(osg::Camera::POST_RENDER);
HUDcam->setAllowEventFocus(false);
HUDcam->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OVERRIDE
| osg::StateAttribute::OFF);
HUDcam->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE
|osg::StateAttribute::OFF);
HUDcam->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
HUDcam->getOrCreateStateSet()->setRenderBinDetails(100,"RenderBin");
HUDcam->getOrCreateStateSet()->setMode(GL_BLEND,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
HUDcam->getOrCreateStateSet()->setTextureMode(0, GL_TEXTURE_2D,
osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
HUDcam->setProjectionMatrix(osg::Matrix::ortho2D(0,1024,0,768));
osg::CullFace *cull = new osg::CullFace();
cull->setMode(osg::CullFace::BACK);
HUDcam->getOrCreateStateSet()->setAttributeAndModes(cull,
osg::StateAttribute::ON);
scene->setName("3d_scene");
root->setName("root");
gui->setName("gui");
//add groups to the main node
root->addChild(scene);
HUDcam->addChild(gui.get());
// load the scene.
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile("cow.osg");
scene->addChild(loadedModel.get());
this->setThreadingModel(osgViewer::Viewer::SingleThreaded);
this->realize();
this->getCamera()->getGraphicsContext()->makeCurrent();
osg::ref_ptr<CEGUIDrawable> cd = new CEGUIDrawable();
root->addChild(scene.get());
root->addChild(HUDcam.get());
guiGeom->addDrawable(cd.get());
gui->addChild(guiGeom.get());
this->setSceneData(root.get());
Anyone had problems like this?
[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=27747#27747
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org