cocos2d-objc
cocos2d-objc copied to clipboard
CCShader needs to separate vsh/fsh name
I am migrating my code to v3. CCGLProgram is renamed to CCShader, but I can't see the counterpart to this:
[[CCGLProgram alloc] initWithVertexShaderFilename:@"default.vsh" fragmentShaderFilename:@"vBlur.fsh"];
There is only one constructor [CCShader shaderNamed: ""]
but it cannot specify the different names for vertex shader / fragment shader. There is [CCShader alloc] initWithVertex..Shader..
but it only accepts shader codes, which are not cached.
I kind of agree that this can be helpful, so yeah.
In the mean time, the workaround can be easily done by writing simple extension where you provide both filenames, read that files into strings and call "shader with source" initializer. Creating your own shader cache should be dead easy