Insuffient memory at the second CEGUI call

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

abel.bernabeu
Just popping in
Just popping in
Posts: 3
Joined: Tue Jan 09, 2007 11:20

Insuffient memory at the second CEGUI call

Postby abel.bernabeu » Tue Jan 09, 2007 13:11

I have problems with CEGUI for Windows.

I have downloaded the sources of 0.5 stable version. I have compiled them and linked against the DirectX 9 SDK of December 2006.

Now I am sucessful compiling and linking with my "hello world" program for OpenGl, but when I execute the first two CEGUI calls I get a problem of insufficient memory:

Code: Select all


   CEGUI::OpenGLRenderer *cegui_renderer = new CEGUI::OpenGLRenderer(0);
   CEGUI::System *sys = new CEGUI::System(cegui_renderer);    // Fails


Any ideas?

The complete program is the following:

Code: Select all

#include <Windows.h>
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <CEGUI.h>
#include <RendererModules/OpenGLGUIRenderer/openglrenderer.h>

void display ()
{
   // clear framebuffer
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   // draw teapot
   glFrontFace(GL_CW);
   glutSolidTeapot(2.5);
   glFrontFace(GL_CCW);

   // swap front and back buffers
   glutSwapBuffers();
}

void reshape (int width, int height)
{
   glViewport(0, 0, width, height);
}

void mouse (int button, int state, int x, int y)
{
}

void motion (int x, int y)
{
}

void main()
{
    int argc = 1;
    char* argv = "SampleApp";
   glutInit(&argc, &argv);
    glutInitDisplayMode(GLUT_DEPTH|GLUT_DOUBLE|GLUT_RGBA);
    glutInitWindowSize(800, 600);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("Crazy Eddie's GUI Mk-2 - Sample Application");
    glutSetCursor(GLUT_CURSOR_NONE);

   CEGUI::OpenGLRenderer *cegui_renderer;
   cegui_renderer = new CEGUI::OpenGLRenderer(0);
   CEGUI::System *sys = new CEGUI::System(cegui_renderer);    // The memory allocation fails

   // register callback functions
   glutDisplayFunc(display);
   glutReshapeFunc(reshape);
   glutMouseFunc(mouse);
   glutMotionFunc(motion);

   // hand over event processing to GLUT
   glutMainLoop();
}

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Tue Jan 09, 2007 13:37

Does CEGUI write something in the log file ?

abel.bernabeu
Just popping in
Just popping in
Posts: 3
Joined: Tue Jan 09, 2007 11:20

Postby abel.bernabeu » Tue Jan 09, 2007 14:23

Pompei2 wrote:Does CEGUI write something in the log file ?


No, the CEGUI.log file does not even get created.

In order to activate the logging I should be able to execute the call:

CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);

But prior to that call, I'm not even able to create the CGUI::System object due to the mentioned premature memory fault (not enough memory).

User avatar
Das Gurke
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Sat Sep 02, 2006 15:45

Postby Das Gurke » Tue Jan 09, 2007 16:31

Never worked with OpenGL and CEGUI, but what about passing some arguments to the renderer constructor?

Edit:
Sorry, that was bullshit :oops:

abel.bernabeu
Just popping in
Just popping in
Posts: 3
Joined: Tue Jan 09, 2007 11:20

Postby abel.bernabeu » Tue Jan 09, 2007 17:55

Never worked with OpenGL and CEGUI, but what about passing some arguments to the renderer constructor?


The default values are right and there is no need no specify your own ones.

But, you know? I've discovered the problem by myself after more than tree days wasted :(

My linking options were not coherent because I was mixing the use of debug dlls with release libraries.

In instance the executable not running due to a memory fault imports the following libraries according to TDUMP output:

Imports from OpenGLGUIRenderer_d.dll
Imports from freeglut.dll
Imports from OPENGL32.dll
Imports from CEGUIBase.dll
Imports from MSVCR80.dll
Imports from KERNEL32.dll

Notice that I was mixing OpenGLGUIRenderer_d.dll (the debug version) with freeglut.dll and CEGUIBase.dll (release versions).

After some time wasted debugging the CEGUI code I tried another thing: starting a new clean project based on a .prj supplied with the standar SDK. I saw that worked, and then by dumping the final executable I can understand why it works:

Imports from CEGUIBase_d.dll
Imports from OpenGLGUIRenderer_d.dll
Imports from freeglut_d.dll
Imports from OPENGL32.dll
Imports from MSVCR80D.dll
Imports from KERNEL32.dll

The executable running properly uses the _d postfixed dlls.

Moral: Be coherent in the use of debug or release libraries. Do not mix them O:)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 25 guests