cocos2d-x
cocos2d-x copied to clipboard
Fixed an issue where the shader would come off when run setTexture.
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
- After doing
setProgramStateas below ...
sprite->setProgramState(programState);
- 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.