RTShaderSystem initialize before RenderSystem::_createRenderWindow

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
longer
Kobold
Posts: 37
Joined: Tue Aug 19, 2014 10:46 am
x 5

RTShaderSystem initialize before RenderSystem::_createRenderWindow

Post by longer »

When i initialize RTShaderSystem before RenderSystem::_createRenderWindow.
The ShaderGenerator constructor throw exception call

Code: Select all

    if (hmgr.isLanguageSupported("glsles"))
    {
        mShaderLanguage = "glsles";
    }
    else if (hmgr.isLanguageSupported("cg"))
    {
        mShaderLanguage = "cg";
    }
    else if (hmgr.isLanguageSupported("glsl"))
    {
        mShaderLanguage = "glsl";
    }
    else if (hmgr.isLanguageSupported("hlsl"))
    {
        mShaderLanguage = "hlsl";
    }
    else
    {
        OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR, 
            "ShaderGenerator creation error: None of the profiles is supported.", 
            "ShaderGenerator::ShaderGenerator" );
    }
I find that at impl for RenderSystem.

Code: Select all

RenderSystem::initialiseFromRenderSystemCapabilities(RenderSystemCapabilities* caps, RenderTarget* primary);
such as

Code: Select all

    void GLES2RenderSystem::initialiseFromRenderSystemCapabilities(RenderSystemCapabilities* caps, RenderTarget* primary)
    {
        if(caps->getRenderSystemName() != getName())
        {
            OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
                        "Trying to initialize GLES2RenderSystem from RenderSystemCapabilities that do not support OpenGL ES",
                        "GLES2RenderSystem::initialiseFromRenderSystemCapabilities");
        }

        mGpuProgramManager = OGRE_NEW GLES2GpuProgramManager();

        mGLSLESProgramFactory = OGRE_NEW GLSLESProgramFactory();
        HighLevelGpuProgramManager::getSingleton().addFactory(mGLSLESProgramFactory);
The HighLevelGpuProgramManager will addFactory.

It's can be call at RenderSystem::_initialise(bool autoCreateWindow, const String& windowTitle);
or ignore the RTShaderSystem initialize HighLevelGpuProgramManager checking at constructor?
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: RTShaderSystem initialize before RenderSystem::_createRenderWindow

Post by paroj »

what is the issue with initializing it after RenderSystem::_createRenderWindow?
longer
Kobold
Posts: 37
Joined: Tue Aug 19, 2014 10:46 am
x 5

Re: RTShaderSystem initialize before RenderSystem::_createRenderWindow

Post by longer »

1.At android,the when SurfaceView be create,the real Surface(ANativeWindow) must at callback surfaceCreated(SurfaceHolder holder) create.
It's mean we must init the RTShaderSystem at here but not the clarity time i eazy control.
2.When i not _createRenderWindow.I can not init the CEGUI::System because the CEGUI::System constructor create a default CEGUI::GUIContext(I not need this),and the CEGUI::GUIContext the CEGUI::MouseCursor ... i find the HardwareBufferManager::getSingletonPtr() is null.meas that the

Code: Select all

    void GLES2RenderSystem::initialiseFromRenderSystemCapabilities(RenderSystemCapabilities* caps, RenderTarget* primary)
        mHardwareBufferManager = OGRE_NEW GLES2HardwareBufferManager();
not be call.
3.and other Manager like GpuProgramManager is not impl.We can not initialise resource contain program.

I find ignore HighLevelGpuProgramManager check at RTShaderSystem initialize can not working,because the 3 reason.

I'm planning a plugin for local system like android(java) ios(oc) for a Multi-window surface 3d rendering(the local system language hard stand by 3d rendering view).but not single window.So the init process:
1.init special config.
2.init ogre manual.
3.init ogre render system.
4.init cegui.
5.create surface (such as at local language).
6.the ogre scene manager.

The reason is one ogre(Singleton) one cegui(Singleton) and Multi-window(Ogre::RenderWindow and CEGUI::GUIContext).
There must be a main window is a good solution.but just try it.
The RenderWindow it's not necessary at ogre system init i think(my experience).
Post Reply