src/OpenCVGUI/OGUI3D.cpp
// Create a program from two shaders
Create a program from two shaders
Create a program from two shaders
GLuint create_program(const char *path_vert_shader, const char *path_frag_shader) {
        GLuint vertexShader = load_and_compile_shader(path_vert_shader, GL_VERTEX_SHADER);
        GLuint fragmentShader = load_and_compile_shader(path_frag_shader, GL_FRAGMENT_SHADER);
        GLuint shaderProgram = glCreateProgram();
        glAttachShader(shaderProgram, vertexShader);
        glAttachShader(shaderProgram, fragmentShader);
        glDeleteShader(vertexShader);
        glDeleteShader(fragmentShader);
        glLinkProgram(shaderProgram);
        glUseProgram(shaderProgram);
        return shaderProgram;
    }
GLuint create_program ( const char * path_vert_shader , const char * path_frag_shader ) { GLuint vertexShader = load_and_compile_shader ( path_vert_shader , GL_VERTEX_SHADER ) ; GLuint fragmentShader = load_and_compile_shader ( path_frag_shader , GL_FRAGMENT_SHADER ) ; GLuint shaderProgram = glCreateProgram ( ) ; glAttachShader ( shaderProgram , vertexShader ) ; glAttachShader ( shaderProgram , fragmentShader ) ; glDeleteShader ( vertexShader ) ; glDeleteShader ( fragmentShader ) ; glLinkProgram ( shaderProgram ) ; glUseProgram ( shaderProgram ) ; return shaderProgram ; }
Create a program from two shaders
Create a program from two shaders
// Load and compile the vertex and fragment shaders // Attach the above shader to a program // Flag the shaders for deletion // Link and use the program