Pickle
Mega GP Mania
So i found a quake project that uses a opengl to opengl es wrapper for symbian phones. The wrapper is in the form of a library. Ive compiled the library and a quake engine together. I need some help a lot of the things its need are new to me.
First the library called nanoGL is loading, I open the opengles-lite.so in the /lib folder. Good so far.
Then the orignal code would look up each function by its ordinal number. its appears linux does not work this way (maybe this is carry over from the windows land? The original was trying to open a dll)
Anyway the nanogl has a struct with pointers to each function. So the code would load each pointer incremenly with the address as loaded them.
CODE
struct GlESInterface
{
int (*eglChooseConfig) (int dpy, const int *attrib_list, int *configs, int config_size, int *num_config);
int (*eglCopyBuffers) (int dpy, int surface, void* target);
int (*eglCreateContext) (int dpy, int config, int share_list, const int *attrib_list);
CODE
puts( "Getting functions by ordinal" );
//Mem::FillZ(glEsImpl, sizeof(GlESInterface));
memset( glEsImpl, 0, sizeof(GlESInterface));
int32_t** ptr = (int32_t**)(glEsImpl);
for (int count = 0; count < KGLEsFunctionCount; count++)
{
//*ptr++ = (int32_t*)(glesLib->Lookup(count+1));
snprintf(ordinal, sizeof(ordinal), "%d", count+1);
*ptr++ = (int32_t*)dlsym(glesLib,ordinal);
I need to get the function pointers in the struct to have the address in the library. using a symbol like "1" doesnt work. In linux is only by name of the function? How should I do this?
First the library called nanoGL is loading, I open the opengles-lite.so in the /lib folder. Good so far.
Then the orignal code would look up each function by its ordinal number. its appears linux does not work this way (maybe this is carry over from the windows land? The original was trying to open a dll)
Anyway the nanogl has a struct with pointers to each function. So the code would load each pointer incremenly with the address as loaded them.
CODE
struct GlESInterface
{
int (*eglChooseConfig) (int dpy, const int *attrib_list, int *configs, int config_size, int *num_config);
int (*eglCopyBuffers) (int dpy, int surface, void* target);
int (*eglCreateContext) (int dpy, int config, int share_list, const int *attrib_list);
CODE
puts( "Getting functions by ordinal" );
//Mem::FillZ(glEsImpl, sizeof(GlESInterface));
memset( glEsImpl, 0, sizeof(GlESInterface));
int32_t** ptr = (int32_t**)(glEsImpl);
for (int count = 0; count < KGLEsFunctionCount; count++)
{
//*ptr++ = (int32_t*)(glesLib->Lookup(count+1));
snprintf(ordinal, sizeof(ordinal), "%d", count+1);
*ptr++ = (int32_t*)dlsym(glesLib,ordinal);
I need to get the function pointers in the struct to have the address in the library. using a symbol like "1" doesnt work. In linux is only by name of the function? How should I do this?