SimpleUsage

Basic Usage


Core Contexts

#include <glxx/gl_3_3_core.h> // Included it before any OpenGL headers (eg. before gl.h)!
// Now we have all OpenGL 3.3 core functionality

on_OpenGL_init()
{
    if (!has_gl_3_3_core()) {
        std::cerr << "Current context does not support OpenGL Core 3.3";
        exit(0);
    }
    if (!load_gl_3_3_core()) {
        std::cerr << "Could not load all core 3.3 functions";
    }
}
// ...
on_OpenGL_paint()
{   
    glClear(GL_COLOR_BUFFER_BIT);
    // glWhateverCommand(...) up to 3.3 (core only)
}



Compatibility contexts

#include <glxx/gl_3_1_compatibility.h>
// Now we have all OpenGL 3.1 compatibility functionality

on_OpenGL_init()
{
    if (!has_gl_3_1_compatibility()) {
        // Current context does not support version 3.1
    }
    if (!load_gl_3_1_compatibility()) {
        // Could not load all version 3.1 functions
    }
}

on_OpenGL_paint()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    // glWhateverFunction(...); up to OpenGL 3.1
}



Contexts for OpenGL 3.0 and lower

#include <glxx/gl_2_1.h>
// Now we have all OpenGL 2.1 functionality

on_OpenGL_init()
{
    if (!has_gl_2_1()) {
        // Current context does not support version 2.1
    }
    if (!load_gl_2_1()) {
        // Could not load all version 2.1 functions
    }
}

on_OpenGL_paint()
{
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    // glWhateverFunction(...); up to OpenGL 2.1
}

Updated

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.