"Issues with Cg Shader Compatibility in Ogre 1.12.12"

Problems building or running the engine, queries about how to use features etc.
leviskim18
Gnoblar
Posts: 10
Joined: Sat Aug 03, 2024 6:12 am

"Issues with Cg Shader Compatibility in Ogre 1.12.12"

Post by leviskim18 »

Ogre Version: :1.12.12:
Operating System: :Windows 10:
Render System: :OpenGL:

Hi Ogre,

I am currently upgrading a legacy application to Visual Studio 2019 and, due to various constraints, migrating with Ogre 1.12.12. During this process, I encountered issues loading legacy resources. Specifically, when loading files like compassObj.mesh that include Cg shaders, I am getting runtime errors. Additionally, I attempted to convert the Cg files to GLSL and tested them, but the loading still fails. Is there any way to address this problem?

  • Since it's a runtime error, the debug stack trace does not work, So I cannot determine the exact cause of the error from the source code.
  • The legacy resource was used for Ogre 1.8.2
You do not have the required permissions to view the files attached to this post.
Last edited by leviskim18 on Wed Oct 23, 2024 8:15 am, edited 1 time in total.
paroj
OGRE Team Member
OGRE Team Member
Posts: 2093
Joined: Sun Mar 30, 2014 2:51 pm
x 1129

Re: "Issues with Cg Shader Compatibility in Ogre 1.12.12"

Post by paroj »

please post the ogre.log

leviskim18
Gnoblar
Posts: 10
Joined: Sat Aug 03, 2024 6:12 am

Re: "Issues with Cg Shader Compatibility in Ogre 1.12.12"

Post by leviskim18 »

Hi @paroj ,

I attached Ogre.log. It seems nothing much interesting info. If I missed something, please let me know

paroj
OGRE Team Member
OGRE Team Member
Posts: 2093
Joined: Sun Mar 30, 2014 2:51 pm
x 1129

Re: "Issues with Cg Shader Compatibility in Ogre 1.12.12"

Post by paroj »

well it tells that Plugin_CgProgramManager is not loaded..

leviskim18
Gnoblar
Posts: 10
Joined: Sat Aug 03, 2024 6:12 am

Re: "Issues with Cg Shader Compatibility in Ogre 1.12.12"

Post by leviskim18 »

Hi @paroj

I looked through the files, but I couldn't find Plugin_CgProgramManager in Ogre 1.12.12.
Image

I have missed something in CMake setup?
Image

Would you recommend any alternative approaches to enable Cg shaders with this version? If there's a way to add or load the plugin separately, or if converting the shaders to GLSL/HLSL would be a more viable option, please let me know.

paroj
OGRE Team Member
OGRE Team Member
Posts: 2093
Joined: Sun Mar 30, 2014 2:51 pm
x 1129

Re: "Issues with Cg Shader Compatibility in Ogre 1.12.12"

Post by paroj »

you need to install the cg toolkit for the cmake option to appear:
https://developer.nvidia.com/cg-toolkit

note that Cg is the same as HLSL, so you could probably use it as is with D3D. However this will not work with OpenGL.

the recommended approach to replace Cg in Ogre is to use OgreUnifiedShader.h:
https://ogrecave.github.io/ogre/api/lat ... fiedShader

leviskim18
Gnoblar
Posts: 10
Joined: Sat Aug 03, 2024 6:12 am

Re: "Issues with Cg Shader Compatibility in Ogre 1.12.12"

Post by leviskim18 »

Hi @paroj

Thank you for your insights. Following your comments, I explored several approaches, but I'm still not achieving the expected results.

Firstly, I tried to convert the material not to use any shader and succeeded to load the mesh files. Then I expect that CompassObj.mesh should be no issue.
https://1drv.ms/u/c/09d54012508c01c4/ET ... Q?e=PFpHVQ

Secondly, I modified the material file to use Ogre-Unified shader. But it still makes an runtime error during loading.
https://1drv.ms/u/c/09d54012508c01c4/ES ... A?e=u8UBbF

Lastly, I converted the cg file to glsl files for testing whether shader is working or not with my Ogre build. But it can't be loaded.
https://1drv.ms/u/c/09d54012508c01c4/Ec ... g?e=1R6g6r

It seems that the shader might not be supported at the moment. I’ve attached the files for each case, along with the Ogre.log. If you have a moment to review them and spot any potential issues, I would greatly appreciate your insights.

Last edited by leviskim18 on Wed Oct 30, 2024 1:55 pm, edited 1 time in total.
rpgplayerrobin
Gnoll
Posts: 664
Joined: Wed Mar 18, 2009 3:03 am
x 371

Re: "Issues with Cg Shader Compatibility in Ogre 1.12.12"

Post by rpgplayerrobin »

It seems you are using the unified version of the shader, but its name is still ".cg" for some reason?

Also, in the material Compass.material it still tries to load the shaders as cg, I think you should look at another unified shader to learn how it should look in its material declaration.

leviskim18
Gnoblar
Posts: 10
Joined: Sat Aug 03, 2024 6:12 am

Re: "Issues with Cg Shader Compatibility in Ogre 1.12.12"

Post by leviskim18 »

Hi @rpgplayerrobin
The link reference was incorrect, so I’ve made corrected it. Thank you for pointing that out.

Do you have any idea on why GLSL might not be working. Despite searching through all docs, I haven’t found a clear reason why GLSL isn’t functioning as expected.

paroj
OGRE Team Member
OGRE Team Member
Posts: 2093
Joined: Sun Mar 30, 2014 2:51 pm
x 1129

Re: "Issues with Cg Shader Compatibility in Ogre 1.12.12"

Post by paroj »

taking a second look at the log it seems like you load the material files before the rendersystem is initilalised (first window created). This way shaders will generally not be loaded as without a rendersystem none a supported.