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

Thread: glPatchParameteri not recognized on Linux

Hybrid View

  1. #1
    Junior Member Regular Contributor
    Join Date
    Mar 2009
    Location
    California
    Posts
    188

    glPatchParameteri not recognized on Linux

    When I try to compile my OpenGL 4 program on Ubuntu 12.04 I get the following error:
    undefined reference to `glPatchParameteri'|
    I am including the OpenGL headers as follows:
    Code :
    #include <OpenGL.h>
    #include <GL/gl.h>

    This macro is defined in the project build options:
    GL_GLEXT_PROTOTYPES
    According to the terminal, my GPU supports OpenGL 4.3:
    Code :
    OpenGL version string: 4.3.0 NVIDIA 319.32

    I have not included GLEW, as I have never needed it in the past, and do not know if it solves this problem.

  2. #2
    Intern Contributor
    Join Date
    Jun 2013
    Posts
    70
    well its because you dont have glew that its not working. im assuming youve been programing in early opengl, that doesnt require GLEW. but with newer opengl you need GLEW or something like it (http://www.opengl.org/wiki/OpenGL_Loading_Library). all my programs need GLEW and im pretty sure that glPatchParameteri() is a newer function. also ive never heard of OpenGL.h, i dont need it in any of my programs. try it with GLEW

  3. #3
    Junior Member Regular Contributor
    Join Date
    Mar 2009
    Location
    California
    Posts
    188
    I included glew:
    Code :
            #include <GL/glew.h>
            #include <GL/gl.h>

    I still get the same error.

    I can find the function in glew.h, and I know header is the one the program is including:
    Code :
    typedef void (GLAPIENTRY * PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat* values);
    typedef void (GLAPIENTRY * PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);
     
    #define glPatchParameterfv GLEW_GET_FUN(__glewPatchParameterfv)
    #define glPatchParameteri GLEW_GET_FUN(__glewPatchParameteri)

  4. #4
    Intern Contributor
    Join Date
    Jun 2013
    Posts
    70
    you have to first add this to your code to load the functions:
    glewExperimental=TRUE;
    GLenum err=glewInit();
    if(err!=GLEW_OK)
    {
    //Problem: glewInit failed, something is seriously wrong.
    cout<<"glewInit failed, aborting."<<endl;
    }
    then you must link to GLEW by -lGLEW if youre using gcc from the terminal. if not you will have to figure out how to link to it.
    you also should install GLEW using the packagae manager that comes with your system.
    good luck

  5. #5
    Junior Member Regular Contributor
    Join Date
    Mar 2009
    Location
    California
    Posts
    188
    Thanks, I got it to compile. I added libglew.so in the linker settings.

Posting Permissions

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