Apostate
Apostate

Reputation: 247

Why am I not getting any screen output from MyGUI in my OpenGL engine?

I'm trying to integrate MyGUI 3.2.0 into my OpenGL 3 engine, but I'm having some problems. My OpenGL engine does not use any OpenGL functions deprecated/removed in OpenGL 3.3. I have everything built and linked ,with a little mucking around to make sure the FreeType libs ended up in the right place so MyGUI could find them.

I followed the quick start guide and adjusted it to use OpenGLPlatform, but I skipped over the input sections just so I could get it displaying first. I wrote the image loader interface, which works, but I left the save function empty for now if that makes any difference. I don't get any compilation errors or crashes. There aren't any errors in the log file. I've been through the FAQ and I'm kind of in the same situation as the last two entries, but the functions they mention don't exist for OpenGLPlatform, so they probably don't apply.

At one point I had random triangles with what looked like MyGUI's textures on them sticking out from the last mesh I drew from my engine, but I figured out they were just getting caught up in the previous shaders I had bound for my meshes and they disappeared after I unbound the shaders. I checked in gDEBugger and there are vertex buffers and textures being loaded from MyGUI code, so I'm pretty sure they're loading correctly. I know the textures are loading correctly, at least, and the vertex buffers don't look corrupted or anything. I also stepped through the code and it seemed to be drawing something, but I don't get any output on the screen from MyGUI. What am I missing?

In my WindowMgr init():

if (m_platform == NULL)
{
    m_platform = new MyGUI::OpenGLPlatform();
    m_platform->initialise(&m_imageLoader);
    m_platform->getDataManagerPtr()->addResourceLocation("./data/ui/MyGUI", false);
}
if (m_GUI == NULL && m_platform != NULL)
{
    m_GUI = new MyGUI::Gui();
    m_GUI->initialise();
}

MyGUI::ButtonPtr button = m_GUI->createWidget<MyGUI::Button>("Button", 300, 10, 300, 26, MyGUI::Align::Default, "Main", "test");
button->setCaption("Test");

In WindowMgr render():

if (m_platform != NULL)
{
    renderGlobals.shaderMgr.unbindAll();
    m_platform->getRenderManagerPtr()->drawOneFrame();
}

In WindowMgr resizeWindow():

if (m_platform != NULL)
{
    m_platform->getRenderManagerPtr()->setViewSize(_width, _height);
}

In WindowMgr close():

if (m_GUI != NULL)
{
    m_GUI->shutdown();
    delete m_GUI;
    m_GUI = NULL;
}
if (m_platform != NULL)
{
    m_platform->shutdown();
    delete m_platform;
    m_platform = NULL;
}

Upvotes: 1

Views: 1239

Answers (1)

Apostate
Apostate

Reputation: 247

Remember, kids, unbind your vertex array objects before you let MyGUI do it's thing or it messes everything up in the most horrible way: it looks like it isn't doing anything at all! I'm an idiot!

Upvotes: 2

Related Questions