本文整理汇总了C++中ShaderProgram::disable方法的典型用法代码示例。如果您正苦于以下问题:C++ ShaderProgram::disable方法的具体用法?C++ ShaderProgram::disable怎么用?C++ ShaderProgram::disable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderProgram
的用法示例。
在下文中一共展示了ShaderProgram::disable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void render(const Planet& planet, Camera& camera, ShaderProgram& program)
{
static glm::mat4 mvp;
program.use();
/*
* shaders have various attributes for vertices
* these functions will enable attributes for each vertex
* if attributes are not enabled, they can't be accessed by the pipeline
*/
glEnableVertexAttribArray(0);
/*
* this sets target buffer to current active buffer!
* buffers store vertices
*/
glBindBuffer(GL_ARRAY_BUFFER, planet.model->vbo_geometry);
//premultiply the matrix for this example
camera.project(planet.position, mvp);
//upload the matrix to the shader
glUniformMatrix4fv(0, 1, GL_FALSE, glm::value_ptr(mvp));
/*
* these calls state how to interpret data inside the buffer
*/
//set pointers into the vbo for each of the attributes(position and color)
//position, texture, color, normal
glVertexAttribPointer( 0, //location of attribute
3, //number of elements
GL_FLOAT, //type
GL_FALSE, //normalized?
sizeof(Vertex), //stride
(void*)offsetof(Vertex,position)); //offset
glDrawArrays(GL_TRIANGLES, 0, planet.model->triangles); //mode, starting index, count
//broken
//model.mesh->render(program);
//unload buffer
glBindBuffer(GL_ARRAY_BUFFER, 0);
//disable shader program attributes
glDisableVertexAttribArray(0);
//unload shader program
program.disable();
}
示例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();
}