Programmable pipeline & CEGUI

edited June 2013 in Help request
Hi,

Since the introduction of programmable pipeline my CEGUI based windows are messed up. The only thing visible are the window frames and backgrounds. No buttons, text, etc. It looks a bit like CEGUI got only one pass at its rendering (but so far I'm just wild guessing).

For CEGUI rendering a dummy Scroll object is used placed above everything else:
orxBOOL CEGUIGui::CEGUIScrollObject::OnRender(
    orxRENDER_EVENT_OBJECT_PAYLOAD *_pstPayload
    )
{
    DrawGrid ();
    System::getSingleton().renderGUI();
    return false;
}

I'm running Linux with Intel GPU (GM965).
(BTW I experienced the same error as Jim in the other thread and be6b57a fixed it for me as well)

Any ideas what I should check / modify?

Anyhow I'll try to build a debug version of CEGUI and try to see what happens there ...

Cheers,
Graag

Comments

  • edited June 2013
    Hi graag, sorry that the new update broke CEGUI for you.

    Not sure what the cause could be as I have virtually no experience with CEGUI.
    If you could share your project with me, I could give it a try.
    However I'm not going to be able to use my computer starting on next Saturday, for probably 5-6 weeks at least, as I'm moving out to Canada, so the sooner the better. ;)
  • edited June 2013
    Wow that was fast O_o.

    iarwain wrote:
    Hi graag, sorry that the new update broke CEGUI for you.

    No problem. I'm glad orx is actively developed, love the orxResource module ...
    Not sure what the cause could be as I have virtually no experience with CEGUI.
    If you could share your project with me, I could give it a try.
    However I'm not going to be able to use my computer starting on next Saturday, for probably 5-6 weeks at least, as I'm moving out to Canada, so the sooner the better. ;)

    I kind of hoped for some magical "don't use OnRender it will not work now" ;). Oh well ...

    The code is actually on github: https://github.com/graag/OrxCraft

    Most up to date code is in the project-browser branch. Requires orx, Scroll, Cegui 0.7 and premake (compiles on linux other platforms were not touched for ages).

    But I guess it would be better if I could come up with a minimal example showing the problem. Should be easier to debug also for me so I'll try tonight and post the result.

    Cheers,
    Graag
  • edited June 2013
    I like minimal examples. :)

    If you can't find the time to get one, I'll probably clone your github repo in a private mercurial repo on bitbucket.org/orx.
  • edited June 2013
    So far I've not managed to pinpoint the problem. (I learned however how to draw orxTEXTURE by hand using glDrawArrays though :laugh:)

    It looks more like clipping/positioning issue. With programmable pipeline the window is draw at wrong position. It's contents seems to be there however its clipped badly ...

    I've prepared a minimal project drawing CEGUI window.
    It contains CEGUI lib compiled with GCC 4.7 on Ubuntu 11.04 32bit. I've added libs that where missing when testing on OpenSuse 12. Hope this will be enough to run it without CEGUI compilation :/.

    https://www.dropbox.com/sh/70abf6v7t52p0ab/FeGtERASh_
    (The OrxTests folder)

    Cheers,
    Graag
  • edited June 2013
    I managed to find the problematic part. Yay. B)
    glMatrixMode(GL_MODELVIEW);
              glPushMatrix();
    
              glLoadIdentity();
              glTranslatef(20, 20, 0); // Position ??
              glASSERT();
              glRotatef(45, 0.0f, 0.0f, 1.0f);
              glRotatef(0, 0.0f, 1.0f, 0.0f);
              glRotatef(0, 1.0f, 0.0f, 0.0f);
              glTranslatef(-30, -30, 0); // Pivot
    
              glGetDoublev(GL_MODELVIEW_MATRIX, matrix);
              glPopMatrix();
    
              glMatrixMode(GL_MODELVIEW);
              glLoadMatrixd(matrix);
              glASSERT();
    

    Full working example (butchered tutorial #4 in the dropbox link from previous post).

    I have no idea though why it would not work with the new pipeline.

    Cheers,
    Graag
  • edited June 2013
    Ah-ah! Nice tracking work there. :)

    So you have the exact same problem lydesik had the day after I made the change: the shader pipeline doesn't use the modelview matrix at all. It's not something new actually, if you had a custom shader on your GUI object back in the day, you would have had the same result as well. :)

    Only the fixed pipeline used both modelview and projection matrices.

    There's a very easy fix: apply your transformations on the projection matrix instead of the modelview one.
    Don't push/pop, don't load identity, simply apply your transformations.
    When you're done using it, call orxDisplay_SetVideoMode(orxNULL). That will reset all the display internals (without changing mode), including the projection matrix. :)
  • edited June 2013
    Took me a bit longer then expected but we can declare this one as SOLVED :).

    CEGUI uses those MODELVIEW matrices for all buttons, boxes etc that appear in the windows. All the projections are cached and used in other code for various calculations (I think mainly to determine what is positioned under the mouse pointer). In addition it utilises PROJECTION matrix for windows them selves (at least that's my understanding ;) ) and those are also cached. So using orxDisplay_SetVideoMode(orxNULL) did not work.

    I left the pushes and pops and load identities almost intact as they are used to calculate the matrices and store them in a cache.

    Main trick that worked for me was to store the PROJECTION matrix (glGetDoublev) before CEGUI custom calls and restore it with glLoadMatrixd afterwards. Also had to switch the glLoadMatrixd to glMultMatrixd to "simulate" how MODELVIEW matrices were supposed to work.

    The CEGUI OpenGL renderer is unfortunately not designed to be subclassed (private destructor), so I had to copy it in full. Modified version is available at github if anyone is interested: https://github.com/graag/OrxCraft (include/cegui/renderer and src/cegui/renderer).

    Cheers,
    Graag
  • edited June 2013
    Nice, I'm glad you found a solution. :)

    I guess they'll have to update CEGUI at some point as those matrix stacks (projection/modelview) have been deprecated in recent versions of OpenGL (that also include all the related operations such as push/pop/identity).

    As OpenGL ES doesn't have a compatibility mode, they've already disappeared which forced us to write our own matrix code for iOS/Android. I plan on doing a similar update on the GLFW plugin soon-ish.
Sign In or Register to comment.