当前位置: 首页>>代码示例>>C++>>正文


C++ ShaderProgram::enable方法代码示例

本文整理汇总了C++中ShaderProgram::enable方法的典型用法代码示例。如果您正苦于以下问题:C++ ShaderProgram::enable方法的具体用法?C++ ShaderProgram::enable怎么用?C++ ShaderProgram::enable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShaderProgram的用法示例。


在下文中一共展示了ShaderProgram::enable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: enable

	void PhongShader::enable( unsigned char lightMask, bool useTexture )
	{
		// Computes the identifier of the shader
		unsigned int identifier = computeIdentifier(lightMask, useTexture);
		// Retrieves the shader
		auto it=m_precompiledShaders.find(identifier) ;
		if(it!=m_precompiledShaders.end()) 
		{ 
			it->second->enable() ; 
			return ;
		}
		// The shader has not been compiled... Let's go!
		ShaderProgram * program = compileShaderProgram(lightMask, useTexture );
		m_precompiledShaders[identifier] = program ;
		program->enable() ;
	}
开发者ID:Groufou,项目名称:SIA-Animation,代码行数:16,代码来源:PhongShader.cpp

示例2: render

    void AtomRenderableManager::render(Ambrosia::RenderPass renderPass)
    {
//              qDebug() << "AtomRenderableManager::render";
        if (!validBuffers)
            rebuildBuffers();

        switch (renderPass) {
        case Ambrosia::SHADOW_MAP_PASS:
        case Ambrosia::STENCIL_PASS:
        case Ambrosia::DRAW_OUTLINE_PASS:
            // set shaders
            if (specularShader) specularShader->disable();
            break;
        case Ambrosia::DEPTH_SHADE_PASS:
        case Ambrosia::DEPTH_TRANSPARENT_PASS:
        case Ambrosia::DRAW_SHADE_PASS:
        case Ambrosia::DRAW_TRANSPARENT_PASS:
        case Ambrosia::DRAW_PASS:
        case Ambrosia::NAME_PASS:
            // set shaders
            if (specularShader) specularShader->enable();
            break;
        default:
            break;
        }

        if (renderPass == Ambrosia::DRAW_OUTLINE_PASS || renderPass == Ambrosia::STENCIL_PASS || renderPass == Ambrosia::SHADOW_MAP_PASS) {
            map< Utopia::Node *, AtomRenderable * >::iterator atom_iter = renderables.begin();
            map< Utopia::Node *, AtomRenderable * >::iterator atom_end = renderables.end();
            for(; atom_iter != atom_end; ++atom_iter) {
                AtomRenderable * atom = atom_iter->second;
                if (atom->hasTag(Ambrosia::OUTLINE))
                    atom->render(renderPass);
            }
        } else if (renderPass == Ambrosia::NAME_PASS) {
            map< Utopia::Node *, AtomRenderable * >::iterator atom_iter = renderables.begin();
            map< Utopia::Node *, AtomRenderable * >::iterator atom_end = renderables.end();
            for(; atom_iter != atom_end; ++atom_iter) {
                AtomRenderable * atom = atom_iter->second;
                if (atom->hasTag(Ambrosia::SOLID) || atom->hasTag(Ambrosia::OUTLINE))
                    atom->render(renderPass);
            }
        } else {
            map< unsigned int, map< unsigned int, map< unsigned int, BufferManager * > > >::iterator format_iter = bufferManagers.begin();
            map< unsigned int, map< unsigned int, map< unsigned int, BufferManager * > > >::iterator format_end = bufferManagers.end();
            for (; format_iter != format_end; ++format_iter) {
                map< unsigned int, map< unsigned int, BufferManager * > >::iterator tag_iter = format_iter->second.begin();
                map< unsigned int, map< unsigned int, BufferManager * > >::iterator tag_end = format_iter->second.end();
                for (; tag_iter != tag_end; ++tag_iter) {
                    if ((renderPass == Ambrosia::SHADOW_MAP_PASS || renderPass == Ambrosia::DRAW_PASS)
                        && (tag_iter->first != Ambrosia::SOLID) && (tag_iter->first != Ambrosia::OUTLINE))
                        continue;
                    if ((renderPass == Ambrosia::STENCIL_PASS || renderPass == Ambrosia::DRAW_OUTLINE_PASS || renderPass == Ambrosia::NAME_PASS)
                        && (tag_iter->first != Ambrosia::SOLID && tag_iter->first != Ambrosia::SHADE) && (tag_iter->first != Ambrosia::OUTLINE))
                        continue;
                    if ((renderPass == Ambrosia::DEPTH_SHADE_PASS || renderPass == Ambrosia::DRAW_SHADE_PASS)
                        && (tag_iter->first != Ambrosia::SHADE) && (tag_iter->first != Ambrosia::OUTLINE))
                        continue;
                    if ((renderPass == Ambrosia::DEPTH_TRANSPARENT_PASS || renderPass == Ambrosia::DRAW_TRANSPARENT_PASS)
                        && (tag_iter->first != Ambrosia::Am_TRANSPARENT) && (tag_iter->first != Ambrosia::OUTLINE))
                        continue;
                    map< unsigned int, BufferManager * >::iterator mode_iter = tag_iter->second.begin();
                    map< unsigned int, BufferManager * >::iterator mode_end = tag_iter->second.end();
                    for (; mode_iter != mode_end; ++mode_iter) {
                        unsigned int mode = mode_iter->first;
                        BufferManager * bufferManager = mode_iter->second;
                        bufferManager->render(mode);
                    }
                }
            }
        }

        // disable shaders
        if (specularShader) specularShader->disable();
    }
开发者ID:project-renard-survey,项目名称:utopia-documents-mirror,代码行数:75,代码来源:atom_basic.cpp


注:本文中的ShaderProgram::enable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。