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 9 of 9

Thread: glGetStringi how make it work?

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2013
    Posts
    10

    glGetStringi how make it work?

    I want to know the opengl extensions, using glGetStringi, but the code doesn't compile. What the include for glGetStringi?
    I'm using Code::Blocks with mingw on windows 7.

    My code:

    #include <iostream>
    #include "GL/gl.h"
    #include <windows.h>

    using namespace std;

    int main()
    {
    int max = 0;
    glGetIntegerv(GL_EXTENSIONS, &max);

    for(int i = 0; i < max; i++)
    cout << glGetStringi(GL_EXTENSIONS, i) << endl;


    return 0;
    }

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,128
    Care to share the actual compiler error?

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2013
    Posts
    10
    The error is:
    'glGetStringi' was not declared in this scope

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,128
    Ah yes, glGetStringi is a GL 3.0 or higher function IIRC. The standard GL header shipped with Windows, however, exposes only GL 1.1 functionality. Checkout glLoadGen or GLEW.

    Correction: Your header is shipped with MinGW. Still, MinGW's gl.h doesn't expose GL 3.0 or higher functions. The advice stays the same.

  5. #5
    Member Regular Contributor
    Join Date
    Aug 2008
    Posts
    450
    glGetStringi was only added to OpenGL in version 3.0, and the gl.h provided by Microsoft only includes OpenGL 1.1 entry points, so you will need to include extra code to the retrieve the function pointers, or use tools that do this for you

  6. #6
    Junior Member Newbie
    Join Date
    Jan 2013
    Posts
    10
    I got GLEW_OK on glewInit, but glGetStringi don't compile, I got undefined reference. What shall be wrong?
    glewExperimental is a undefined reference too.
    Last edited by ewerton; 01-04-2013 at 11:11 AM.

  7. #7
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    I am not sure what glew you are using but glGetStringi works find for me. Check your glew.h.

  8. #8
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    You're getting linker errors because you're probably linking with the wrong libraries (or not linking with them at all). Honestly, if you want this to be much simpler, just use glLoadGen and include the source/headers into your project directly.

  9. #9
    Junior Member Newbie
    Join Date
    Jan 2013
    Posts
    10
    I added glew source files to my project and it worked. Now I can call the extensions!
    Thank you =)

Posting Permissions

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