OSG And CEGUI - Rendering Help

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

bundun_2002
Just popping in
Just popping in
Posts: 3
Joined: Fri Oct 06, 2006 05:39

OSG And CEGUI - Rendering Help

Postby bundun_2002 » Wed Oct 11, 2006 23:59

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

User avatar
granx
Quite a regular
Quite a regular
Posts: 80
Joined: Fri Apr 29, 2005 21:58

Postby granx » Thu Oct 12, 2006 00:53

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.

bundun_2002
Just popping in
Just popping in
Posts: 3
Joined: Fri Oct 06, 2006 05:39

Postby bundun_2002 » Thu Oct 12, 2006 01:41

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 :?:

bundun_2002
Just popping in
Just popping in
Posts: 3
Joined: Fri Oct 06, 2006 05:39

Postby bundun_2002 » Thu Oct 12, 2006 02:04

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

User avatar
granx
Quite a regular
Quite a regular
Posts: 80
Joined: Fri Apr 29, 2005 21:58

Postby granx » Thu Oct 12, 2006 02:29

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");


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 8 guests