Shader problem

After i compiled panda3d on my linux x64 machine, i realized that i couldn’t run shadow sample because of shader support:

I searched the forum and i’ve found that i should comment out getSupportsBasicShaders() lines to run sample and it works.
But in shadow advanced sample i’ve got some errors on console:

So i’ve installed nvidiacg and recompiled panda3d and now everything seems good. But there is some questions i have to ask:
1- Does panda3d only use nvidia cg shader? i guess no, then how can i switch it to GLSL?
2- If i want to distribute my game that uses shadow and other shader stuff, do i have to include nvidia cg installer into my game package for running on the target machine?


The autoshader (a.k.a shader generator … _Generator ) uses Cg shaders, so for that the Nvidia Cg toolkit is a must have.

  1. Panda3D also supports GLSL, but as far as I know ( and I might be wrong) Nvidia cards do use the cg toolkit for compiling GLSL shaders as well (ati/amd, intel and whatnot depend on the graphic driver to do the compiling).
    To use GLSL shaders you just need to load a GLSL shader like this:
node.setShader(Shader.load(Shader.SLGLSL, "shaders/vertex.glsl","shaders/fragment.glsl"), 1) 

or like this (if you have your vertex shader as a string called ‘vertex_shader’ and a fragment shader in a string called ‘fragment_shader’)

node.setShader(Shader.make(Shader.SLGLSL, vertex_shader, fragment_shader))
  1. If you are using the packing tools that ship with panda (packp3d and pdeploy) then I think these tools take care of packing all you need to run the game (…maybe except drivers).