Singleton issues

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

ooohYeah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jul 08, 2009 16:15

Singleton issues

Postby ooohYeah » Wed Jul 08, 2009 16:35

Hello Eddie!
First let me congratulate you for this wonderfull GUI api that is CEGUI!

Here my issues: For some application I need to modify Rendering Modules files (GeometryBuffer, Rederer, Texture) and BaseApplication file. I use OpenGL.
But now I have this issue:

Code: Select all

Assertion failed: ms_Singleton, file xxx/singleton.h

when It try to execute this line

Code: Select all

WindowManager& winMgr = WindowManager::getSingleton();

in Demo7Sample::initialiseSample() method.
Maybe I modified/delete an instruction which create (instanciate) the Singleton but I can't see where!

In an other hand If it can help I use my own Template that might interfere with Singleton:

Code: Select all

   template <class T>
   class Managed
   {
      T* _object;
   public:

      Managed(): Managed <T>(NULL){};
   
      Managed(T* object): Managed <T>(object){this->_object = object;};
      
      Managed(const Managed<T>& managedObject): Managed<T>(managedObject){this->_object = managedObject.object; this->_object->addRef();};
         
      void operator=(const T* object){this->_object = object;}

      ~Managed(){_object->release();}

      T* operator ->(){return _object;}

      operator T*(){ return _object;}

   };


I'm using the trunk with VC++2005!

Thank you!

Regards!

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Singleton issues

Postby Jamarr » Wed Jul 08, 2009 18:48

That exception is only thrown when you are trying to access a singleton object who has 1) never been created or 2) already been destroyed. If you look in the CEGUI.log file it should show all instances of the WindowManager being created or destroyed. Since you did not post the log, it is hard to determine what is actually happening...
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

ooohYeah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jul 08, 2009 16:15

Re: Singleton issues

Postby ooohYeah » Thu Jul 09, 2009 08:09

Ok thanks!

Here CEGUI.log:

08/07/2009 17:50:52 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
08/07/2009 17:50:52 (Std) + Crazy Eddie's GUI System - Event log +
08/07/2009 17:50:52 (Std) + (http://www.cegui.org.uk/) +
08/07/2009 17:50:52 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

08/07/2009 17:50:52 (Std) CEGUI::Logger singleton created. (017FD5A8)
08/07/2009 17:50:53 (Std) ---- Begining CEGUI System initialisation ----
08/07/2009 17:50:53 (Std) CEGUI::ImagesetManager singleton created (017F7298)
08/07/2009 17:50:53 (Std) CEGUI::FontManager singleton created. (017F72F0)
08/07/2009 17:50:53 (Std) CEGUI::WindowFactoryManager singleton created
08/07/2009 17:50:53 (Std) CEGUI::WindowManager singleton created (017DC528)
08/07/2009 17:50:53 (Std) CEGUI::SchemeManager singleton created. (017FDBE0)
08/07/2009 17:50:53 (Std) CEGUI::MouseCursor singleton created. (017FECD8)
08/07/2009 17:50:53 (Std) CEGUI::GlobalEventSet singleton created. (017FE638)
08/07/2009 17:50:53 (Std) CEGUI::WidgetLookManager singleton created. (017FF160)
08/07/2009 17:50:53 (Std) CEGUI::WindowRendererManager singleton created (01800208)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'DefaultWindow' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'DefaultWindow' windows added. (01800630)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'DragContainer' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'DragContainer' windows added. (018007F0)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'ScrolledContainer' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'ScrolledContainer' windows added. (018009B0)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'ClippedContainer' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'ClippedContainer' windows added. (01800B70)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Checkbox' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Checkbox' windows added. (01800D80)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/PushButton' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/PushButton' windows added. (01800F40)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/RadioButton' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/RadioButton' windows added. (01801100)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Combobox' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Combobox' windows added. (018012C0)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/ComboDropList' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/ComboDropList' windows added. (01801480)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Editbox' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Editbox' windows added. (01801640)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/FrameWindow' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/FrameWindow' windows added. (01801870)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/ItemEntry' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/ItemEntry' windows added. (01801A30)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Listbox' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Listbox' windows added. (01801BF0)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/ListHeader' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/ListHeader' windows added. (01801DB0)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/ListHeaderSegment' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/ListHeaderSegment' windows added. (01801F70)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Menubar' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Menubar' windows added. (01802130)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/PopupMenu' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/PopupMenu' windows added. (018022F0)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/MenuItem' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/MenuItem' windows added. (018024B0)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/MultiColumnList' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/MultiColumnList' windows added. (01802670)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/MultiLineEditbox' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/MultiLineEditbox' windows added. (01802830)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/ProgressBar' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/ProgressBar' windows added. (018029B8)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/ScrollablePane' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/ScrollablePane' windows added. (01802B30)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Scrollbar' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Scrollbar' windows added. (01802CF0)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Slider' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Slider' windows added. (01803160)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Spinner' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Spinner' windows added. (01803320)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/TabButton' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/TabButton' windows added. (018034E0)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/TabControl' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/TabControl' windows added. (018036A0)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Thumb' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Thumb' windows added. (01803860)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Titlebar' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Titlebar' windows added. (01803A20)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Tooltip' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Tooltip' windows added. (01803CC8)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/ItemListbox' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/ItemListbox' windows added. (01803E88)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/GroupBox' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/GroupBox' windows added. (01804048)
08/07/2009 17:50:53 (Std) Created WindowFactory for 'CEGUI/Tree' windows.
08/07/2009 17:50:53 (Std) WindowFactory for 'CEGUI/Tree' windows added. (01804208)
08/07/2009 17:50:53 (Std) Window type alias named 'DefaultGUISheet' added for window type 'DefaultWindow'.
08/07/2009 17:50:53 (Std) CEGUI::System singleton created. (017FB530)
08/07/2009 17:50:53 (Std) ---- CEGUI System initialisation completed ----
08/07/2009 17:50:53 (Std) ---- Version 0.6.9999 (Debug) ----
08/07/2009 17:50:53 (Std) ---- Renderer module is: CEGUI::OpenGLRenderer - Official OpenGL based 2nd generation renderer module. TextureTarget support enabled via FBO extension. ----
08/07/2009 17:50:53 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
08/07/2009 17:50:53 (Std) ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
08/07/2009 17:50:53 (Std) ---- Scripting module is: None ----
08/07/2009 17:50:53 (Std) Attempting to create Imageset 'cegui_logo' using image file 'logo.png'.


You can notice that the singleton is created and not destroyed!
it stop after the creation of 'cegui_logo' imageset!

Regards!

ooohYeah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jul 08, 2009 16:15

Re: Singleton issues

Postby ooohYeah » Thu Jul 09, 2009 08:58

Oh sorry I was wrong! It does not even create CEGUI.log!
The one I wrote is an old one!

Now I don't know what to do... :(

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Singleton issues

Postby CrazyEddie » Thu Jul 09, 2009 09:09

Can you show some of the code leading up to the line where the assertion fails, please.

Since you mention VC++ 2005, I have to ask whether you have SP1 for that compiler applied? I'm not 100% sure how much of an issue that may or may not be since you're compiling the library too, but I guess there could be something going awry if you do not have SP1 of VC++ 2005 applied.

Also, is this statically linked or dynamically linked?

And additionally, ensure you're only linking one version of the libs to each config (release / debug) and that the linked libs match the config you're building.

CE.

ooohYeah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jul 08, 2009 16:15

Re: Singleton issues

Postby ooohYeah » Thu Jul 09, 2009 12:53

Hi eddie!

Jamarr was right I called singleton before it was created. I relocate the sample initialisation line ("sampleApp->initialiseSample();") so that I don't have this issue anymore.

But I have a new issue. I explain:

In my environnent "GLEW_EXT_framebuffer_object" is unkwown so I had to remove it.
So if I'm not wrong, when "initialiseTextureTargetFactory()" is executed , it goes to the "TextureTarget support is not available" section. And then I have these errors (CEGUI.log):
...
09/07/2009 14:26:54 (Error) Window::allocateRenderingWindow - Failed to create a suitable TextureTarget for use by Window 'Demo7/Window1'
09/07/2009 14:26:54 (Std) Attempting to create Imageset 'Commonwealth-10_auto_glyph_images_ ' with texture only.
09/07/2009 14:26:55 (Error) Window::allocateRenderingWindow - Failed to create a suitable TextureTarget for use by Window 'Demo7/Window2'
09/07/2009 14:26:55 (Error) Window::allocateRenderingWindow - Failed to create a suitable TextureTarget for use by Window 'Demo7/Window3'
09/07/2009 14:26:55 (Std) ---- Successfully completed loading of GUI layout from 'Demo7Windows.layout' ----


Here my modication in CEGUIOpenGLRenderer.cpp:

Code: Select all

    // prefer FBO
    if (/*GLEW_EXT_framebuffer_object*/ 0)
    {
      printf("OpenGLRenderer::initialiseTextureTargetFactory():GLEW_EXT_framebuffer_object\n");
        d_rendererID += "  TextureTarget support enabled via FBO extension.";
        d_textureTargetFactory =
            new OGLTemplateTargetFactory<OpenGLFBOTextureTarget>;
    }


Thanks!
Regards!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Singleton issues

Postby CrazyEddie » Fri Jul 10, 2009 12:15

I'm confused as to why you needed to remove the 'GLEW_EXT_framebuffer' test; I think you're saying that you got a compile error? This (obviously, I know) should not be the case, since the glew files that define the symbol accompany the CEGUI source. Or perhaps I misunderstood?

The errors in the log that refer to the TextureTargets may be considered 'soft' errors (I guess we should add a 'Warning' log level for these); the system will continue to function but with reduced features and functionality (no cached rendering, no window rotation support, and little/no effects support) - all of which rely upon being able to render to textures.

HTH

CE.

ooohYeah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jul 08, 2009 16:15

Re: Singleton issues

Postby ooohYeah » Fri Jul 10, 2009 13:17

Ok!
In fact I work in an 'environnement' that uses an 'limited glew' that not define all GLEW symbols (explain why GLEW_EXT_framebuffer is not support).

Ok so I think issue is somewhere else in my code! I will look deeper to find where/why it crach!

I also wondered if is it possible to achieved effects such as rotation with the CEGUI 6.2 version? Because there is no GeometryBuffer system and so on in this version! How to do if effects are not implements without using trunk?

Thanks CE!
Regards

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Singleton issues

Postby CrazyEddie » Sat Jul 11, 2009 07:11

Hmmm. What happens if you force it to use our local copy of glew instead? Or I guess a better question would be - does the targetted hardware have FBO support? (since if not, whether the define is there or not becomes irrelevant).

There is no rotation or other effects supported on the 0.6.x and earlier releases. These types of things are only available in the trunk currently, and as mentioned previously, they all mostly rely on some level of accelerated support for rendering to texture (so FBO or pbuffers) - to reiterate, CEGUI functions without these abilities, but basically in a kind of '0.6.x' mode, where much of the new features are not available.

BTW, if you do need help tracking down a crash that's not a logged error, and is not a CEGUI::Exception (that you should be catching), remember to post specific details including a debug mode backtrace / callstack.

CE.

ooohYeah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jul 08, 2009 16:15

Re: Singleton issues

Postby ooohYeah » Wed Jul 22, 2009 20:40

Hello Eddie! Thank you!
Sorry I had some hardware issues so that I couldn't progress with my matter. It will be fix soon (I hope).
It seems that FBO are not supported by my hardware but I will check that as soon as I will be able to.

About effects 0.6.x, even fadein/fadeout (with alpha) or "window selfmotion" are not support? Whether yes can you tell me how to implement it?

Thanks CE!
Regards!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Singleton issues

Postby CrazyEddie » Thu Jul 23, 2009 08:19

ooohYeah wrote:About effects 0.6.x, even fadein/fadeout (with alpha) or "window selfmotion" are not support? Whether yes can you tell me how to implement it?

Yes, standard alpha blending / fading is supported in the 0.6.x versions. There's no real built-in automation of that, or any other property, though coding a basic system to automate property setting should be fairly easy. Or, depending upon license compatibility, you might look at UIAE that can do that for you (viewtopic.php?f=1&t=2761).

CE

ooohYeah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jul 08, 2009 16:15

Re: Singleton issues

Postby ooohYeah » Wed Jul 29, 2009 13:40

Ok thank for this information.

Eddie, maybe you can help me about a "displaying" issue. In fact I try to port CEGUI on a "custumize" Opengl ES 2.0.
After a long war with issues I finally managed to display something: CEGUI logo. But when I try to add a background for instance (it is the most simple I think) or an other window,I have "displaying" mistakes as you can see on the screenshot.
Image
Have you got an idea?
I think it is an opengl issue but I can not see which one.
Vertex and texture coordonates seem good!

PS: Sorry but I can not show you my code.

Regards

Edit: I notice that when I change image texture size (for example size of logo.png), displaying mistakes "changes". Maybe it is link asI removed 'glew_arb_texture_non_power_of_two' test because it is not implemented in my glew.

Code: Select all

//if (!GLEW_ARB_texture_non_power_of_two)
//{
   size.d_width = getsizeNextPOT(sz.d_width);
   size.d_height = getsizeNextPOT(sz.d_height);
//}
Last edited by ooohYeah on Mon Aug 03, 2009 07:22, edited 1 time in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Singleton issues

Postby CrazyEddie » Wed Jul 29, 2009 18:30

Hmmm. What is supposed to be drawn on that screen? Obviously the background and the logo, but what of that other stuff - is that all part of the 'glitch' or is there another window being drawn? What happens if you switch the rendering to wireframe mode? Is the output geometry well formed? If it is that would suggest a texturing issue. If you're getting additional geometry then there's an issue with the vertex stream / array / whatever(!).

Oh, and the background is upside down - so that could indicate some issue with the matrices or viewport.

CE.

ooohYeah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jul 08, 2009 16:15

Re: Singleton issues

Postby ooohYeah » Thu Jul 30, 2009 08:44

No, I just want to display the logo and the background. The others stuffs are not wanted.
Here what I get when I try to draw a simple window (First Window, without background and logo moved1280):
Image

I checked vextices and textures coordonates and there are correct.
Can you show me how to switch the rendering to wireframe mode?

I think it is due to the size of the texture image because here what I get when background image is 160*160:
Image
No 'glitch'.

I will try to implement glew_arb_texture_non_power_of_two to see what I get.

Thanks CE.
Regards

Edit: I notice that when I resize the background image to a value upper than 511, I have this 'glitch'.
Really weird!
Last edited by ooohYeah on Mon Aug 03, 2009 07:24, edited 2 times in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Singleton issues

Postby CrazyEddie » Fri Jul 31, 2009 08:51

To test with the wireframe, you basically disable texturing and set the polygon mode(s) to GL_LINE.

I checked vextices and textures coordonates and there are correct.

When you say this, do you mean you checked the inputs to the rendering pipeline or the final output values? Since I think the issues are what's happening as the data goes through the rendering processes, the inputs can invariably be correct, while the final output can appear totally incorrect due to transformations and other processes done on the data.

The image with the red background is again demonstrating that the rendering is flipped vertically, so something is clearly wrong as regards to the matrices or viewport that's been set up.

That >511 size issue sounds like a possible size limit of 512 on something (texture size, or ??).

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 17 guests