Automatic loading

Create issue
Issue #26 invalid
Romain created an issue


I just start to use your tools. I generate my lib with this command:

lua LoadGen.lua -style=pointer_c -spec=gl -version=3.3 -profile=core core_3_3

(I am using Windows 7)

I include .h and .c in my project. There are two warnings that I correct in ogl_LoadFunctions:

_ptrc_glGetIntegerv = (void (CODEGEN_FUNCPTR *)(GLenum , GLint *))IntGetProcAddress("glGetIntegerv");
    if(!_ptrc_glGetIntegerv) return ogl_LOAD_FAILED;
    _ptrc_glGetStringi = (const GLubyte * (CODEGEN_FUNCPTR *)(GLenum , GLuint ))IntGetProcAddress("glGetStringi");
    if(!_ptrc_glGetStringi) return ogl_LOAD_FAILED;

But OGL functions are not loaded, all OGL methods are initialized to address 0x00000. I need to call ogl_LoadFunctions before use any functions.

EDIT: I have just found a loading error. It can't load "glGetStringi" function with : IntGetProcAddress("glGetStringi"). Like in issue #23.


Comments (7)

  1. Jason McKesson repo owner

    I have just found a loading error. It can't load "glGetStringi" function with : IntGetProcAddress("glGetStringi").

    Are you actually getting an OpenGL 3.3 implementation? That is the version the loader expects to find, and the only reason glGetStringi would not be available is if you were getting an OpenGL version below 3.0.

  2. Romain reporter

    With the following code :

    glfwOpenWindow(800, 600, 8, 8, 8, 8, 24, 8, GLFW_WINDOW);
    glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
    int g_major_version, g_minor_version;
    glGetIntegerv(GL_MAJOR_VERSION, &g_major_version);
    glGetIntegerv(GL_MINOR_VERSION, &g_minor_version);
    cout << "OpenGL version: " << g_major_version << ", " << g_minor_version << endl;

    I am getting an OpenGL 4.2 implementation.

    But I need to call "ogl_LoadFunctions" from myself.

    Thank you

  3. Jason McKesson repo owner

    This is my fault. I thought I had made the use of the tool more clear in the documentation, but as I look at it now, I didn't. I'll work on that.

    The pointer-c style works like GLEW and most other OpenGL loading libraries: you have to explicitly initialize them. And you have to do this after creating the OpenGL context (in your case, this is after calling glfwOpenWindow). In short, you're supposed to call ogl_Loadfunctions() yourself (just not where you did).

    If you don't want to explicitly initialize the system, you should try noload-cpp. It only comes in a C++ variant for the time being, but that's mostly laziness on my part.

  4. Log in to comment