1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dismiss Notice

Release SLUDGE Adventure Engine now with GLES2 support

Discussion in 'Software Releases' started by BigMc, Jan 14, 2012.

  1. BigMc

    BigMc Still Fresh

    Joined:
    Jan 4, 2012
    Messages:
    32
    Hi,


    I'm one of the developers of SLUDGE, a free (it's already in Debian and Ubuntu) adventure game engine with development tools, all working on Linux, Mac and Windows.


    I wanted it to work on mobile devices such as the Pandora and maybe some phones, so I made the graphics code GLES2 capable. (It's working on my PC with GLES2 provided by the Mesa 3D driver.) Since I don't own such a device, I need you help to test it on actual mobile hardware and tell me what I have to change to make it work.


    If you want to help testing, grab the SVN version as described here. GLES2 can be turned on with



    Code:
    
    ./configure --enable-gles2
    
    

    If compiling works, get one of the available games and start testing. I hope we can make this work on the Pandora. :)


    Best regards,


    BigMc
     
  2. TitanUranus

    TitanUranus Member

    Joined:
    Oct 6, 2009
    Messages:
    756
    Location:
    UK
    Maybe if someone like StreaK compiles this into a PND this'd gain a lot of interest. It looks really good.
     
  3. Dave18

    Dave18 Member

    Joined:
    Mar 16, 2003
    Messages:
    336
    I have dependency issues compiling natively on Pandora as it is needs the GLee library which in turn need standard OpenGL which isn't supported on the Pandora. Don't know an easy way round this (maybe using an OpenGL wrapper - not sure how to do this though).
     
  4. clop

    clop Member

    Joined:
    Aug 17, 2010
    Messages:
    176

    You need to modify configure.ac in order to exclude GLee checks when configuring for gles2:



    Code:
    
    Index: configure.ac
    
    ===================================================================
    
    --- configure.ac    	(révision 590)
    
    +++ configure.ac    	(copie de travail)
    
    @@ -49,8 +49,10 @@
    
    fi
    
    
    # Checks for libraries.
    
    -AC_CHECK_LIB([glee], [GLeeInit], [GLEE_LIBS="-lglee"], [AC_CHECK_LIB([GLee], [GLeeInit], [GLEE_LIBS="-lGLee"], [AC_MSG_ERROR([cannot find glee library])])])
    
    -AC_SUBST([GLEE_LIBS])
    
    +if test "x$enable_gles2" = xno;then
    
    +   	AC_CHECK_LIB([glee], [GLeeInit], [GLEE_LIBS="-lglee"], [AC_CHECK_LIB([GLee], [GLeeInit], [GLEE_LIBS="-lGLee"], [AC_MSG_ERROR([cannot find glee library])])])
    
    +   	AC_SUBST([GLEE_LIBS])
    
    +fi
    
    
    if test "x$enable_engine" = xyes; then
    
       PKG_CHECK_MODULES([ENGINE], [sdl alure >= 1.1 openal vorbis ogg])
    
    

    and then re-run autogen.sh. Includes of glee.h are done only when compiling without -DHAVE_GLES2.


    I've got solved dependencies on Alure and libvpx libs (cross-compiling openAl, Alure and libvpx) but for the moment I'm stuck with configure not detecting correctly OpenGLES2. Got things to do this afternoon but i'll try to investigate it tonight.
     
    Last edited by a moderator: Jan 14, 2012
  5. Dave18

    Dave18 Member

    Joined:
    Mar 16, 2003
    Messages:
    336
    Thanks, I made the change and cleared the GLee error (btw trying to google 'glee' is pointless unless you like awful tv shows!!)


    I'm now getting the following error


    ./configure: line 4396: syntax error near unexpected token 'ENGINE,'


    ./configure: line 4396: ' PKG_CHECK_MODULES(ENGINE, sdl alure >= 1.1 openal vorbis ogg)'


    I've got pkg-config installed, am I missing another dependency for configure?


    Thanks
     
  6. BigMc

    BigMc Still Fresh

    Joined:
    Jan 4, 2012
    Messages:
    32
    I have fixed the GLee checks in SVN now. I guess you introduced a syntax error while fixing the GLee thing, try the version from SVN.
     
  7. BigMc

    BigMc Still Fresh

    Joined:
    Jan 4, 2012
    Messages:
    32
    About OpenGLES2 not being found: It is about this line in configure.ac:



    Code:
    
      PKG_CHECK_MODULES([GLES2], [glesv2 egl])
    
    


    glesv2 egl are the names of the pkgconfig files that should be in $LIBRARY_PATH/pkgconfig, for example for me it's /usr/lib/x86_64-linux-gnu/pkgconfig/glesv2.pc

    Could also be /usr/lib/pkgconfig/glesv2.pc

    Look if they are there and change the names if they are called differently. If there are no pkgconfig files, replace the line with







    Code:
    
      AC_CHECK_LIB([GLESv2], [glEnable], [ENGINE_LIBS+=" -lGLESv2"], [AC_MSG_ERROR([cannot find GLESv2 library])])
    
      AC_CHECK_LIB([EGL], [eglInitialize], [ENGINE_LIBS+=" -lEGL"], [AC_MSG_ERROR([cannot find EGL library])])
    
    
     
  8. clop

    clop Member

    Joined:
    Aug 17, 2010
    Messages:
    176
    Hi again,


    Thanks for the quick fixes :D I used the second solution of your previous post.


    First the good news: I got it to build & run (just a noargs run, but i get the usage message).


    Bad news: I had to edit by hand the generated Makefile and the GLES2/gl2.h (that's maybe a problem with my SDK version, it was missing the GLchar definition).


    For the Makefile, I had "@GLES2_FLAGS@" that broke the build. I'm guessing it's some kind of token that's not getting replaced. I just removed it. Also, link line was missing the -lX11 which seems needed by eglport.


    Two minor code fixes to get it to compile:



    Code:
    
    Index: source/Engine/graphics.cpp
    
    ===================================================================
    
    --- source/Engine/graphics.cpp  (révision 598)
    
    +++ source/Engine/graphics.cpp  (copie de travail)
    
    @@ -19,6 +19,8 @@
    
    #include <GL\glu.h> // handy for gluErrorString
    
    #elif defined __APPLE__
    
    #include <OpenGL/glu.h>
    
    +#elif defined HAVE_GLES2
    
    +#include <GLES2/gl2.h>
    
    #else
    
    #include <GL/glu.h>
    
    #endif
    
    Index: source/Engine/movie.cpp
    
    ===================================================================
    
    --- source/Engine/movie.cpp 	(r&#233;vision 598)
    
    +++ source/Engine/movie.cpp 	(copie de travail)
    
    @@ -142,7 +142,7 @@
    
        	if (audioBuf) {
    
                	// Synch video timer to audio
    
                	Uint32 tick = SDL_GetTicks()+100;
    
    -       		if (abs((long)(tick - movieStartTick)-(audioBuf->time_ms)) > 300) {
    
    +       		if (abs((long int)((long)(tick - movieStartTick)-(audioBuf->time_ms))) > 300) {
    
                        	movieStartTick = tick - audioBuf->time_ms;
    
                	}
    
    

    I'll try running a game tomorrow, for now it's bed time :D
     
    Last edited by a moderator: Jan 15, 2012
  9. BigMc

    BigMc Still Fresh

    Joined:
    Jan 4, 2012
    Messages:
    32
    Nice that you got it to compile already. :) I fixed the issues you brought up, except the pkg-config one.


    The @GLES2_FLAGS@ and the -lX11missing are results from not using pkg-config. Would you look if you have pkg-config files with different names before I change that? Or maybe you have one for egl, but none for glesv2?


    GLchar is not supposed to be defined in gles2 I think, so I changed them to char.


    EDIT: And when you try to run games, you should use the options -d1 -a-1 to enable debug output and disable anti-aliasing (which is quite heavy on the gpu).
     
    Last edited by a moderator: Jan 15, 2012
  10. clop

    clop Member

    Joined:
    Aug 17, 2010
    Messages:
    176
    Hi,


    I tried to run two games (LifeFlashesBy and Out of Order) on the Pandora, and I got that:



    Code:
    
    Error: Bad file descriptor.
    
    SLUDGE v2.2.0 fatal error!
    
    Initialisation error! Something went wrong before we even got started!
    
    Conversion to Unicode failed. This can be fixed by recompiling the game in a current version of the SLUDGE Development Kit, but this error should never happen. Congratulations, you've found a bug in the SLUDGE engine! Please let us know about it.
    
    EGL Closed
    
    

    Any idea?
     
    Last edited by a moderator: Jan 15, 2012
  11. BigMc

    BigMc Still Fresh

    Joined:
    Jan 4, 2012
    Messages:
    32
    Hmm, seems like you found a Unicode bug. Unicode is also a brand new feature, but it was not done by me, so I'm not so familiar with it. To test if it works despite of this thing, you could install the SVN version of the Dev Kit on your Linux PC and compile the Verb Coin example from doc/ExampleProjects/VerbCoin with



    Code:
    
    sludge-compiler VerbCoin.slp
    
    

    Then try with that SLUDGE 2.2 game file.


    EDIT: Probably that encoding name that is used is not recognized by your implementation of iconv. I added a check to svn to make sure. Probably you just have to replace the "CP1250" in line 94 of fileset.cpp by "ISO8859-2".
     
    Last edited by a moderator: Jan 15, 2012
  12. TitanUranus

    TitanUranus Member

    Joined:
    Oct 6, 2009
    Messages:
    756
    Location:
    UK
    Once you get it up and running will you be good enough to post the actual binaries/files for me to try please. I can live without a PND version if that's a PITA? I'd love to try out some of these games they look really interesting.
     
  13. clop

    clop Member

    Joined:
    Aug 17, 2010
    Messages:
    176
    PND is ready already :D Just need to get a game to run...
     
  14. Farox

    Farox Certified Guru

    Joined:
    Jan 8, 2009
    Messages:
    1,788
    Location:
    Italy
    i'm looking to it too...thanks :)
     
  15. clop

    clop Member

    Joined:
    Aug 17, 2010
    Messages:
    176



    Ok, I tried that, a window apperaed and disapeared and:





    Code:
    
    Video mode 480 360 set succesfully
    
    EGL ERROR: Unable to query for available configs, found 0
    
    EGL ERROR: Unable to configure EGL/ See previous error.
    
    Segmentation fault
    
    
     
  16. mcobit

    mcobit Advanced Member

    Joined:
    Jul 28, 2008
    Messages:
    6,755
    Have a look at the eglimplementation. There seems to be something wrong. Maybe try to set screensize to 800 x 480?
     
  17. BigMc

    BigMc Still Fresh

    Joined:
    Jan 4, 2012
    Messages:
    32
    I changed the config to choose in eglport.cpp, because we need an alpha channel for some cases (at least parallax scrolling, not so common, but it's not drawn correctly without). To get back to the default eglport configuration (which was tested on Pandora), remove the lines



    Code:
    
    	ConfigAttribs[attrib++] = EGL_ALPHA_SIZE;
    
    	ConfigAttribs[attrib++] = 1;
    
    

    at line 322 and set the green size back to 6. Otherwise, does some Pandora expert know what EGL configurations with alpha channel are supported?
     
  18. mcobit

    mcobit Advanced Member

    Joined:
    Jul 28, 2008
    Messages:
    6,755
    No clue, but did you use pickles new eglport? That has some debugfeatures afaik.


    Maybe this could be useful.
     
  19. BigMc

    BigMc Still Fresh

    Joined:
    Jan 4, 2012
    Messages:
    32
    Yes, used the new one.


    EDIT: But what debug features do you mean? Checking for more errors?
     
    Last edited by a moderator: Jan 15, 2012
  20. clop

    clop Member

    Joined:
    Aug 17, 2010
    Messages:
    176
    With the modification on EGLPort, i've got a black window who, I suppose, steals my input (no way to switch windows or close it).



    Code:
    
    *** Engine compiled Jan 15 2012 at 18:35:31.
    
    Video mode 480 360 set successfully.
    
    Error loading "scale" shader program!
    
    Try re-installing the game. Advanced anti-aliasing is not possible. Using linear anti-aliasing instead.
    
    Error loading "fixScaleSprite" shader program!
    
    Try re-installing the game. The game will run anyway, but some graphics may be corrupted.
    
    Error loading "yuv" shader program!
    
    Try re-installing the game. It will run anyway, but any movies will be greyscale.
    
    Error loading "texture" shader program!
    
    Try re-installing the game. The game will run anyway, but some graphics may be corrupted.
    
    Error loading "color" shader program!
    
    Try re-installing the game. The game will run anyway, but some graphics may be corrupted.
    
    Max texture image units: 8
    
    Deleting texture while list is already empty.
    
    Deleting texture while list is already empty.
    
    loadBankForAnim: New sprite bank created OK
    
    Failed to create stream from MOD: Unsupported type
    
    SLUDGE v2.2.0 non-fatal indigestion report
    
    I can't load a music resource I've been told to play. Sorry.
    
    loadBankForAnim: New sprite bank created OK
    
    loadBankForAnim: New sprite bank created OK
    
    

    I attach a working install build of the sludge engine if someone wnats to play with it, cause I'm out until wednesday night for a work trip, (Madrid, woohooo).


    If someone wants to try to re-crosscompile it, it was a pretty easy one. Just need to compile openAl, alure and vpx and (for me) remove the GLES2_CFLAGS and replace GLES_LIBS by -lX11 in generated Makefile.
     

    Attached Files:

    Last edited by a moderator: Feb 6, 2016

Share This Page