Пример #1
0
/*----------------------------------------------------------------------------*/
void init_shaders(char **shader, int count)
{
    init_shader_vars();


    printf("init_shaders has been passed %d shaders in its input param\n", count);

    if(count ==1)
    {
        vert_shader = loadVertShader(shader[0]);
        checkCompile(vert_shader);
    }

    if(count ==2)
    {
        assert(shader[1] != NULL);
        printf("loading second shader");
        
        vert_shader = loadVertShader(shader[0]);
        checkCompile(vert_shader);

        frag_shader = loadFragShader(shader[1]);
        checkCompile(frag_shader);
    }

    link_shaders();

    check_shader_linkage();
    
    glUseProgram(program);
}
Пример #2
0
Shader::Shader(const char* vertShaderFile, const char* fragShaderFile) {
  mVertShaderID = 0;
  mFragShaderID = 0;
  mShaderProgramID = 0;
  mEnabled = false;
  
  if (!loadVertShader(vertShaderFile)) {
    return;
  }
  if (!loadFragShader(fragShaderFile)) {
    return;
  }
  
  link();
}