A problem with sprite shaders.
I was trying to use shaders in the following way:
- I have created global GLProgram objects using GLProgram::createWithFilenames function.
- When a sprite needs a shader I create a GLProgramState with a global GLProgram object and assign it to the sprite (or use setGLProgram for existing GLProgramState objects).
The problem I encountered is that these GLProgram objects can not exists on its own. If they are not assigned to sprite they get deleted automatically and I am left with dangling pointers.
How can I preserve these GLProgram objects in a way that they would be used when needed?
Or is there another way to store shaders?