CEGUI# Mogre Renderer

nataz

25-07-2007 09:33:51

Hi all,

someone requestet that I port the Gui Demo from the C++ code to C# code. First thing i noticed was, that the Cegui wrapper for Mogre was completely broken, so i decided to look into CEGUI# and see if we can use that for Mogre. It turns out that they have got good renderer Support and also have a Renderer for Axiom up, so there should be a way to get Mogre working aswell.
At work we use SharpDevelop so i dont go and dive into this too deep now but it turns out that the Axiom Renderer can be used really well. The only problem i came up with was this function:

global::Axiom.Media.Image image = global::Axiom.Media.Image.FromRawStream(
buffer, bufferWidth, bufferHeight, global::Axiom.Media.PixelFormat.A8R8G8B8
);

where buffer = System.IO.Stream and i have no clue how to Convert it to statisfy Mogre`s Mogre.DataStreamPtr. Any one a clue?

nataz

25-07-2007 10:13:17

Never mind, sorted it out...


public override void LoadFromMemory( System.IO.Stream buffer, int bufferWidth, int bufferHeight ) {
global::Mogre.ManagedDataStream mdstr = new global::Mogre.ManagedDataStream(buffer);
global::Mogre.DataStreamPtr stream = new global::Mogre.DataStreamPtr(mdstr);
global::Mogre.Image img = new global::Mogre.Image();
img.LoadRawData(stream, (uint)bufferWidth, (uint)bufferHeight, global::Mogre.PixelFormat.PF_A8R8G8B8);


string uniqueName = string.Format("CEGUI_texture_{0}", Guid.NewGuid());

texture = global::Mogre.TextureManager.Singleton.LoadImageW(uniqueName, global::Mogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, img);

this.width = bufferWidth;
this.height = bufferHeight;
}

Vectrex

25-07-2007 10:55:06

I know its early but RBGUI looks to be THE future gui for ogre. Maybe its time to put CEGUI to sleep? ;)

nataz

25-07-2007 11:08:47

I totally agree with you! In fact i hate this bloated monster of CeGui, but many people want to use it and the only thing i saw round here was complaining about the broken interface, so i took the chance to contribute something and build a renderer for CEGUI#.
Of cause RBGui is the Future, i think that aswell. But i`m not familar enough with MOGRE yet, nor am i familar with writing Wrappers, so i will write a working CeGui renderer first and after that i will go for RBGui. Its a learning process ;).

But i think writing a wrapper for RBGui will be mor fun because CeGui is just... mhm.. bad coding and has some dirty pitfalls.

bleubleu

26-07-2007 03:12:57

CEGUI + Mogre = Mess

wingnet

29-07-2007 13:53:55

I am the one who requested the porting of CEGUI.
thanks nataz, u r really quick.

nataz

29-07-2007 14:57:19

actually not that quick, but thanks. I am having problems with VS lately, and i dont want to fix it right now, because i order my new laptop this week, so i have to install all that shit there again then.
Will work on it, as soon the laptop arrives ;)