Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Undefined Reference to VBO functions

  1. #1
    Intern Newbie
    Join Date
    Jul 2013
    Posts
    35

    Undefined Reference to VBO functions

    I am compiling using MingW with the following flags:

    -lmingw32 -mwindows -lopengl32 -lglu32 -lwinmm -lws2_32

    And in my project I include the following lines:

    #include <gl/gl.h>
    #include <gl/glu.h>
    #define GL_GLEXT_PROTOTYPES
    #include "../lib/glext.h"

    However if I attempt to use any VBO related functions such as:

    glBindBuffer
    glBindBufferARB
    glBufferData
    glBufferDataARB

    I get an undefined reference to them.

  2. #2
    Member Regular Contributor
    Join Date
    Jun 2013
    Posts
    474
    Quote Originally Posted by Quaver View Post
    However if I attempt to use any VBO related functions such as:

    glBindBuffer
    glBindBufferARB
    glBufferData
    glBufferDataARB

    I get an undefined reference to them.
    On Windows, opengl32.dll only exports the functions which are part of the OpenGL 1.1 API. For anything added after that, you have to use wglGetProcAddress() to obtain a pointer to the function (the OpenGL headers define the relevant pointer types), or use a library such as GLEW to do it for you.

    Note that the function pointers can vary between contexts, so you shouldn't obtain a pointer with one context then use it with another context unless you know that the contexts are compatible. This is mainly an issue for heterogeneous multi-headed systems, where different screens may be using different OpenGL drivers. But in that situation you also run into the issue that the OpenGL version, supported extensions, implementation limits, etc will differ between screens.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •