本文整理汇总了C++中ShaderLoader::getProgramID方法的典型用法代码示例。如果您正苦于以下问题:C++ ShaderLoader::getProgramID方法的具体用法?C++ ShaderLoader::getProgramID怎么用?C++ ShaderLoader::getProgramID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderLoader
的用法示例。
在下文中一共展示了ShaderLoader::getProgramID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawTriangle
//画三角形
void drawTriangle(void)
{
GLuint ModelID = glGetUniformLocation(shaderLoader.getProgramID(), "Model");
if(ModelID != -1)
{
glUniformMatrix4fv(ModelID, 1, GL_FALSE, &Model[0][0]);
}
GLuint ProjectionID = glGetUniformLocation(shaderLoader.getProgramID(), "Projection");
if(ProjectionID != -1)
{
glUniformMatrix4fv(ProjectionID, 1, GL_FALSE, &Projection[0][0]);
}
GLuint ViewID = glGetUniformLocation(shaderLoader.getProgramID(), "View");
if(ViewID != -1)
{
glUniformMatrix4fv(ViewID, 1, GL_FALSE, &View[0][0]);
}
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, 12*3); // 12*3 indices starting at 0 -> 12 triangles
glBindVertexArray(0);
}
示例2: initShader
//设置并使用着色器
void initShader(void)
{
shaderLoader.load("/Users/wistoneqqx/Documents/opengl/github/texture-maps-gl7/texture-maps/simpleShader.vert",
"/Users/wistoneqqx/Documents/opengl/github/texture-maps-gl7/texture-maps/simpleShader.frag");
shaderLoader.bind();
//定义两张纹理的采样器
glGenSamplers(1,&g_Sampler1);
glGenSamplers(1,&g_Sampler2);
glSamplerParameteri(g_Sampler1, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glSamplerParameteri(g_Sampler1, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glSamplerParameteri(g_Sampler2, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glSamplerParameteri(g_Sampler2, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
textureLocation1 = glGetUniformLocation(shaderLoader.getProgramID(), "u_texture1");
textureLocation2 = glGetUniformLocation(shaderLoader.getProgramID(), "u_texture2");
if(textureLocation1==-1 && textureLocation2==-1)
printf("Get textureLocation error!\n");
}