Laurens Posted June 1, 2010 Share Posted June 1, 2010 Hi guys, I am about to start working on a GUI and I was wondering if any of you have tried implementing a third-party library such as CEGUI or Navi, or are instead rolling your own. Cheers! Quote Link to comment Share on other sites More sharing options...
Laurens Posted June 1, 2010 Author Share Posted June 1, 2010 Glancing over the CEGUI documentation it seems really easy to integrate. http://www.cegui.org.uk/api_reference/rendering_tutorial.html The setup for OpenGL is apparently limited to: // Create an OpenGLRenderer object that uses the current GL viewport as // the default output surface. CEGUI::OpenGLRenderer& myRenderer = CEGUI::OpenGLRenderer::create(); And the drawing is limited to; // user function to draw 3D scene draw3DScene(); // draw GUI (should not be between glBegin/glEnd pair) CEGUI::System::getSingleton().renderGUI(); Is it indeed possible for OpenGL to grab a window that is already open, such as the window created by LE without passing a handle to it? It almost seems to easy. Cheers! Quote Link to comment Share on other sites More sharing options...
ZioRed Posted June 1, 2010 Share Posted June 1, 2010 Masterxilo has written a tutorial for working with OpenGL and Rick was working on a CEGUI implementation on Leadwerks but I don't know what is its dev state. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Laurens Posted June 1, 2010 Author Share Posted June 1, 2010 Thanks for the links, I should use the search function more often Anyway, CEGUI seems like the right way to go and will give a crack at implementing it with my project. Cheers! Quote Link to comment Share on other sites More sharing options...
Kazar Posted June 1, 2010 Share Posted June 1, 2010 It would be great if Project Wizard had a CEGUI template *hint hint* Quote Core i5-750 - GTX 460 1GB - 12GB DDR3 - Win 7 x64 Link to comment Share on other sites More sharing options...
Canardia Posted June 1, 2010 Share Posted June 1, 2010 I ended up with making my own GUI, after trying CEGUI and GLUI. I don't know why most 3rd party GUIs are everything else than a GUI, most of them use their own renderers and fonts instead of just using the existing OpenGL canvas and existing commands like DrawText(). Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Laurens Posted June 1, 2010 Author Share Posted June 1, 2010 I agree that most are pretty bloated but I prefer not to spend time on writing a system myself. Perhaps I'll replace it later on in the process but right now I would like to focus on gameplay. Quote Link to comment Share on other sites More sharing options...
ZioRed Posted June 1, 2010 Share Posted June 1, 2010 A goal already written on my notepad for next tasks is to create a GUI library which uses only LE commands like PGUI3 does (but for not NET platform), I'd like to have all inside the engine environment and not like much to add more dependencies to achieve what I can do (hardly or not) with engine commands. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Rick Posted June 1, 2010 Share Posted June 1, 2010 I was able to get CEGUI working and it was pretty simple. I had a project to strip down CEGUI and make a single dll and include that would make it much easier to work with for LE users, but it turned out to be a giant pain. Getting it to work as it is wasn't bad though. Quote Link to comment Share on other sites More sharing options...
Kazar Posted June 1, 2010 Share Posted June 1, 2010 I was able to get CEGUI working and it was pretty simple. I had a project to strip down CEGUI and make a single dll and include that would make it much easier to work with for LE users, but it turned out to be a giant pain. Getting it to work as it is wasn't bad though. Any chance you could zip a working c++ template with CEGUI dlls included ? Quote Core i5-750 - GTX 460 1GB - 12GB DDR3 - Win 7 x64 Link to comment Share on other sites More sharing options...
Laurens Posted June 1, 2010 Author Share Posted June 1, 2010 I am willing to supply a working template if I can get it up and running properly. I have been following the documentation over on cegui.org.uk and my code compiles fine, it just isn't showing anything on the screen. My setup routine is as follows: ScreenManager::ScreenManager() : ceguiRenderer(CEGUI::OpenGLRenderer::create()) { framework.Create(); CEGUI::System::create(ceguiRenderer); CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider()); rp->setResourceGroupDirectory("schemes", "GUI/schemes/"); rp->setResourceGroupDirectory("layouts", "GUI/layouts/"); rp->setResourceGroupDirectory("looknfeels", "GUI/looknfeel/"); rp->setResourceGroupDirectory("imagesets", "GUI/imagesets/"); rp->setResourceGroupDirectory("fonts", "GUI/fonts/"); rp->setResourceGroupDirectory("schemas", "GUI/xml_schemas/"); CEGUI::Scheme::setDefaultResourceGroup("schemes"); CEGUI::WindowManager::setDefaultResourceGroup("layouts"); CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels"); CEGUI::Imageset::setDefaultResourceGroup("imagesets"); CEGUI::Font::setDefaultResourceGroup("fonts"); CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser(); if(parser->isPropertyPresent("SchemaDefaultResourceGroup")) { parser->setProperty("SchemaDefaultResourceGroup", "schemas"); } } Then, the constructor of the MenuScreen is supposed to add a new frame window: MenuScreen::MenuScreen() : Screen() { CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme"); CEGUI::FontManager::getSingleton().create( "DejaVuSans-10.font" ); CEGUI::System::getSingleton().setDefaultFont("DejaVuSans-10"); CEGUI::WindowManager &wm = CEGUI::WindowManager::getSingleton(); CEGUI::Window *root = wm.createWindow("DefaultWindow", "root"); CEGUI::System::getSingleton().setGUISheet(root); CEGUI::FrameWindow *fWnd = static_cast<CEGUI::FrameWindow*>(wm.createWindow("TaharezLook/FrameWindow", "testWindow")); root->addChildWindow(fWnd); // position a quarter of the way in from the top-left of parent. fWnd->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25f, 0), CEGUI::UDim(0.25f, 0))); // set size to be half the size of the parent fWnd->setSize(CEGUI::UVector2(CEGUI::UDim(0.5f, 0), CEGUI::UDim(0.5f, 0))); fWnd->setText("Hello World (from CEGUI)!"); } It is then rendered as follows: void ScreenManager::Render() { framework.Render(); CEGUI::System::getSingleton().renderGUI(); } Immediatly after which Flip(1) is called. I ran the example Drew wrote in http://leadwerks.com/werkspace/index.php?/topic/1484-cegui-leadwerks/page__view__findpost__p__13811 just fine but that example was not using Framework. Could this be causing it? Cheers! EDIT: There are not errors in Cegui.log whatsoever. Quote Link to comment Share on other sites More sharing options...
Rick Posted June 1, 2010 Share Posted June 1, 2010 When I get home I'll get my working CEGUI example I had and post it here. Quote Link to comment Share on other sites More sharing options...
Laurens Posted June 1, 2010 Author Share Posted June 1, 2010 Thanks Rick, looking forward to it Quote Link to comment Share on other sites More sharing options...
Rick Posted June 1, 2010 Share Posted June 1, 2010 Well, I can't find my working exe code. I found the dll I was trying to make and I think I might have the reason why it's not working for you. Right before renderGUI put: // CEGUI rendering glPixelStoref(0x806E, 0); // GL_UNPACK_IMAGE_HEIGHT glPixelStoref(GL_PACK_ROW_LENGTH, 0); glPixelStoref(GL_UNPACK_ROW_LENGTH, 0); System::getSingleton().renderGUI(); That should help you see the GUI. Quote Link to comment Share on other sites More sharing options...
Laurens Posted June 2, 2010 Author Share Posted June 2, 2010 Hi Rick, I just managed to get it working! The following code glPixelStoref(0x806E, 0); // GL_UNPACK_IMAGE_HEIGHT glPixelStoref(GL_PACK_ROW_LENGTH, 0); glPixelStoref(GL_UNPACK_ROW_LENGTH, 0); is only part of the solution. For the previous lines to take effect you have to enable extra state settings on the OpenGL renderer before calling them like so: ceguiRenderer.enableExtraStateSettings(true); I will write a blog later today or tomorrow getting Leadwerks working with Framework and CEGUI. Many thanks for the help everyone Cheers! Quote Link to comment Share on other sites More sharing options...
Kazar Posted June 2, 2010 Share Posted June 2, 2010 I will write a blog later today or tomorrow getting Leadwerks working with Framework and CEGUI. Thanks in advance Quote Core i5-750 - GTX 460 1GB - 12GB DDR3 - Win 7 x64 Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.