Пример #1
0
//设置并使用着色器
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");
}
Пример #2
0
//设置并使用着色器
void initShader(void)
{
    shaderLoader.load("/Users/wistoneqqx/Documents/github/sbxfc/OpenGLProjectionMatrices/draw-triangle/draw-triangle/simpleShader.vert",
                      "/Users/wistoneqqx/Documents/github/sbxfc/OpenGLProjectionMatrices/draw-triangle/draw-triangle/simpleShader.frag");
    shaderLoader.bind();
}
Пример #3
0
//设置并使用着色器
void initShader(void)
{
    shaderLoader.load("/Users/wistoneqqx/Documents/opengl/opengl-study-records/triangel_index_gl9/triangel_index/triangel_index/simpleShader.vert",
                      "/Users/wistoneqqx/Documents/opengl/opengl-study-records/triangel_index_gl9/triangel_index/triangel_index/simpleShader.frag");
    shaderLoader.bind();
}