Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shaderProgram in cocos2d 3.0 doesn't work

I have just started with Cocos2d 3.0 after using 1.1 for a long time. I wanted to test the shaders out and looked up some tutorials. All tutorials seems to use the CCSprite property "shaderProgram". When I try it like this:

renderTexture.sprite.shaderProgram = [[CCGLProgram alloc] initWithVertexShaderByteArray:ccPositionTextureA8Color_vert fragmentShaderByteArray:ccPositionTextureColorAlphaTest_frag]

Xcode gives me an error saying: "Property 'shaderProgram' not found on object type CCSprite *"

Is this property removed or changed from version 2.0 to 3.0 and how would I go about using it in Cocos2d 3.0?

Thanks!

like image 453
cjce Avatar asked Feb 05 '14 20:02

cjce


1 Answers

Adding this import:

#import "CCNode_Private.h"

allows you to access CCNode's shaderProgram memberc

like image 85
angel_navarro Avatar answered Jan 01 '23 11:01

angel_navarro