C++ and shaders

I’m having a hard time getting some shader running.

First, I did not find any documentation other then
which states there are already integrated shaders, supposed to be documented in the manual - but where ?

I went on to search the forums but couldn’t find any “How to enable shaders in c++” tutorial - apparently everyone just knows. So I checked the sample apps which do contain code like

self.filters = CommonFilters(base.win, base.cam)

but trying to locate that strange class “CommonFilters” turned out to be difficult as there is none - at least not with the C++ header files. I could only find a python script in /direct/filter which defined that class. Then again, that won’t do in C++ unless I use it to write my own shader - which I don’t want.

I also found the ShaderGenerator class but I’m not sure what to make of it and I don’t want to include/use code for which I don’t have any idea how it works or what it is supposed to do - making debugging a real pain.

I’m getting the feeling C++ users are supposed to write their own shaders - always. Now, I just want some simple shader so I can see edges in a pile of “marbles” which are all the same color. I really do not want to have to learn how to write shaders. Is there any tutorial/documentation/helper class/etc. which I did not see ?

Uhm, so basically, you want to use a shader without writing it? How do you imagine doing that?

There’s the shader generator that can be enabled using nodepath.set_shader_auto() which enables glow maps, gloss maps, normal maps, etc that are applied on the model, plus it enables per-pixel lighting.

That’s the portion of the manual I was referring to.

In the sample apps there’s “The Cartoon Shader Sample Program” which contains

self.filters = CommonFilters(base.win, base.cam)
filterok = self.filters.setCartoonInk(separation=self.separation)

using the code from /direct/filter/CommFilters.py - which is only available to script code, not C++ code.

So, obviously, you can’t use cartoon inking or other post-processing filters from C++ code. This will maybe change one day.

This is not related to the shader generator though, you can use that from C++.

That was what I wanted to know, thanks. You might want to add this as a little comment in the manuals though. It does give the wrong idea.