Cg shader does not reload in OpenGL renderer

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
saejox
Goblin
Posts: 260
Joined: Tue Oct 25, 2011 1:07 am
x 36

Cg shader does not reload in OpenGL renderer

Post by saejox »

Hi,

I'm trying to reload a cg shader in OpenGL renderer. It doesn't work. No error or warning, just doesn't update. I traced it through load functions all thing seems normal, loads new shader as expected but never updates.
It reloads and shows new shader perfectly fine in DirectX9 renderer.

Anybody know anything about this?
A bug or a limitation?

I'm testing on Win7.
Using latest 1.9 trunk

Thank you.
Nimet - Advanced Ogre3D Mesh/dotScene Viewer
asPEEK - Remote Angelscript debugger with html interface
ogreHTML - HTML5 user interfaces in Ogre
User avatar
saejox
Goblin
Posts: 260
Joined: Tue Oct 25, 2011 1:07 am
x 36

Re: Cg shader does not reload in OpenGL renderer

Post by saejox »

Same wrong behavior persist in GLSL shaders.
I'm beginning to think OpenGL renderer never was able to reload shaders in the first place.

Anybody manage to reload shaders in OpenGL renderer?
Nimet - Advanced Ogre3D Mesh/dotScene Viewer
asPEEK - Remote Angelscript debugger with html interface
ogreHTML - HTML5 user interfaces in Ogre
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Cg shader does not reload in OpenGL renderer

Post by masterfalcon »

How are you going about reloading it?
User avatar
saejox
Goblin
Posts: 260
Joined: Tue Oct 25, 2011 1:07 am
x 36

Re: Cg shader does not reload in OpenGL renderer

Post by saejox »

Code: Select all

Ogre::HighLevelGpuProgramPtr shader = static_cast<HighLevelGpuProgramPtr>(Ogre::HighLevelGpuProgramManager::getSingleton().getByName("FP"));
shader->reload();
Shaders contains no compile errors. It works fine in all rendererers and languages.
For the simplicty sake shaders do not have any a parameters.
GLSL shader:

Code: Select all

void main(void)
{
	gl_FragColor =  vec4(1.0, 1.0, 0.0, 1.0);    
}
After reload i observe this behaviors:
- DirectX renderer with HLSL: Shader reloaded correctly
- DirectX renderer with CG: Shader reloaded correctly
- OpenGL renderer with GLSL: Entity completely loses it's material and reverts to BaseWhite
- OpenGL renderer with CG: Entity stays as it is. Does not fall back to BaseWhite, but doesn't update neither.

I have also tried this routine: remove shader from pass => reload shader => reassign shader to pass
Same behaviors as above.
Nimet - Advanced Ogre3D Mesh/dotScene Viewer
asPEEK - Remote Angelscript debugger with html interface
ogreHTML - HTML5 user interfaces in Ogre
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: Cg shader does not reload in OpenGL renderer

Post by masterfalcon »

Just on a cursory look I would guess because GLSLGpuProgram::loadImpl is empty. And you're probably right that it never worked.
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: Cg shader does not reload in OpenGL renderer

Post by scrawl »

I have never got this to work either. There's several threads about it. The best way is to just remove the resource and make a new one.
Post Reply