[Solved] How to create a OpenGL 3 application with visual studio?


As for loading the functions, take a look at this page.

And also, don’t forget about context creation.

As for setting it up in Visual Studio, you would probably just need to link OpenGL lib files (opengl32.dll for windows, .so for linux, etc..)

This snippet might be useful (taken from the first link):

void *GetAnyGLFuncAddress(const char *name)
{
    void *p = (void *)wglGetProcAddress(name);
    if(p == 0 ||
        (p == (void*)0x1) || (p == (void*)0x2) || (p == (void*)0x3) ||
        (p == (void*)-1) )
    {
        HMODULE module = LoadLibraryA("opengl32.dll");
        p = (void *)GetProcAddress(module, name);
    }

    return p;
}

Although it is possible to use OpenGL without a wrapper such as GLFW or SDL, it is strongly recommended to use a pre-existing wrapper such as one of those. Mostly, because the implementation is platform-specific, which these wrappers handle (without them you would need different algorithms for different platforms). They also provide a convenient shorthand for the GL constants (GL_TRUE, GL_FALSE, GL_TEXTURE_2D etc).

1

solved How to create a OpenGL 3 application with visual studio?