本文整理汇总了C++中GLSLProgram::bindSubRoutineToUniform方法的典型用法代码示例。如果您正苦于以下问题:C++ GLSLProgram::bindSubRoutineToUniform方法的具体用法?C++ GLSLProgram::bindSubRoutineToUniform怎么用?C++ GLSLProgram::bindSubRoutineToUniform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLSLProgram
的用法示例。
在下文中一共展示了GLSLProgram::bindSubRoutineToUniform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateGLSL
//.........这里部分代码省略.........
glPROGRAMUNIFORMV(bSp, 1f, prog, t.uniformLocation, m_arraySz, pData->fvals);
CHECKGLERRORS("Uniform::TFloat");
break;
case Uniform::TInt:
glPROGRAMUNIFORMV(bSp, 1i, prog, t.uniformLocation, m_arraySz, pData->ivals);
CHECKGLERRORS("Uniform::TInt");
break;
case Uniform::TInt2:
glPROGRAMUNIFORMV(bSp, 2i, prog, t.uniformLocation, m_arraySz, pData->ivals);
CHECKGLERRORS("Uniform::TInt2");
break;
case Uniform::TInt3:
glPROGRAMUNIFORMV(bSp, 3i, prog, t.uniformLocation, m_arraySz, pData->ivals);
CHECKGLERRORS("Uniform::TInt3");
break;
case Uniform::TInt4:
glPROGRAMUNIFORMV(bSp, 4i, prog, t.uniformLocation, m_arraySz, pData->ivals);
CHECKGLERRORS("Uniform::TInt4");
break;
//case Uniform::TUInt:
//case Uniform::TBool:
case Uniform::TVec2:
glPROGRAMUNIFORMV(bSp, 2f, prog, t.uniformLocation, m_arraySz, pData->fvals);
CHECKGLERRORS("Uniform::TVec2");
break;
case Uniform::TVec3:
glPROGRAMUNIFORMV(bSp, 3f, prog, t.uniformLocation, m_arraySz, pData->fvals);
CHECKGLERRORS("Uniform::TVec3");
break;
case Uniform::TVec4:
glPROGRAMUNIFORMV(bSp, 4f, prog, t.uniformLocation, m_arraySz, pData->fvals);
CHECKGLERRORS("Uniform::TVec4");
break;
case Uniform::TMat4:
glPROGRAMUNIFORMMATRIXV(bSp, 4f, prog, t.uniformLocation, m_arraySz, GL_FALSE, pData->fvals);
CHECKGLERRORS("Uniform::TMat4");
break;
#ifndef OGLES2
#ifndef USE_OLDPROGRAM
#pragma MESSAGE("WARNING WARNING WARNING WARNING : subroutines and separable shader NOT tested. Need to clarify how to setup the values")
#endif
case Uniform::TSubroutineUniform:
{
// Here we update the table of connections of Sub-routine uniforms <> implementations
// m_idx is used as an offset
if(!glslProgram->bindSubRoutineToUniform(t.uniformLocation, t.shadertype, pData->subroutineNames, 16))
{
nvFX::printf("Warning: can't associate subroutine %s(...) to %s. Did you put subroutine(...) before it ?\n", m_data->subroutineNames[0], m_name.c_str());
}
}
CHECKGLERRORS("Uniform::TSubroutineUniform");
break;
#endif
case Uniform::TTexture:
case IUniform::TTexture1D:
case IUniform::TTexture2D:
case IUniform::TTexture2DRect:
case IUniform::TTexture3D:
case IUniform::TTextureCube:
{
if(pData->tex.textureUnit<0)
t.pass->validateUniformTextureUnit(this, true);
//LOGI("UpdateGLSL: sampler %s in unit %d\n", m_name.c_str(), pData->tex.textureUnit);
glPROGRAMUNIFORM(bSp, 1i, prog, t.uniformLocation, pData->tex.textureUnit);
if(pData->tex.pRes)
{
if(pData->tex.pRes->getGLTextureID())
{
if(pData->tex.textureUnit >= 0)
glActiveTexture(GL_TEXTURE0 + pData->tex.textureUnit);
GLenum target = getGLTarget(pData->tex.pRes->getType());
GLuint tex = pData->tex.pRes->getGLTextureID();
if(pData->tex.access == ACCESS_UNDEFINED)
glBindTexture(target, tex);
#ifndef OGLES2
else {
GLenum access = getGLAccess(pData->tex.access);
GLenum format = ResourceFormatAsGL(pData->tex.pRes->getFormat());
glBindImageTexture(pData->tex.textureUnit, tex, 0/*pData->tex.level*/,
pData->tex.bLayered ? GL_TRUE:GL_FALSE, pData->tex.layer, access, format);
}
#else
else CHECK_TRUE(false);
#endif
CHECKGLERRORS("glBindTexture");
//GLenum err = glGetError();
// If a sampler state is assigned, set-it up
// TODO: optimize it to avoid redundancies
if(pData->tex.pSState)
pData->tex.pSState->updateGLTexture(getGLTarget(pData->tex.pRes->getType()), pData->tex.pRes->getGLTextureID() );
// TODO: in this case, maybe we can just call the sampler-state setting at validation time ONLY !
else if(pData->tex.pRes->getSamplerState())
pData->tex.pRes->getSamplerState()->updateGLTexture(getGLTarget(pData->tex.pRes->getType()), pData->tex.pRes->getGLTextureID() );
if(pData->tex.textureUnit > 0)
glActiveTexture(GL_TEXTURE0);
} else {
nvFX::printf("Warning: %s references a texture (%s) that wasn't initialized properly\n", m_name.c_str(), pData->tex.pRes->getName());
}
} else {
if(pData->tex.textureUnit >= 0)