[Ogre 2.1] Porting CEGUI to OGRE 2.1

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
User avatar
Jayray
Greenskin
Posts: 115
Joined: Sun Sep 09, 2012 5:29 pm
Location: Strasbourg, France

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Jayray » Tue Apr 28, 2015 8:04 pm

N0vember wrote:Are you comparing HBU_STATIC and HBU_DYNAMIC here, or the default and HBU_DYNAMIC ?
From the source :

Code: Select all

TU_DEFAULT = TU_AUTOMIPMAP | TU_STATIC_WRITE_ONLY
So the default is not only set to HBU_STATIC, but also to HBU_WRITE_ONLY
You are right, I had not paid attention to that. I was indeed comparing TU_DEFAULT and TU_DYNAMIC.
But I have just tried with TU_STATIC (without the write only flag), and the issue is the same: the textures are empty.

Dark_sylinc, your post makes me think that setting the HBU_DYNAMIC flag for a GUI engine would not be a very good idea, as most of the textures are static images or GUI elements that do not vary often.
However, I will try to discuss this on the CEGUI forum to know their opinion on that subject.

Anyway, there might be a bug in the D3D11 renderer when the HBU_STATIC flag is set.
I will try to push the debugging further when I get some time.

Thanks to both of you for your help! :)
0 x

User avatar
Jayray
Greenskin
Posts: 115
Joined: Sun Sep 09, 2012 5:29 pm
Location: Strasbourg, France

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Jayray » Thu Apr 30, 2015 1:10 pm

According to a member of the CEGUI team, the textures are never changed after resource setup.
So this means that the TU_DEFAULT flag should be kept and it should work with the D3D11 render system.

If I do not manage to find the cause of the issue, I will try to make a sample project to reproduce the bug.
0 x

User avatar
Jayray
Greenskin
Posts: 115
Joined: Sun Sep 09, 2012 5:29 pm
Location: Strasbourg, France

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Jayray » Sun May 03, 2015 12:43 pm

I think I have found the issue in the D3D11 render system \o/

The issue seems to come from the following statement:

Code: Select all

mDevice.GetImmediateContext()->UpdateSubresource( 
                        mParentTexture->GetTex2D(), 
                        D3D11CalcSubresource(static_cast<UINT>(mSubresourceIndex), mFace, mParentTexture->getNumMipmaps()+1),
                        &dstBoxDx11,
                        converted.data,
                        rowWidth,
                        0 );
The values contained in dstBoxDx11 seemed suspicious to me (width and height = 1), so I have tried replacing it by NULL as it is an optional parameter, and... it fixes my issue \o/

But what would be the correct way to fix it? Setting the correct values in dstBoxDx11, or leaving it to NULL as NULL copies the entire resource without offset according to the D3D11 API documentation?

Thanks!
0 x

N0vember
Gremlin
Posts: 196
Joined: Tue Jan 27, 2009 12:27 am

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by N0vember » Sun May 03, 2015 1:25 pm

Then you should probably find the source of the problem where width and height was set to 1 ?
But setting it to NULL would be a dirty hack (the whole point of having a destination box becomes moot)
0 x

User avatar
Jayray
Greenskin
Posts: 115
Joined: Sun Sep 09, 2012 5:29 pm
Location: Strasbourg, France

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Jayray » Sun May 03, 2015 2:39 pm

You are right, I think I am approaching from the root cause of the issue: in the D3D11Texture class, the surfaces seem to be not updated, so the width and height coming from the surface is wrong.

In CEGUI, it seems that the texture is first created with a 1x1 size, then the following instructions are called later:

Code: Select all

    d_texture->freeInternalResources();
    d_texture->setWidth(buffer_size.d_width);
    d_texture->setHeight(buffer_size.d_height);
    d_texture->setDepth(1);
    d_texture->createInternalResources();
    d_texture->getBuffer(0,0).get()->blitFromMemory(*pixelBox);
The createInternalResources() function calls the _createSurfaceList() function, but this function does nothing as the number of surfaces has not changed, so the size of the surface is not updated.

IMHO, the surfaces list should be cleared in the D3D11Texture::freeInternalResourcesImpl() function.
By doing this, everything seems to work the way it should.

I will create a PR for this fix and see if this is okay or not :)
0 x

User avatar
Jayray
Greenskin
Posts: 115
Joined: Sun Sep 09, 2012 5:29 pm
Location: Strasbourg, France

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Jayray » Sun May 03, 2015 5:28 pm

0 x

N0vember
Gremlin
Posts: 196
Joined: Tue Jan 27, 2009 12:27 am

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by N0vember » Sun May 03, 2015 6:10 pm

Bien vu ;)
0 x

User avatar
Jayray
Greenskin
Posts: 115
Joined: Sun Sep 09, 2012 5:29 pm
Location: Strasbourg, France

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Jayray » Wed May 06, 2015 8:33 pm

The pull request on the CEGUI side has been merged as well (https://bitbucket.org/cegui/cegui/pull- ... tible/diff), so the 0.8 branch of CEGUI should now be fully compatible with Ogre 2.1 :)
The only thing that is not supported yet in the CEGUI Ogre renderer is the gamma correction for textures.

Also, the changes to make CEGUI compatible with Ogre 2.1 should be reported in the default branch in CEGUI.

I have put both tasks on my To-do list, but I have absolutely no ETA :roll:
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 3985
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 184
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by dark_sylinc » Wed May 06, 2015 8:53 pm

Wow, congrats! Good job!
0 x

rassweiler
Gnoblar
Posts: 13
Joined: Mon Aug 04, 2014 10:28 pm
Location: Ottawa

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by rassweiler » Sat Jul 16, 2016 8:22 pm

I hate to revive this thread, are there any samples of CEGUI with Ogre2.1. I'm having trouble getting the ui to render and I believe I haven't setup my hlms scripts properly.

I've gotten MyGui to work by adding the

Code: Select all

pass custom MYGUI {}
line to my compositor file but I would like to try out CEGUI.

Thanks for any advice,

KR
0 x
Win 10 x64 Pro
vs2013 Community
x64 Build debug and release
GTX 680
Maximus VI Hero
i7-4790k @ 4GHz
32GB @ 1333 Patriot

yaron_ct
Gnoblar
Posts: 24
Joined: Tue Jan 06, 2015 10:32 pm

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by yaron_ct » Mon Jul 18, 2016 2:58 am

@rassweiler: You might find interest in this.

I currently work to make the cegui sample framework work with Ogre 2.0/2.1.
0 x
CEGUI team member.

rassweiler
Gnoblar
Posts: 13
Joined: Mon Aug 04, 2014 10:28 pm
Location: Ottawa

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by rassweiler » Sun Jul 24, 2016 9:45 am

yaron_ct wrote:@rassweiler: You might find interest in this.

I currently work to make the cegui sample framework work with Ogre 2.0/2.1.
Thank you so much! I didn't realise I had to start the rendering.
0 x
Win 10 x64 Pro
vs2013 Community
x64 Build debug and release
GTX 680
Maximus VI Hero
i7-4790k @ 4GHz
32GB @ 1333 Patriot

User avatar
Kohedlo
Orc
Posts: 435
Joined: Fri Nov 27, 2009 3:34 pm
Location: Ukraine, Sumy
x 11
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Kohedlo » Sun Apr 30, 2017 9:00 pm

Hi gyus. There time update to the pso OGRE, ind cegui have errors if not porting. there is not supported methods:

Code: Select all

//@@@@@@@@@@@@@@@@@@@@@@@@	d_pimpl->d_renderSystem->_setHlmsBlendblock(d_pimpl->d_hlmsBlendblock);

//@@@@@@@@@@@@@@@@@@@@@@@@ d_pimpl->d_renderSystem->_setHlmsMacroblock(d_pimpl->d_hlmsMacroblock);

     
void OgreRenderer::bindShaders()
{
    if (isUsingShaders())
    {
#ifdef CEGUI_USE_OGRE_HLMS
        Ogre::HlmsCache hlmsCache;
		hlmsCache.vertexShader = d_pimpl->d_vertexShader;
        hlmsCache.pixelShader = d_pimpl->d_pixelShader;
//@@@@@@@@@@@@@@@@@@@   d_pimpl->d_renderSystem->__setProgramsFromHlms(&hlmsCache);
#else
        if (Ogre::GpuProgram* prog = d_pimpl->d_vertexShader->_getBindingDelegate())
            d_pimpl->d_renderSystem->bindGpuProgram(prog);

        if (Ogre::GpuProgram* prog = d_pimpl->d_pixelShader->_getBindingDelegate())
            d_pimpl->d_renderSystem->bindGpuProgram(prog);
#endif
    }
    else
    {
  //@@@@@@@@@@@@@@@@@@@@@@     d_pimpl->d_renderSystem->unbindGpuProgram(Ogre::GPT_VERTEX_PROGRAM);
  //@@@@@@@@@@@@@@@@@@     d_pimpl->d_renderSystem->unbindGpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);
    }
}
i think porting this available:

Code: Select all

Ogre::HlmsCache hlmsCache;
		hlmsCache.vertexShader = d_pimpl->d_vertexShader;
        hlmsCache.pixelShader = d_pimpl->d_pixelShader;
to

Code: Select all

Ogre::HlmsCache hlmsCache;
		hlmsCache.pso.vertexShader = d_pimpl->d_vertexShader;
        hlmsCache.pso.pixelShader = d_pimpl->d_pixelShader;
but still all //@@@@@@@@@@ parts for porting.
0 x
c++ game developer.
current project: Imperial Game Engine 2.5
Image

User avatar
Kohedlo
Orc
Posts: 435
Joined: Fri Nov 27, 2009 3:34 pm
Location: Ukraine, Sumy
x 11
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Kohedlo » Fri May 05, 2017 7:26 am

THERE is way to port:


Code: Select all

void OgreRenderer::setupRenderingBlendMode(const BlendMode mode,
                                           const bool force)
{
    using namespace Ogre;

    // do nothing if mode appears current (and is not forced)
    if ((d_pimpl->d_activeBlendMode == mode) && !force)
        return;

    d_pimpl->d_activeBlendMode = mode;

#ifdef CEGUI_USE_OGRE_HLMS
    // Apply the HLMS blend block to the render system
    
	
//@@@@@@@@@@@@@@@@@@@@@@@@	
	
	
	//d_pimpl->d_renderSystem->_setHlmsMacroblock(const_cast<Ogre::HlmsBlendblock*>(d_pimpl->d_hlmsBlendblock));



#else
    if (d_pimpl->d_activeBlendMode == BM_RTT_PREMULTIPLIED)
        d_pimpl->d_renderSystem->_setSceneBlending(SBF_ONE,
                                                    SBF_ONE_MINUS_SOURCE_ALPHA);
    else
        d_pimpl->d_renderSystem->
            _setSeparateSceneBlending(SBF_SOURCE_ALPHA,
                                      SBF_ONE_MINUS_SOURCE_ALPHA,
                                      SBF_ONE_MINUS_DEST_ALPHA,
                                      SBF_ONE);
#endif
}

Code: Select all

void OgreRenderer::initialiseRenderStateSettings()
{
    using namespace Ogre;

    // initialise render settings
#ifdef CEGUI_USE_OGRE_HLMS
    // Apply the HLMS macro block to the render system
//@@@@@@@@@@@@@@@@@@@@@@@@ d_pimpl->d_renderSystem->_setHlmsMacroblock(d_pimpl->d_hlmsMacroblock);
	//d_pimpl->d_renderSystem->_hlmsMacroblockCreated(const_cast<Ogre::HlmsMacroblock*>(d_pimpl->d_hlmsMacroblock));

Code: Select all

void OgreRenderer::bindShaders()
{
    if (isUsingShaders())
    {
#ifdef CEGUI_USE_OGRE_HLMS

        Ogre::HlmsCache hlmsCache;
		hlmsCache.pso.vertexShader = d_pimpl->d_vertexShader;
        hlmsCache.pso.pixelShader = d_pimpl->d_pixelShader;
		hlmsCache.pso.blendblock = const_cast<Ogre::HlmsBlendblock*>(d_pimpl->d_hlmsBlendblock);
        hlmsCache.pso.macroblock = const_cast<Ogre::HlmsMacroblock*>(d_pimpl->d_hlmsMacroblock);
d_pimpl->d_renderSystem->_hlmsPipelineStateObjectCreated(&hlmsCache.pso);
		d_pimpl->d_renderSystem->_setPipelineStateObject(&hlmsCache.pso);
   //@@@@@@@@@@@@@@@@@@@@@@@@@@ _setProgramsFromHlms(
#else
        if (Ogre::GpuProgram* prog = d_pimpl->d_vertexShader->_getBindingDelegate())
            d_pimpl->d_renderSystem->bindGpuProgram(prog);

        if (Ogre::GpuProgram* prog = d_pimpl->d_pixelShader->_getBindingDelegate())
            d_pimpl->d_renderSystem->bindGpuProgram(prog);
#endif
    }
    else
    {
    //  d_pimpl->d_renderSystem->unbindGpuProgram(Ogre::GPT_VERTEX_PROGRAM);
  //@@@@@@@@@@@@@@@@@@  
	
d_pimpl->d_renderSystem->_setPipelineStateObject( 0 );
		//d_pimpl->d_renderSystem->unbindGpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);
    }
}
0 x
c++ game developer.
current project: Imperial Game Engine 2.5
Image

User avatar
Kohedlo
Orc
Posts: 435
Joined: Fri Nov 27, 2009 3:34 pm
Location: Ukraine, Sumy
x 11
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Kohedlo » Fri May 05, 2017 8:20 am

porting working fine! (only OpenGL3Plus) :(
Last edited by Kohedlo on Fri Oct 20, 2017 12:14 am, edited 1 time in total.
0 x
c++ game developer.
current project: Imperial Game Engine 2.5
Image

User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 1
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by mmixLinus » Fri May 05, 2017 9:41 pm

Ok, good! And you are using the exact changes you show above?
0 x
Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 3985
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 184
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by dark_sylinc » Fri May 05, 2017 11:42 pm

The code posted is calling _hlmsPipelineStateObjectCreated but never seems to call _hlmsPipelineStateObjectDestroyed, thus causing memory leaks.

Additionally, creating PSOs every frame may be performance-suboptimal, so it should not be done every frame; but it's better than nothing, I guess.
0 x

_hack
Gnoblar
Posts: 1
Joined: Sun May 07, 2017 4:12 am

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by _hack » Sun May 07, 2017 5:20 am

Thanks a lot @Kohedlo ! I was looking for that fix for a while...
I gave it a try with CEGUI 0.8.7, it works for me. I worked on the code a bit to address @dark_sylinc comments, but since my experience with Ogre/CEGUI on the renderer level is rather limited any suggestions are very welcome.
After looking at the code for a while, using the PsoCacheHelper could probably simplify it, I will take a peak at that later, when I have some time.

Here is what I came up with (patch for CEGUI on pastebin: https://pastebin.com/BB7CmUtw)

Code: Select all

// cegui/src/RendererModules/Ogre/GeometryBuffer.cpp

  // ... at line 99 replaced
-    rop.operationType = RenderOperation::OT_TRIANGLE_LIST;
+    rop.operationType = OT_TRIANGLE_LIST;

Code: Select all

// cegui/src/RendererModules/Ogre/Renderer.cpp

// added new attribute to store HlmsCache at line 311
    //! Hlms cache used to store pso        
    Ogre::SharedPtr<Ogre::HlmsCache> d_hlmsCache;


void OgreRenderer::initialiseShaders()
{
  // ... (end of method) added 
#ifdef CEGUI_USE_OGRE_HLMS
    d_pimpl->d_hlmsCache = Ogre::SharedPtr<Ogre::HlmsCache>(new Ogre::HlmsCache);
    d_pimpl->d_hlmsCache->pso.vertexShader = d_pimpl->d_vertexShader;
    d_pimpl->d_hlmsCache->pso.pixelShader = d_pimpl->d_pixelShader;
    d_pimpl->d_hlmsCache->pso.blendblock = const_cast<Ogre::HlmsBlendblock*>(d_pimpl->d_hlmsBlendblock);
    d_pimpl->d_hlmsCache->pso.macroblock = const_cast<Ogre::HlmsMacroblock*>(d_pimpl->d_hlmsMacroblock);
#endif
}

void OgreRenderer::cleanupShaders()
{
  // (begin of method) added
    if (d_pimpl->d_hlmsCache != NULL) {
        d_pimpl->d_renderSystem->_hlmsPipelineStateObjectDestroyed(&d_pimpl->d_hlmsCache->pso);
        d_pimpl->d_hlmsCache.setNull();
    }
}

// Removed CEGUI_USE_OGRE_HLMS #ifdef branch
void OgreRenderer::setupRenderingBlendMode(const BlendMode mode,
                                           const bool force)
{
    using namespace Ogre;

    // do nothing if mode appears current (and is not forced)
    if ((d_pimpl->d_activeBlendMode == mode) && !force)
        return;

    d_pimpl->d_activeBlendMode = mode;

#ifndef CEGUI_USE_OGRE_HLMS
    if (d_pimpl->d_activeBlendMode == BM_RTT_PREMULTIPLIED)
        d_pimpl->d_renderSystem->_setSceneBlending(SBF_ONE,
                                                    SBF_ONE_MINUS_SOURCE_ALPHA);
    else
        d_pimpl->d_renderSystem->
            _setSeparateSceneBlending(SBF_SOURCE_ALPHA,
                                      SBF_ONE_MINUS_SOURCE_ALPHA,
                                      SBF_ONE_MINUS_DEST_ALPHA,
                                      SBF_ONE);
#endif
}

// Removed CEGUI_USE_OGRE_HLMS #ifdef branch
void OgreRenderer::initialiseRenderStateSettings()
{
    using namespace Ogre;

    // initialise render settings
#ifndef CEGUI_USE_OGRE_HLMS
    d_pimpl->d_renderSystem->setLightingEnabled(false);
    d_pimpl->d_renderSystem->_setDepthBufferParams(false, false);
    d_pimpl->d_renderSystem->_setDepthBias(0, 0);
    d_pimpl->d_renderSystem->_setCullingMode(CULL_NONE);
    d_pimpl->d_renderSystem->_setFog(FOG_NONE);
    d_pimpl->d_renderSystem->_setColourBufferWriteEnabled(true, true, true, true);
    d_pimpl->d_renderSystem->setShadingType(SO_GOURAUD);
    d_pimpl->d_renderSystem->_setPolygonMode(PM_SOLID);
#endif

    bindShaders();

    // set alpha blending to known state
    setupRenderingBlendMode(BM_NORMAL, true);
}

// some code moved to initialiseShaders()
void OgreRenderer::bindShaders()
{
    if (isUsingShaders())
    {
#ifdef CEGUI_USE_OGRE_HLMS
        d_pimpl->d_renderSystem->_hlmsPipelineStateObjectCreated(&d_pimpl->d_hlmsCache->pso);
        d_pimpl->d_renderSystem->_setPipelineStateObject(&d_pimpl->d_hlmsCache->pso);
#else
        if (Ogre::GpuProgram* prog = d_pimpl->d_vertexShader->_getBindingDelegate())
            d_pimpl->d_renderSystem->bindGpuProgram(prog);

        if (Ogre::GpuProgram* prog = d_pimpl->d_pixelShader->_getBindingDelegate())
            d_pimpl->d_renderSystem->bindGpuProgram(prog);
#endif
    }
    else
    {
#ifdef CEGUI_USE_OGRE_HLMS
        d_pimpl->d_renderSystem->_setPipelineStateObject( 0 );
#else
        d_pimpl->d_renderSystem->unbindGpuProgram(Ogre::GPT_VERTEX_PROGRAM);
        d_pimpl->d_renderSystem->unbindGpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);
#endif
    }
}

0 x

User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 1
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by mmixLinus » Wed May 10, 2017 11:30 am

Thanks, _hack & Kohedlo, let us know when you're done updating with the PsoCacheHelper! :) A working CEGUI would be very useful!
0 x
Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook

User avatar
Kohedlo
Orc
Posts: 435
Joined: Fri Nov 27, 2009 3:34 pm
Location: Ukraine, Sumy
x 11
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Kohedlo » Mon Sep 11, 2017 5:46 am

is shader generator on DirectX 11 renderer give errors:

Code: Select all

  OGRE_EXCEPT( Exception::ERR_RENDERINGAPI_ERROR,
                         "The shader requires more input attributes/semantics than what the "
                         "VertexArrayObject / v1::VertexDeclaration has to offer. You're "
                         "missing a component", "D3D11HLSLProgram::getLayoutForPso" );

according HLSL code from dx11 shader generation. OpenGL variant works fine!
0 x
c++ game developer.
current project: Imperial Game Engine 2.5
Image

User avatar
Kohedlo
Orc
Posts: 435
Joined: Fri Nov 27, 2009 3:34 pm
Location: Ukraine, Sumy
x 11
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Kohedlo » Mon Sep 11, 2017 3:41 pm

this issue is actual, because CEGUI not ported properly for DirectX 11 renderer with PSO update :oops:
0 x
c++ game developer.
current project: Imperial Game Engine 2.5
Image

User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 1
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by mmixLinus » Sun Oct 01, 2017 3:41 pm

Any progress or solutions to this?

I've tried to interface both latest CEGUI default branch, and latest v0-8 (0.8.7) branch, with Ogre 2.1 latest, and after some tweaks to CEGUIOgreRenderer I hit this same brick wall in both cases.

More ideas?
0 x
Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook

User avatar
Kohedlo
Orc
Posts: 435
Joined: Fri Nov 27, 2009 3:34 pm
Location: Ukraine, Sumy
x 11
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Kohedlo » Sun Oct 01, 2017 8:46 pm

cegui works fine on pso Ogre opengl.

i add in todo list. need fix shader, that go in cegui cpp file as text. is not adapted to dx12 pso.
Last edited by Kohedlo on Thu Oct 19, 2017 7:43 pm, edited 1 time in total.
0 x
c++ game developer.
current project: Imperial Game Engine 2.5
Image

123iamking
Gremlin
Posts: 152
Joined: Sat Aug 12, 2017 4:16 pm
x 3

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by 123iamking » Mon Oct 16, 2017 8:51 am

I) Can't setup Ogre render for CEGUI SDK
I'm just starting to look at CEGui recently. and I follow this guide to setup CeGUI with Ogre 2.1 renderer, and I hit 2 problems:

1st, Even when I set the environment variables for OIS_HOME, OGRE_HOME, OGRE_SDK. CMake can't find:

Code: Select all

OGRE_RenderSystem_Direct3D11_INCLUDE_DIR,..., OGRE_RenderSystem_GL_LIBRARY_REL. 
Maybe the folder structure in the script findOgre of CeGUI is pretty outdated (it's outdated for OIS, but I can fix for OIS because OIS is pretty small).
2nd, When I build CeGUI (I just ignore the missing path above), I got 15 errors:

Code: Select all

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2660	'CEGUI::OgreRenderer::create': function does not take 0 arguments	CEGUISampleFramework-0.8	E:\Source\cegui\samples_framework\src\CEGuiOgreBaseApplication.cpp	90	
Error	C2660	'Ogre::ResourceGroupManager::initialiseAllResourceGroups': function does not take 0 arguments	CEGUISampleFramework-0.8	E:\Source\cegui\samples_framework\src\CEGuiOgreBaseApplication.cpp	141	
Error	C2661	'Ogre::Root::createSceneManager': no overloaded function takes 2 arguments	CEGUISampleFramework-0.8	E:\Source\cegui\samples_framework\src\CEGuiOgreBaseApplication.cpp	76	
Error	C2664	'Ogre::Viewport *Ogre::RenderTarget::addViewport(float,float,float,float)': cannot convert argument 1 from 'Ogre::Camera *' to 'float'	CEGUISampleFramework-0.8	E:\Source\cegui\samples_framework\src\CEGuiOgreBaseApplication.cpp	84	
Error	C2039	'OT_TRIANGLE_LIST': is not a member of 'Ogre::v1::RenderOperation'	CEGUIOgreRenderer-0	E:\Source\cegui\cegui\src\RendererModules\Ogre\GeometryBuffer.cpp	99	
Error	C2039	'pixelShader': is not a member of 'Ogre::HlmsCache'	CEGUIOgreRenderer-0	E:\Source\cegui\cegui\src\RendererModules\Ogre\Renderer.cpp	1106	
Error	C2530	'renderer': references must be initialized	CEGUISampleFramework-0.8	E:\Source\cegui\samples_framework\src\CEGuiOgreBaseApplication.cpp	90	
Error	C2039	'setBackgroundColour': is not a member of 'Ogre::Viewport'	CEGUISampleFramework-0.8	E:\Source\cegui\samples_framework\src\CEGuiOgreBaseApplication.cpp	85	
Error	C2039	'unbindGpuProgram': is not a member of 'Ogre::RenderSystem'	CEGUIOgreRenderer-0	E:\Source\cegui\cegui\src\RendererModules\Ogre\Renderer.cpp	1118	
Error	C2039	'unbindGpuProgram': is not a member of 'Ogre::RenderSystem'	CEGUIOgreRenderer-0	E:\Source\cegui\cegui\src\RendererModules\Ogre\Renderer.cpp	1119	
Error	C2039	'vertexShader': is not a member of 'Ogre::HlmsCache'	CEGUIOgreRenderer-0	E:\Source\cegui\cegui\src\RendererModules\Ogre\Renderer.cpp	1105	
Error	C2039	'_setHlmsBlendblock': is not a member of 'Ogre::RenderSystem'	CEGUIOgreRenderer-0	E:\Source\cegui\cegui\src\RendererModules\Ogre\Renderer.cpp	1034	
Error	C2039	'_setHlmsMacroblock': is not a member of 'Ogre::RenderSystem'	CEGUIOgreRenderer-0	E:\Source\cegui\cegui\src\RendererModules\Ogre\Renderer.cpp	1074	
Error	C2039	'_setProgramsFromHlms': is not a member of 'Ogre::RenderSystem'	CEGUIOgreRenderer-0	E:\Source\cegui\cegui\src\RendererModules\Ogre\Renderer.cpp	1107	
Error (active)		class "Ogre::v1::RenderOperation" has no member "OT_TRIANGLE_LIST"	CEGUIOgreRenderer-0	e:\Source\cegui\cegui\src\RendererModules\Ogre\GeometryBuffer.cpp	99	
So if I'm not mistaken, CeGUI is still need to tweak a bit to work with Ogre renderer. It's not work out-of-the-box, is it?

II) Use CeGUI in Ogre project
I just want to do I) because I want to know how to use CeGUI with Ogre project, if I successfully use CeGUI in Ogre project, I can live without I)
Anyway, I can setup the default CeGUI (without Ogre renderer) and realize that: to basically use CeGUI, I just need the lib file: CEGUIBase-0.lib. If I'm not mistaken, all I need is just include this lib into my project (also some h files of CeGUI) then I can use CeGUI with Ogre. I have already made a project, which reference to this lib file, but I don't know how to show the GUI on the Ogre Window (which is created by SDL_CreateWindow())
According to this article, there are only 3 step to do this:
Crazy Eddie wrote: Create an instance of a CEGUI::Renderer based object.
Create the CEGUI::System object (passing in the renderer created above).
Each frame, call the CEGUI::System::renderAllGUIContexts function to perform the rendering.
But I don't know how to do it.

To sum up, here is my goal:
I have Ogre empty project

Code: Select all

Samples/2.0/Tutorials/EmptyProject
and CeGUI Hello World

Code: Select all

cegui/samples/HelloWorld
Goal: show CeGUI Hello World on Ogre empty project's window

Thanks for reading :)
0 x

User avatar
Kohedlo
Orc
Posts: 435
Joined: Fri Nov 27, 2009 3:34 pm
Location: Ukraine, Sumy
x 11
Contact:

Re: [Ogre 2.1] Porting CEGUI to OGRE 2.1

Post by Kohedlo » Tue Oct 17, 2017 4:38 am

I use free Visual Express 2008.
0 x
c++ game developer.
current project: Imperial Game Engine 2.5
Image

Post Reply