Where is glUseProgram() (etc) declared?

Issue #10 resolved
Former user created an issue

I'm trying to build Denise on NetBSD. It seems the GL headers are differently organized than on Linux. When compiling obj/driver.o there are many GL-related functions that the compiler complains are not declared. I attached compiler output. Functions that are mentioned include glUseProgram, glDeleteSync, glGetUniformLocation, glClientWaitSync, glBindFramebuffer, ...

I was thinking I need to include some extra header here in ./driver/video/opengl/opengl.h:

ifdef __APPLE__
    #include <OpenGL/gl3.h>
#elif _WIN32
    #include <GL/gl.h>
    #include <GL/glext.h>
    #define glGetProcAddress(name) wglGetProcAddress(name)
#else
    //#include <GL/glew.h>
    //#include <GL/glcorearb.h>
    #include <GL/gl.h>
    #include <GL/glx.h>
    #define glGetProcAddress(name) (*glXGetProcAddress)((const GLubyte*)(name))
#endif

but my attempts so far are unsuccessful.

If I search for, for example, glGetUniformLocation, I have references in several headers, like so:

$ grep -r '\<glGetUniformLocation\>' /usr/pkg/include/
/usr/pkg/include/GL/glcorearb.h:GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
/usr/pkg/include/GL/glext.h:GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
/usr/pkg/include/GL/glew.h:#define glGetUniformLocation GLEW_GET_FUN(__glewGetUniformLocation)
/usr/pkg/include/GLES2/gl2.h:GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
/usr/pkg/include/GLES3/gl3.h:GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
/usr/pkg/include/GLES3/gl31.h:GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
/usr/pkg/include/GLES3/gl32.h:GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
/usr/pkg/include/SDL/SDL_opengl.h:GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *);
/usr/pkg/include/epoxy/gl_generated.h:#define glGetUniformLocation epoxy_glGetUniformLocation
/usr/pkg/include/cogl/cogl/gl-prototypes/cogl-glsl-functions.h:COGL_EXT_FUNCTION (GLint, glGetUniformLocation,
/usr/pkg/include/SDL2/SDL_opengl_glext.h:GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
/usr/pkg/include/SDL2/SDL_opengles2_gl2.h:GL_APICALL GLint        GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);

Do you have a suggestion which header files should be included?

(aside: bitbucket's email confirmation link refused to work, it says "Something has gone wrong "....)

Comments (13)

  1. Rhialto

    I will never use Bitbucket again. To even “verify my email” I had to go to a different computer and use a throwaway profile in Firefox.

    Even after that, it won’t let me login on my normal browser with my normal security settings. It blathers about “allowing third party cookies” which goes against all security sense, and I wouldn’t even know how to enable those, even if I wanted.

  2. PiCiJi repo owner

    /driver/video/opengl/bind.h:

    I am sure the problem is in file “bind.h”. There are two lines which look like this:

    #if defined(_WIN32) || defined(__linux__)

    try to change both lines in

    #if defined(_WIN32) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__)

  3. Rhialto

    Thanks! I just added __NetBSD__but that worked fine.

    I’ve made a preliminary pkgsrc package. You can see it at https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=tree;f=denise;h=3dddc017a274cca0fa4c59766824361075831f7c;hb=HEAD

    I wanted to add DESTDIR support and change the installation directories (so they better match other packages, which are in /usr/pkg) with the change to prefix := ${DESTDIR}${PREFIX} (where PREFIX is user-settable but usually /usr/pkg) but it seems that Denise still tries to find files in the old location somehow.

    Also the ~/.local/denise directory doesn’t translate well to /usr/pkg/denise so I made it /usr/pkg/share/denise.

    I haven’t looked yet at where to change this in the program so that it matches the patched Makefile.

  4. PiCiJi repo owner

    Thank you for the package.

    ok, I have added “defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__)“ to fix build process.

    At the moment DESTDIR is hardcoded besides the Makefile. I will fix this after completing actual task.

  5. PiCiJi repo owner

    latest master has support for custom prefix. new default prefix is /usr. Could you try for NetBSD please.

    make prefix=/usr/pkg

    sudo make install prefix=/usr/pkg

    resulting paths:

    • $prefix/local/bin/ (or) in $prefix/bin/ (if there is no "local" folder)
    • $prefix/share/applications/denise.desktop
    • $prefix/share/mime/packages/application-x-denise.xml
    • $prefix/share/denise/translation/
    • $prefix/share/denise/data/
    • $prefix/share/denise/fonts/
    • $prefix/share/denise/img/
    • $prefix/share/denise/shader/

  6. Rhialto

    Cool! I have tried it by hand instead of trying an adjusted package (because the logic in pkgsrc is oriented towards released tarballs). When you do a new release I will adjust the pkgsrc entry accordingly. Cheers!

  7. Log in to comment