Shader error

Problems building or running the engine, queries about how to use features etc.
Post Reply
71puccini
Gnoblar
Posts: 14
Joined: Sun Jun 07, 2020 5:14 pm

Shader error

Post by 71puccini »

Ogre Version: :1.12.8:
Operating System: :Windows 10:
Render System: :Any:
I am trying to use the following simple cg shader and keep getting this error:

Warning: material MyMaterial has no supportable Techniques and will be blank. Explanation:
Pass 0: vertex program MyVertexShader5 cannot be used - not supported.

Code: Select all

vertex_program MyVertexShader1 cg
 {
	source MyShaders.cg  
	entry_point MyVertexShader1   
	profiles vs_1_1 arbvp1                   
 

	default_params                    
	{        
		param_named_auto worldViewMatrix worldviewproj_matrix        
	}
}
			
fragment_program MyFragmentShader1 cg  
{
	source MyShaders.cg    
	entry_point MyFragmentShader1   
	profiles ps_1_1  arbfp1
}
			
		

material MyMaterial
{
    technique
    {
        pass
        {	
	    vertex_program_ref MyVertexShader1    
            {
            }

            fragment_program_ref MyFragmentShader1    
            {
            }
        }
    }
}
This is MyShaders.cg

Code: Select all

void MyVertexShader1(
        float4 position        : POSITION,      
        out float4 oPosition    : POSITION,      
        uniform float4x4 worldViewMatrix)
{
    oPosition = mul(worldViewMatrix, position);
}
 
void MyFragmentShader1(out float4 color : COLOR)
 
{
    color = float4(0,0,1,0);
}

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 105
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 28

Re: Shader error

Post by sercero »

Are you loading the CG plugin?

Please post the entire log.

71puccini
Gnoblar
Posts: 14
Joined: Sun Jun 07, 2020 5:14 pm

Re: Shader error

Post by 71puccini »

No I am not. That's the problem. Thanks for pointing that out. But the reason I am not loading the library, because I don't have the CgProgramManager.dll. So I tried to build it, It gives me

Creating library C:/.../build/lib/Debug/Plugin_CgProgramManager_d.lib and object C:/.../build/lib/Debug/Plugin_CgProgramManager_d.exp
2>OgreCgFxScriptLoader.obj : error LNK2019: unresolved external symbol cgCreateContext referenced in function "public: __cdecl Ogre::CgFxScriptLoader::CgFxScriptLoader(void)" (??0CgFxScriptLoader@Ogre@@QEAA@XZ)

thanks!

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 105
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 28

Re: Shader error

Post by sercero »

Do you have CG installed?

I had no problems compiling OGRE with CG support (with MinGW64).

Check if CMake is finding CG in the proper place.

71puccini
Gnoblar
Posts: 14
Joined: Sun Jun 07, 2020 5:14 pm

Re: Shader error

Post by 71puccini »

CMake finds it ok. I download my cg from https://developer.nvidia.com/cg-toolkit-download
I used visual studio 2019 to build the dll! I suspect that the cg-toolkit only supports 32 bit for Windows...that's why It's failing to build the dll....

did you use the same url?

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 105
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 28

Re: Shader error

Post by sercero »

No, there is a 64-bit version and I am using that one. It works fine.

Reading my CMake notes I have found this:

Code: Select all

## CG
# For CG I had to to modify the detected paths so they point to the 64-bit version of the libraries.
-DCg_BINARY_DBG:FILEPATH="D:/OGRE/Cg/bin.x64/cg.dll" 
-DCg_BINARY_REL:FILEPATH="D:/OGRE/Cg/bin.x64/cg.dll" 
-DCg_LIBRARY_DBG:FILEPATH="D:/OGRE/Cg/lib.x64/cg.lib" 
-DCg_LIBRARY_REL:FILEPATH="D:/OGRE/Cg/lib.x64/cg.lib" 

71puccini
Gnoblar
Posts: 14
Joined: Sun Jun 07, 2020 5:14 pm

Re: Shader error

Post by 71puccini »

I pointed to 64 bit and were able to build the plugin. I am still getting this error...(attached in the log)

My program works fine with glsl version! Do see anything wrong with the syntax?

this is the material

Code: Select all

vertex_program MyVertexShader1 cg
 {
	source MyShaders.cg  
	entry_point MyVertexShader1   
	profiles vs_1_1 arbvp1                   
 

	default_params                    
	{        
		param_named_auto worldViewMatrix worldviewproj_matrix        
	}
}
			
fragment_program MyFragmentShader1 cg  
{
	source MyShaders.cg    
	entry_point MyFragmentShader1   
	profiles ps_1_1  arbfp1
}

	 

material MyMaterial13cg
{
    technique
    {
        pass
        {   
            vertex_program_ref MyVertexShader1   
            {
            }

            fragment_program_ref MyFragmentShader1
            {
            }
        }
    }
}
MyShaders.cg

Code: Select all

void MyVertexShader1(
        float4 position        : POSITION,      
        out float4 oPosition    : POSITION,      
        uniform float4x4 worldViewMatrix)
{
    oPosition = mul(worldViewMatrix, position);
}
 
void MyFragmentShader1(out float4 color : COLOR)
 
{
    color = float4(0,0,1,0);
}
Attachments
ogre.log
(63.64 KiB) Downloaded 3 times

paroj
OGRE Team Member
OGRE Team Member
Posts: 1226
Joined: Sun Mar 30, 2014 2:51 pm
x 493
Contact:

Re: Shader error

Post by paroj »

gl3+ does not support arbfp1

71puccini
Gnoblar
Posts: 14
Joined: Sun Jun 07, 2020 5:14 pm

Re: Shader error

Post by 71puccini »

Yup. I changed to old GL, and it's working.

Thanks for your help!

Post Reply