Page 1 of 1

OSG And CEGUI - Rendering Help

Posted: Wed Oct 11, 2006 23:59
by bundun_2002
Hi all, i have used the cegui system for a while now and love it. I have been using it with Ogre, but now have moved onto another project and want to take it with me.

I am working with the Open Scene Graph engine, rendering with Open GL. I finally got it rendering with the producer and viewer but the quads come out at 1/4 size. In the bottom left corner of the screen. I have attempted to edit the open gl renderer but got no where. Any ideas on how i can fix this. Would love to CEGUI as our team is familiar with it and its so god damn nice :P

Thanks - Brendan

Posted: Thu Oct 12, 2006 00:53
by granx
We have an osg::Drawable that kicks off CEGUI's OpenGLRenderer. It's working for us. Make sure you are getting the correct dimensions from the Producer RenderSurface, and send them to:
mRenderer->setDisplaySize( CEGUI::Size(width, height) );

That's all I can think of. Be sure to check the values you are seeing from Producer, it should be pixel sizes like 640, not the pseudo-normalized values that range from -1 to +1, with 0 being the center of the window.

Posted: Thu Oct 12, 2006 01:41
by bundun_2002
I thought it might be something like that, when i go into windowed mode in osg, the window takes up more of the window than before. I am setting up cegui in a RealizeCallback and is as follows

Code: Select all

unsigned int width, height;
Singletons::Instance().Viewer()->getCamera(0)->getRenderSurface()->getScreenSize(width, height);
renderer->setDisplaySize(CEGUI::Size(float(width), float(height)));

CEGUI::System * system = new CEGUI::System( renderer );


then i add a PostDrawCallback to the viewers camera. which does the following

Code: Select all

CEGUI::System::getSingleton().injectTimePulse(osg::Timer::instance()->getSecondsPerTick());
CEGUI::System::getSingleton().renderGUI();


thats how im doing it and i think it should work, but damned if it will.

any more help granx :?:

Posted: Thu Oct 12, 2006 02:04
by bundun_2002
ok i got it to render full screen, but now the z is off and it gets rendered behind certain things. i am doin it your way by adding a custom drawable to the scene and making its drawImplementation take care of the rendering.

here is the code for rendering

Code: Select all

if (state.getContextID() != _activeContextID)
{
   return;
}

glPushAttrib(GL_ALL_ATTRIB_BITS);

state.disableAllVertexArrays();

CEGUI::System::getSingleton().renderGUI();

glPopAttrib();
         
state.checkGLErrors("CEGUIDrawable::drawImplementation");


I either need to know how to get the z order correct or to get the state into my post draw call back and disable the vertex arrays

any ideas

Posted: Thu Oct 12, 2006 02:29
by granx
You can force the draw order with the osg::StateSet from your Geode, so that it always draws on top. The code looks like:
stateset->setRenderBinDetails(11,"RenderBin");