The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
opengles2 gen/ bind functions
Owen Alanzo Hogarth
Guest

Currently If I target opengles2 on android with these headers

#if __ANDROID__
    #define GL_GLEXT_PROTOTYPES 1
    #include "SDL_opengles2.h"
    #include <GLES2/gl2.h>
    #include <GLES2/gl2ext.h>
#endif



I get these errors when trying to build the android project
jni/src/project/mandelbrot.c:132: error: undefined reference to 'glGenVertexArrays'
jni/src/project/mandelbrot.c:138: error: undefined reference to 'glBindVertexArray'
jni/src/project/mandelbrot.c:164: error: undefined reference to 'glBindVertexArray'
jni/src/project/mandelbrot.c:186: error: undefined reference to 'glBindVertexArray'
jni/src/project/mandelbrot.c:197: error: undefined reference to 'glBindVertexArray'



adding these in the .c file that uses those mentioned functions, the problem goes away.


#if __ANDROID__
    PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
    PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray;
    PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
    PFNGLISVERTEXARRAYOESPROC glIsVertexArray;



    glGenVertexArrays = (PFNGLGENVERTEXARRAYSOESPROC)SDL_GL_GetProcAddress ( "glGenVertexArrays" );
    glBindVertexArray = (PFNGLBINDVERTEXARRAYOESPROC)SDL_GL_GetProcAddress ( "glBindVertexArray" );
    glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSOESPROC)SDL_GL_GetProcAddress ( "glDeleteVertexArrays" );
    glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)SDL_GL_GetProcAddress ( "glIsVertexArray" );
#endif



Is this solved in an updated version of sdl? Is it possible to hide this code away so that I don't have include it in the file that I need to use it?


Currently I have sdl setup like this:
source/
liba.so
libb.so
libc.so
file.h <--includes all .so functions


project/
project.c <-- #include file.h //to bring in all the shared objects


currently to get my project to run I have to add that SDL_getproc directly in one of my project files that will be generating and binding the opengles vao.


How can I sort this out?
opengles2 gen/ bind functions
Leonardo


Joined: 11 Feb 2010
Posts: 46
I don't load these functions through SDL, nor use SDL_opengl headers. It can get messy (last time I tried on android I had only trouble), so I just avoid them althogether.


I'm using https://bitbucket.org/alfonse/glloadgen/wiki/Home to generate a pair of .h/.c files that I compile together with my application, and ask it to load those functions after I initialize OpenGL context with SDL.


HTH.

Leonardo.


Em seg, 17 de ago de 2015 às 18:46, Owen Alanzo Hogarth escreveu:

Quote:
Currently If I target opengles2 on android with these headers

#if __ANDROID__
    #define GL_GLEXT_PROTOTYPES 1
    #include "SDL_opengles2.h"
    #include <GLES2/gl2.h>
    #include <GLES2/gl2ext.h>
#endif



I get these errors when trying to build the android project
jni/src/project/mandelbrot.c:132: error: undefined reference to 'glGenVertexArrays'
jni/src/project/mandelbrot.c:138: error: undefined reference to 'glBindVertexArray'
jni/src/project/mandelbrot.c:164: error: undefined reference to 'glBindVertexArray'
jni/src/project/mandelbrot.c:186: error: undefined reference to 'glBindVertexArray'
jni/src/project/mandelbrot.c:197: error: undefined reference to 'glBindVertexArray'



adding these in the .c file that uses those mentioned functions, the problem goes away.


#if __ANDROID__
    PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
    PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray;
    PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
    PFNGLISVERTEXARRAYOESPROC glIsVertexArray;



    glGenVertexArrays = (PFNGLGENVERTEXARRAYSOESPROC)SDL_GL_GetProcAddress ( "glGenVertexArrays" );
    glBindVertexArray = (PFNGLBINDVERTEXARRAYOESPROC)SDL_GL_GetProcAddress ( "glBindVertexArray" );
    glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSOESPROC)SDL_GL_GetProcAddress ( "glDeleteVertexArrays" );
    glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)SDL_GL_GetProcAddress ( "glIsVertexArray" );
#endif



Is this solved in an updated version of sdl? Is it possible to hide this code away so that I don't have include it in the file that I need to use it?


Currently I have sdl setup like this:
source/
liba.so
libb.so
libc.so
file.h <--includes all .so functions


project/
project.c <-- #include file.h //to bring in all the shared objects


currently to get my project to run I have to add that SDL_getproc directly in one of my project files that will be generating and binding the opengles vao.


How can I sort this out?

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org