[solved] win32 mingw, losing my glut teapot

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

DougS
Just popping in
Just popping in
Posts: 14
Joined: Thu Mar 03, 2011 23:45

[solved] win32 mingw, losing my glut teapot

Postby DougS » Thu Mar 10, 2011 07:03

Update: solved by re-issuing gl viewport/perspective sequence each render. Details in a post below.

Ok, I am now trying to make the glut teapot appear, as before, under CEGUI in a test program, on a different platform (Win32, mingw, opengl). I've gotten everything to compile, and now my CEGUI layout appears, but when it does, my glut teapot then disappears! (The teapot does appear for a split second, but gets immediately erased.) The CEGUI seems to work fine, gui window is movable etc - but it seems to clobber the opengl glut teapot beneath it. If I just remove the guiSystem.renderGUI(); call then the glut teapot remains. Also, and this mght be an important clue: if I resize my window, I then see the glut teapot (behind the cegui) but it then also immediately disappears. My cegui shineth forth brilliantly though.

Code: Select all

09/03/2011 22:35:20 (Std)       ********************************************************************************
09/03/2011 22:35:20 (Std)       * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM       -------- *
09/03/2011 22:35:20 (Std)       ********************************************************************************
09/03/2011 22:35:20 (Std)       ---- Version 0.7.5 (Build: Nov 19 2010 Microsoft Windows g++ 4.4.0 32 bit) ----
09/03/2011 22:35:20 (Std)       ---- Renderer module is: CEGUI::OpenGLRenderer - Official OpenGL based 2nd generation
 renderer module.  TextureTarget support is not available :(  No glBlendFuncSeparate(EXT) support. ----
09/03/2011 22:35:20 (Std)       ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module fo
r CEGUI ----
09/03/2011 22:35:20 (Std)       ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
09/03/2011 22:35:20 (Std)       ---- Scripting module is: None ----
09/03/2011 22:35:20 (Std)       ********************************************************************************
09/03/2011 22:35:20 (Std)       * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM         -------- *
09/03/2011 22:35:20 (Std)       ********************************************************************************


Here's how opengl+cegui renders (same as with linux):

Code: Select all

     
        // prepare to render, typical OpenGL things
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
        glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

        //
        // (draw your application OpenGL here, as usual)
        //
        glPushMatrix();
        glTranslatef( 0,0,-5 );
        glColor4f(1.0f,1.0f,0.0f,1.0f);
        glutSolidSphere( 1, 30,30);
        glColor4f(1.0f,0.0f,0.0f,1.0f);
        glutWireTeapot( 2.0 ); 
        glPopMatrix();

        //
        // Now, CEGUI draws on top of that...
        //
        guiSystem.renderGUI();

        // (typical OpenGL double-buffering display sequence)
        glutPostRedisplay();
        glutSwapBuffers();


I might be able to use gdb to tell me more ... But so close! Has anyone seen something like that before, I wonder?
Last edited by DougS on Sun Mar 13, 2011 03:25, edited 2 times in total.

DougS
Just popping in
Just popping in
Posts: 14
Joined: Thu Mar 03, 2011 23:45

Re: win32 mingw, losing my glut teapot

Postby DougS » Fri Mar 11, 2011 01:22

Ok, I led myself down the wrong path I believe by expecting to do this for win32 completely within glut, and without having to resort to ms windows win32 api. I'm seeing that the CEGUI Samples are dipping down into wonderful (?) world of MS-Windows to do what must be done. But so close without having to mess about much with the win32 api, so very close! That's my main problem here I think. :wink:

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: win32 mingw, losing my glut teapot

Postby Kulik » Fri Mar 11, 2011 10:00

WinAPI is indeed an abomination of software. IMO you can do this with just glut. Would you mind to elaborate on how exactly calling WinAPI functions solved this problem? I don't see any obvious mistakes in your code.

DougS
Just popping in
Just popping in
Posts: 14
Joined: Thu Mar 03, 2011 23:45

Re: win32 mingw, losing my glut teapot

Postby DougS » Sat Mar 12, 2011 05:01

Would you mind to elaborate on how exactly calling WinAPI functions solved this problem?


I haven't solved my MinGW issue just yet, but I noticed that the CEGUI Samples for Windows used the WinAPI (WinMain, WndProc etc.) rather than the (*nix -like) main(), and so don't use the glut event processing loop, and handle key and mouse events differently. I'll post the results here when I fold this into the m$-windows port of the program.

DougS
Just popping in
Just popping in
Posts: 14
Joined: Thu Mar 03, 2011 23:45

Re: win32 mingw, losing my glut teapot

Postby DougS » Sat Mar 12, 2011 07:50

Ok ... I am now getting my OpenGL application AND CEGUI mingw to draw (using g++ -mno-cygwin) - with WinAPI (WinMain/WndProc etc). :) Still have some issues to iron out, but I am optimistic they will get solved too. (Unfortunately, I have circumvented the teapot example for the time being. So, technically, this one is not strictly solved yet.)

It would be really nice to be able to ditch WinAPI completely with glut+cegui though. I still have reason to believe that's possible - I still think I am/was doing something that works in linux+glut but, nonetheless isn't quite right, and so causes problems with that Win32+freeglut+cegui teapot test program. I suspect this will sort itself as time goes on and I continue to hammer on it.

Cheers,

Doug

DougS
Just popping in
Just popping in
Posts: 14
Joined: Thu Mar 03, 2011 23:45

Re: win32 mingw, losing my glut teapot

Postby DougS » Sun Mar 13, 2011 03:22

Ok ... for some systems, it seems the view/perspective gets re-arranged, and needs to be re-set each render:

Code: Select all

        // 
        // (draw your application OpenGL here, as usual)
        // 

        // (typical OpenGL sequence for display size change)
        glViewport (0, 0, (GLsizei) _width, (GLsizei) _height);
        glMatrixMode (GL_PROJECTION);
        glLoadIdentity ();
        gluPerspective(60.0, (GLfloat) _width/(GLfloat)_height, 1.0, 50.0);
        glMatrixMode(GL_MODELVIEW);


Then the teapot draws:

Code: Select all

        glPushMatrix();
        glTranslatef( 0,0,-5 );
        glColor4f(1.0f,1.0f,0.0f,1.0f);
        glutSolidSphere( 1, 30,30);
        glColor4f(1.0f,0.0f,0.0f,1.0f);
        glutWireTeapot( 2.0 );
        glPopMatrix();
        glFlush();

        //
        // Now, CEGUI draws on top of that...
        //
        guiSystem.renderGUI();


Yay! :)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests