cocos2d-objc icon indicating copy to clipboard operation
cocos2d-objc copied to clipboard

CCShader needs to separate vsh/fsh name

Open elbaro opened this issue 8 years ago • 1 comments

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.

elbaro avatar Jul 16 '16 08:07 elbaro

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

s1ddok avatar Jul 16 '16 10:07 s1ddok