本文整理汇总了C++中GLSLProgram::getProgram方法的典型用法代码示例。如果您正苦于以下问题:C++ GLSLProgram::getProgram方法的具体用法?C++ GLSLProgram::getProgram怎么用?C++ GLSLProgram::getProgram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLSLProgram
的用法示例。
在下文中一共展示了GLSLProgram::getProgram方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateGLSL
/*************************************************************************
**
** UniformGLSL UniformGLSL UniformGLSL UniformGLSL UniformGLSL UniformGLSL
** UniformGLSL UniformGLSL UniformGLSL UniformGLSL UniformGLSL UniformGLSL
**
*************************************************************************/
UniformGLSL::UniformGLSL(const char* name, const char* groupname, const char* semantic) :
#ifdef USECUDA
UniformCUDA(name, groupname, semantic)
#else
Uniform(name, groupname, semantic)
#endif
{
}
/*************************************************************************/ /**
**
**
**/ /*************************************************************************/
UniformGLSL::~UniformGLSL()
{
//Uniform::~Uniform(); we don't have to call this...
if(m_data)
{
#ifndef OGLES2
if(m_type == TSubroutineUniform)
for(int i=0; i<16; i++)
if(m_data->subroutineNames[i]) delete [] m_data->subroutineNames[i];
#endif
}
}
/*************************************************************************
**
** method invoked by update()
**
*************************************************************************/
void UniformGLSL::updateGLSL(ShadowedData *pData, STarget &t, bool bBindProgram)
{
NXPROFILEFUNCCOL2(m_name.c_str(), COLOR_YELLOW2, t.uniformLocation);
if(t.pass)
{
// Here we take into account either the single-program case, or the separable shader case
GLSLProgram *glslProgram;
bool bSp;
GLSLProgramPipeline* glslProgramPipeline = static_cast<GLSLProgramPipeline*>(t.pass->getProgramPipeline(t.passLayerId));
if(glslProgramPipeline)
{
glslProgram = static_cast<GLSLProgram*>(glslProgramPipeline->getShaderProgram(t.shaderProgramNumber));
bSp = true;
} else {
glslProgram = static_cast<GLSLProgram*>(t.pass->getProgram(t.passLayerId));
bSp = false;
}
int prog = glslProgram->getProgram();
//#ifdef USE_OLDPROGRAM
int prevProg = 0;
if(bBindProgram && (!bSp))
{
glslProgram->bind(t.pass->m_container);
//glGetIntegerv(GL_CURRENT_PROGRAM, &prevProg);
//assert(prog == prevProg);
}
//#endif
if(!t.valid)
{
t.uniformLocation = glGetUniformLocation(prog, m_name.c_str());
t.valid = t.uniformLocation < 0 ? false : true;
}
if(t.valid && pData) switch(m_type)
{
case Uniform::TBool:
glPROGRAMUNIFORM(bSp, 1i, prog, t.uniformLocation, pData->bvals[0] ? 1 : 0);
CHECKGLERRORS("Uniform::TBool");
break;
case Uniform::TFloat:
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:
//.........这里部分代码省略.........