Building mygui with OpenGL platform


04-01-2011 22:12:40

I have trouble building mygui when enabling the OpenGL platform. There is a pure virtual function that is not defined, and I have to set the size_t type of the last argument to integer cause size_t is not defined.
Mabel the problem is why I renamed the type.

Also I have a question: is it possible to create multiple platforms?
I mean first link against ogreplatform then openglplatform and activate both platforms in the game and showing OpenGL and ogre objects both at once in a window?
I need this, cause we want to merge from a pure OpenGL engine to ogre but the whole project is very large.
Also I don't know how to get input from mouse or keyboard.
I used the keypressed(..) funcs with injectkey... But I don't know what the inject funcs are for and how to use them in order to get the input. In fact the keypressed func isn't called when pressing a key.
EDIT: some code:

BaseFrameListener::keyPressed( const OIS::KeyEvent &arg )
    switch(arg.key)   {
     case MyGUI::KeyCode::M :
     case MyGUI::KeyCode::K :
     case MyGUI::KeyCode::Q :


04-01-2011 23:21:15

OpenGL platform compiles and runs fine on windows (both MyGUI 3.0 and version from trunk). So could you please tell what compiler/OS you have?

About multiple platforms - you can use only MyGUI with OpenGL platform or only with Ogre, what's the point of using both? Switching MyGUI from OpenGL to Ogre is a 10 minutes task - just use another MyGUI.Platform, so you can freely use MyGUI with OpenGL.

And what about input - I'm not sure what is BaseFrameListener class in your case, but I guess it should be OIS events listener and you not using OIS properly. Part of code that you posted here have completely nothing about MyGUI. MyGUI just takes input events from developer through set of inject*** functions.


05-01-2011 08:47:07

i am using linux with the Eclipse IDE.


#include "MyGUI_Prerequest.h"
#include "MyGUI_RenderTargetInfo.h"

#include "GL/glew.h" <----including glew solved the problem.

namespace MyGUI
virtual void doRender(IVertexBuffer* _buffer, ITexture* _texture, size_t _count) = 0; <---with the size_t type here

then i got problems building the common ffolder cause it was only for windows.
i disabled it and it compiled.

i mean works this:
configure mygui for ogre... and install
configure mygui for opengl... and install.

use this code:

mOgrePlatform = new MyGUI::OgrePlatform();
mOgrePlatform->initialise(win, sceneManager);
mOpenGLPlatform = new MyGUI::OpenGLPlatform();
mOpenGLPlatform->initialise(win, sceneManager);
mGUI = new MyGUI::Gui();

IVertexBuffer* buffer1,buffer2; ITexture* texture1,texture2; size_t count1,count2; some initialisation stuff...
OgreRenderManager::doRender( _buffer1, _texture1, _count1)
OpenGLRenderManager::doRender( _buffer2, _texture2, _count2);


05-01-2011 09:36:01

also, the openglplatform files weren't copied to the lib and include folders.
i copied them manually cause your CMakeLists.txt were too complicated.


05-01-2011 10:59:02

after compiling with ogre and opengl support, i
initialized the opengl platform only. initializing ogre and opengl platform gave me an assertion.

so i did this:

mOpenGLPlatform = new MyGUI::OpenGLPlatform();

when using ogre functions, they WORKED :)

i can't say much now but i got the ogre debug overlay and the app started with the ogre screen resolution selection msgbox.

so, it seems to work?


05-01-2011 14:44:20

Oh, actually I never tried to compile OpenGL platform under linux.
I'm glad that it works.


05-01-2011 17:32:22

including glew solved the problem.Actually including stddef.h was enough there. Commited fix for that. And what about content of Common folder - it is not win32 only, but under linux we used MyGUI only with Ogre, but not with OpenGL.


06-01-2011 09:10:08

can you tell me for what the common folder is for?
i compiled it with the ogre version and got a lib from it.
maybe i can use it for the ogre version, too.


06-01-2011 14:39:28

Common contain base initialisation code and input, used in all demos/tools (Base, Input folders), classes used in Tools and several classes like BaseLayout/PanelView/RenderBox that might be useful for MyGUI user, but not part of MyGUI itself.
Common.lib contain only code related to all demos/tools and you don't need it in your application. Also don't forget to compile LayoutEditor - I'm sure it will be useful for you.


15-01-2011 23:53:39

I came so far now with the OpenGL platform that -as I said- I got a window and rendered some ogre stuff in it.
The platform is initialized openglplatform.
I got now mouse and keyboard input.
However the app takes the mouse exclusively (if I render the app in a window, the pointer can't leave the window), and does not show the mouse.
The mygui_core.xml won't be loaded in.
I think I have to set up the OpenGL data manager , set the path to the mygui_core folder, and call the RenderWindow::_initialize(..) func to set the overlapped modus.

Is that correct?

Also I have now 2 draw functions in my app: the ogre renderSingleFrame and the mygui drawFrame. Both are executed and I hope I can see OpenGL and ogre rendered stuff inside one window.