1

I'm not sure why, but I am changing the Shader(CCGLProgram) on my sprite multiple times. I want to be able to use a previous Shader I allocated and used on the sprite, however doing so turns my entire sprite black (with no errors).

The only way I have found around this is by re-creating my programs and using the newly created ones instead. However, this is not ideal and I rather find a solution using the original program if possible.

AwDogsGo2Heaven
  • 952
  • 11
  • 26
  • You're not sure why you're changing the shader of your sprite? What do you mean by "recreating my programs"? Have you verified that the shader is working correctly (ie no errors)? – CodeSmile Jan 02 '13 at 09:11
  • Yes, I have two shaders. I attach the first one, and later remove the first one and attach the second one. This works, everything looks as it should, but when I attach the first one again later my screen goes black. However, if I allocate a new CCGL program (with the same vertex and fragment shaders as the first one) and attach that one, everything works. – AwDogsGo2Heaven Jan 02 '13 at 13:40

1 Answers1

0

Are you referring to u_mvpMatrix in one of your vertex shaders? Depending on the version of Cocos2d you're using you may need to change this to CC_MVPMatrix

abitofcode
  • 3,048
  • 1
  • 16
  • 11