码迷,mamicode.com
首页 > 其他好文 > 详细

cocos2dx 3.13 etc1 ClippingNode Bug 修正

时间:2016-09-23 12:37:37      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:

void TrianglesCommand::useMaterial() const
{
    
    if(_stencl){
        
        /*******[solyess] etc1 mask的支持*****************/
        //Set texture
        //GL::bindTexture2D(_textureID);
        
        if (_alphaTextureID > 0)
        { // ANDROID ETC1 ALPHA supports.
            GL::bindTexture2D(_alphaTextureID);
        }
        else{
            GL::bindTexture2D(_textureID);
        }
        //set blend mode
        GL::blendFunc(_blendType.src, _blendType.dst);
        
        _glProgramState->apply(_mv);
        /*******[solyess]end etc1 mask的支持*****************/
    }else{
        //Set texture
        GL::bindTexture2D(_textureID);
        
        if (_alphaTextureID > 0)
        { // ANDROID ETC1 ALPHA supports.
            GL::bindTexture2DN(1, _alphaTextureID);
        }
        //set blend mode
        GL::blendFunc(_blendType.src, _blendType.dst);
        
        _glProgramState->apply(_mv);
    }
}

 

GLProgramState* GLProgramState::getOrCreateWithGLProgramName(const std::string& glProgramName, Texture2D* texture)
{
    /*******[solyess] etc1 mask的支持*****************/
    if (texture != nullptr && texture->getAlphaTextureName() != 0 && texture->getisStencl() == false) {
        if (glProgramName == GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR) {
            return GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_ETC1AS_POSITION_TEXTURE_COLOR);
        }
        else if (glProgramName == GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR_NO_MVP) {
            return GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_ETC1AS_POSITION_TEXTURE_COLOR_NO_MVP);
        }
        else if (glProgramName == GLProgram::SHADER_NAME_POSITION_GRAYSCALE) {
            return GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_ETC1AS_POSITION_TEXTURE_GRAY_NO_MVP);
        }
    }

    return GLProgramState::getOrCreateWithGLProgramName(glProgramName);
}

 

cocos2dx 3.13 etc1 ClippingNode Bug 修正

标签:

原文地址:http://www.cnblogs.com/czjone/p/5899141.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!