MyGUI not rendering with RTSS in GLES 2

jdxjohn

18-09-2012 18:27:07

Cross-posted from here. I had MyGUI working nicely on iOS with GLES1. I changed to GLES2 and got RTSS running but it is never called about any MyGUI materials and nothing is rendered except the empty viewport.

Is there something special about MyGUI, I don't see any .material files for instance. Please help, I'm SO close to having my Ogre app running seamlessly on Windows, Mac and iOS!

Altren

20-09-2012 11:31:16

I'd forgotten MyGUI uses overlays or something like that, fundamentally different to the rest of Ogre.MyGUI doesn't use overlays. It use vertex buffers.

So you won't get any materials from MyGUI, because it doesn't use materials as well.

You should set proper render target for GUI. I guess MyGUI rendering into default viewport, while you want it to render into texture.

Altren

20-09-2012 11:32:36

Read last two questions there: http://www.ogre3d.org/tikiwiki/tiki-ind ... =MyGUI+FAQ

jdxjohn

20-09-2012 11:40:30

Sorry I meant it uses same ideas as overlays. It was not a viewport issue because everything was working fine until I switched to GLES2.

I have it working now using those shaders posted, and modifying the MyGUI.OgrePlatform MyGUI::OgreRenderManager class. I could post a patch if you or anyone else is interested but I'm still not sure this is the best solution, manually loading shader programs?

Altren

20-09-2012 13:52:18

If you need to apply shader program to geometry from MyGUI, then yes, you need to modify MyGUI::OgreRenderManager. And this solutions is correct.

I think that your patch might be useful to others.

jdxjohn

20-09-2012 14:52:40

I'll try to get it when I'm on the Mac next :)

So in terms of Ogre, the problem is with Vertex Buffers being too tightly coupled with FFP then - it was not considered FFP would disappear? Or maybe it's not a 'problem', but to me it feels like one :) The fact Ogre doesn't even throw errors when you set FFP parameters and FFP sin't supported...

jdxjohn

24-09-2012 09:25:00

These are the changes I made to get MyGUI 3.2 working against GLES 2 on iOS. I'm not sure if it should be considered the right fix though?

Index: Platforms/Ogre/OgrePlatform/include/MyGUI_OgreRenderManager.h
===================================================================
--- Platforms/Ogre/OgrePlatform/include/MyGUI_OgreRenderManager.h (revision 4429)
+++ Platforms/Ogre/OgrePlatform/include/MyGUI_OgreRenderManager.h (working copy)
@@ -131,6 +131,9 @@
bool mIsInitialise;
bool mManualRender;
size_t mCountBatch;
+
+ Ogre::HighLevelGpuProgramPtr mVertProg;
+ Ogre::HighLevelGpuProgramPtr mFragProg;
};

} // namespace MyGUI
Index: Platforms/Ogre/OgrePlatform/src/MyGUI_OgreRenderManager.cpp
===================================================================
--- Platforms/Ogre/OgrePlatform/src/MyGUI_OgreRenderManager.cpp (revision 4429)
+++ Platforms/Ogre/OgrePlatform/src/MyGUI_OgreRenderManager.cpp (working copy)
@@ -33,7 +33,8 @@
mRenderSystem(nullptr),
mIsInitialise(false),
mManualRender(false),
- mCountBatch(0)
+ mCountBatch(0),
+ mVertProg(0), mFragProg(0)
{
}

@@ -111,6 +112,23 @@
mVertexFormat = VertexColourType::ColourABGR;

updateRenderInfo();
+
+ if(!mRenderSystem->getFixedPipelineEnabled())
+ {
+ mVertProg = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram("MyGUI_VP",
+ Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
+ "glsles",
+ Ogre::GPT_VERTEX_PROGRAM);
+ mVertProg->setSourceFile( "MyGUI_VP.glsles" );
+ mVertProg->load();
+
+ mFragProg = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram("MyGUI_FP",
+ Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
+ "glsles",
+ Ogre::GPT_FRAGMENT_PROGRAM);
+ mFragProg->setSourceFile( "MyGUI_FP.glsles" );
+ mFragProg->load();
+ }
}
}

@@ -317,8 +335,18 @@
mRenderSystem->_setCullingMode(Ogre::CULL_NONE);
mRenderSystem->_setFog(Ogre::FOG_NONE);
mRenderSystem->_setColourBufferWriteEnabled(true, true, true, true);
- mRenderSystem->unbindGpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);
- mRenderSystem->unbindGpuProgram(Ogre::GPT_VERTEX_PROGRAM);
+
+ if(mRenderSystem->getFixedPipelineEnabled())
+ {
+ mRenderSystem->unbindGpuProgram(Ogre::GPT_FRAGMENT_PROGRAM);
+ mRenderSystem->unbindGpuProgram(Ogre::GPT_VERTEX_PROGRAM);
+ }
+ else
+ {
+ mRenderSystem->bindGpuProgram( mVertProg->_getBindingDelegate() );
+ mRenderSystem->bindGpuProgram( mFragProg->_getBindingDelegate() );
+ }
+
mRenderSystem->setShadingType(Ogre::SO_GOURAUD);

// initialise texture settings

petrocket

26-08-2013 03:12:56

This is great to see someone has this working! The only thing is, what are the contents for the glsles files in your fix? MYGUI_VP.glsles and MYGUI_FP.glsles?

I'm going to try a simple one texture shader here in a sec, but would love to see what you used thanks!

petrocket

26-08-2013 03:23:35

I used what was posted here http://www.ogre3d.org/addonforums/viewtopic.php?f=17&t=29605 And got it working, this should really be added to MyGUI Ogre Platform, though it would help to add OIS touch support too!