Jump to content


Photo

Glquake Need Help


  • Please log in to reply
4 replies to this topic

#1 Pickle

Pickle

    Mega GP Mania

  • X-treme Team
  • 4074 posts
  • Gender:Male
  • Location:Detroit, Michigan

Posted 31 January 2009 - 05:24 AM

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?



#2 fishybawb

fishybawb

    Hired Geek

  • GP32 Hardcore
  • PipPipPipPipPipPip
  • 1114 posts
  • Location:York, UK

Posted 31 January 2009 - 02:43 PM

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);


What does the glesLib->Lookup() function do? It might just be a case of uncommenting that and commenting the dlsym line... Unless Lookup() is one of your own test functions?





#3 Pickle

Pickle

    Mega GP Mania

  • X-treme Team
  • 4074 posts
  • Gender:Male
  • Location:Detroit, Michigan

Posted 31 January 2009 - 03:53 PM

QUOTE(fishybawb @ Jan 31 2009, 09:43 AM) View Post

What does the glesLib->Lookup() function do? It might just be a case of uncommenting that and commenting the dlsym line... Unless Lookup() is one of your own test functions?


Lookup is a symbian dll function to find entry points in the dll.

Now Im trying to set each function pointer, i dont think I can do it like the code above in linux. I could use dym but I think I would still have to use the function name, which I would have to do each one by itself.


#4 Pickle

Pickle

    Mega GP Mania

  • X-treme Team
  • 4074 posts
  • Gender:Male
  • Location:Detroit, Michigan

Posted 05 February 2009 - 02:51 AM

Getting closer, im dynamically linking to the library and the library back to my code. But something bad is happening somewhere.


#5 Pickle

Pickle

    Mega GP Mania

  • X-treme Team
  • 4074 posts
  • Gender:Male
  • Location:Detroit, Michigan

Posted 10 February 2009 - 02:43 AM

since tyr-quake was so slow I went with the S60 source with the wiz modifcations, well I had been getting a seg fault while the game was loading (I actually see the console split messages out on the wiz)
Bad thing its happening in the opengl-es lib, hurrah.

Program received signal SIGSEGV, Segmentation fault.
0x416bd510 in glTexImage2D () from /lib/libopengles_lite.so
(gdb) backtrace
#0 0x416bd510 in glTexImage2D () from /lib/libopengles_lite.so
#1 0x403ae5bc in glTexImage2D () from ./libwizGLES.so
#2 0x0001bacc in GL_Upload32 ()
#3 0x0001c1b4 in GL_Upload8 ()
#4 0x0001c38c in GL_LoadTexture ()
#5 0x0001e448 in Mod_LoadTextures ()
#6 0x00021410 in Mod_LoadBrushModel ()
#7 0x0001e018 in Mod_LoadModel ()
#8 0x0001e07c in Mod_ForName ()
#9 0x0000ee38 in CL_ParseServerInfo ()
#10 0x000103ac in $a ()
#11 0x000103ac in $a ()