本文整理汇总了C++中GLShader::setup方法的典型用法代码示例。如果您正苦于以下问题:C++ GLShader::setup方法的具体用法?C++ GLShader::setup怎么用?C++ GLShader::setup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLShader
的用法示例。
在下文中一共展示了GLShader::setup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildLightShaderVariant
//.........这里部分代码省略.........
lightFragLoopsAccum.resize(startFragLoops.size());
lightVertLoopsAccum.resize(startVertLoops.size());
thisFrag.append(lightFrag);
thisVert.append(lightVert);
int numVertLoops = startVertLoops.size();
int numFragLoops = startFragLoops.size();
for (int j = 0; j < numVertLoops; j++)
{
lightVertLoops[j].append(lightVert.substr(startVertLoops[j], endVertLoops[j]-startVertLoops[j]+lightLoopEndTokenLen));
// printf("lightVertLoops %d: %s\n\n",j,lightVertLoops[j].c_str());
for (int k = 0; k <= i; k++)
{
std::string thisVertLoop;
thisVertLoop.append(lightVert.substr(startVertLoops[j]+lightLoopStartTokenLen, endVertLoops[j]-startVertLoops[j]-lightLoopStartTokenLen));
searchAndReplace(thisVertLoop,lightIdToken,lightIds[k]);
// printf("thisVertLoop %d: %s\n\n",j,thisVertLoop.c_str());
lightVertLoopsAccum[j].append(thisVertLoop);
}
// printf("lightVertLoopsAccum %d: %s\n\n",j,lightVertLoopsAccum[j].c_str());
}
for (int j = 0; j < numFragLoops; j++)
{
lightFragLoops[j].append(lightFrag.substr(startFragLoops[j], endFragLoops[j]-startFragLoops[j]+lightLoopEndTokenLen));
// printf("lightFragLoops %d: %s\n\n",j,lightFragLoops[j].c_str());
for (int k = 0; k <= i; k++)
{
std::string thisFragLoop;
thisFragLoop.append(lightFrag.substr(startFragLoops[j]+lightLoopStartTokenLen, endFragLoops[j]-startFragLoops[j]-lightLoopStartTokenLen));
searchAndReplace(thisFragLoop,lightIdToken,lightIds[k]);
lightFragLoopsAccum[j].append(thisFragLoop);
// printf("lightFragLoop %d: %s\n\n",j,thisFragLoop.c_str());
}
// printf("lightFragLoopsAccum %d: %s\n\n",j,lightFragLoopsAccum[j].c_str());
}
for (int j = 0; j < numFragLoops; j++)
{
searchAndReplace(thisFrag,lightFragLoops[j].c_str(),lightFragLoopsAccum[j].c_str());
}
for (int j = 0; j < numVertLoops; j++)
{
searchAndReplace(thisVert,lightVertLoops[j].c_str(),lightVertLoopsAccum[j].c_str());
}
//printf("building variant light shader %d, light #%d, variant flag %d\n\n",lightType,i,variantFlag);
if (!tmpShader->setup(thisVert.c_str(),thisFrag.c_str(),NULL))
{
//printf("light shader variant build failure.\n\n");
return false;
}
lightShader[lightType][variantFlag].push_back(tmpShader);
}
}
else
{
for (int i = 0; i < MAX_LIGHTS; i++)
{
GLShader *tmpShader = new GLShader();
std::string thisFrag;
std::string thisVert;
thisFrag.append(lightFrag);
thisVert.append(lightVert);
searchAndReplace(thisFrag,lightIdToken,lightIds[i]);
searchAndReplace(thisVert,lightIdToken,lightIds[i]);
//printf("building variant light shader %d, light #%d, variant flag %d\n\n",lightType,i,variantFlag);
if (!tmpShader->setup(thisVert.c_str(),thisFrag.c_str(),NULL))
{
//printf("light shader variant build failure.\n\n");
return false;
}
lightShader[lightType][variantFlag].push_back(tmpShader);
}
}
return true;
}