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

Fixed an issue where the shader would come off when run setTexture.

Open HirokiIshimori opened this issue 5 years ago • 6 comments

Summary

Fix issue https://github.com/cocos2d/cocos2d-x/issues/20600 , When I set a shader in Sprite and execute setTexture, the shader comes off.

Event

  1. After doing setProgramState as below ...
sprite->setProgramState(programState);
  1. Try calling setTexture.
sprite->setTexture(filePath);

Then the shader will not run.

Why I submitted a Pull Request.

Currently, it can be dealt with by calling setProgramState immediately after calling setTexture as shown below.

sprite->setTexture(filePath);
sprite->setProgramState(mProgramState);

But developers need to explicitly keep ProgramState, and I think it's a redundant implementation. So I submitted a Pull Request.

HirokiIshimori avatar Oct 22 '20 20:10 HirokiIshimori