Jump to content

Errors building and running SDL2/GLES2 Linux version


vanfanel

Recommended Posts

Hi!

 

This is the first time I try to build this engine, and I found some problems in the proccess, following the instructions on INSTALL text file.

I am building the latest GIT version, maybe it's a bad idea?

First, used cmake like this in my build dir:

 

cmake .. -DUSE_OPENGL=2 -DUSE_SDL2=1 -DDISABLE_WERROR=1

 

I found that there's an error on file name in OpenGLEnv.h, since it looks for GLES2/GL2.h instead of GLES2/gl2.h that is the usual name for this header.

 

After that, build process completed, and I ran "sudo make install" but I get this error on run:

manuel@vader:~$ gemrb
[Core]: GemRB Core Version v0.8.4-git Loading...
[Core]: Initializing the Event Manager...
[Core]: Starting Plugin Manager...
[PluginMgr]: Loading Plugins from /usr/local/lib/gemrb/plugins
[PluginLoader]: Loaded plugin "TLK File Importer" (TLKImporter.so).
[PluginLoader]: Loaded plugin "SDL2 GL Video Driver" (SDLVideo.so).
[PluginLoader]: Loaded plugin "SDL Audio Driver" (SDLAudio.so).
[PluginLoader]: Loaded plugin "BIF File Importer" (BIFImporter.so).
[PluginLoader]: Loaded plugin "ITM File Importer" (ITMImporter.so).
[PluginLoader]: Loaded plugin "PNG File Importer" (PNGImporter.so).
[PluginLoader]: Loaded plugin "ZLib Compression Manager" (ZLibManager.so).
[PluginLoader]: Loaded plugin "Null Sound Driver" (NullSound.so).
[PluginLoader]: Loaded plugin "Effect opcodes for the torment branch of the games" (PSTOpcodes.so).
[PluginLoader]: Loaded plugin "SAV File Importer" (SAVImporter.so).
[PluginLoader]: Loaded plugin "BMP File Writer" (BMPWriter.so).
[PluginLoader]: Loaded plugin "MUS File Importer" (MUSImporter.so).
[PluginLoader]: Loaded plugin "PLT File Importer" (PLTImporter.so).
[PluginLoader]: Loaded plugin "WAV File Importer" (WAVReader.so).
[PluginLoader]: Loaded plugin "KEY File Importer" (KEYImporter.so).
[PluginLoader]: Loaded plugin "WED File Importer" (WEDImporter.so).
[PluginLoader]: Loaded plugin "Effect opcodes for the icewind branch of the games" (IWDOpcodes.so).
[PluginLoader]: Loaded plugin "PRO File Importer" (PROImporter.so).
[PluginLoader]: Loaded plugin "2DA File Importer" (2DAImporter.so).
[PluginLoader]: Loaded plugin "SPL File Importer" (SPLImporter.so).
[PluginLoader]: Loaded plugin "STO File Importer" (STOImporter.so).
[PluginLoader]: Loaded plugin "ACM File Importer" (ACMReader.so).
[PluginLoader]: Loaded plugin "BAM File Importer" (BAMImporter.so).
[PluginLoader]: Loaded plugin "Null Resource Source" (NullSource.so).
[PluginLoader]: Loaded plugin "BMP File Reader" (BMPImporter.so).
[PluginLoader]: Loaded plugin "MOS File Importer" (MOSImporter.so).
[PluginLoader]: Loaded plugin "IDS File Importer" (IDSImporter.so).
[PluginLoader]: Loaded plugin "TTF Font Importer" (TTFImporter.so).
[PluginLoader]: Loaded plugin "GUI Script Engine (Python)" (GUIScript.so).
[PluginLoader]: Loaded plugin "Effect opcodes for core games" (FXOpcodes.so).
[PluginLoader]: Loaded plugin "INI File Importer" (INIImporter.so).
[PluginLoader]: Loaded plugin "TIS File Importer" (TISImporter.so).
[PluginLoader]: Loaded plugin "MVE Video Player" (MVEPlayer.so).
[PluginLoader]: Loaded plugin "CRE File Importer" (CREImporter.so).
[PluginLoader]: Loaded plugin "WMP File Importer" (WMPImporter.so).
[PluginLoader]: Loaded plugin "CHU File Importer" (CHUImporter.so).
[PluginLoader]: Loaded plugin "ARE File Importer" (AREImporter.so).
[PluginLoader]: Loaded plugin "OGG File Importer" (OGGReader.so).
[PluginLoader]: Loaded plugin "Directory Importer" (DirectoryImporter.so).
[PluginLoader]: Loaded plugin "DLG File Importer" (DLGImporter.so).
[PluginLoader]: Loaded plugin "GAM File Importer" (GAMImporter.so).
[PluginLoader]: Loaded plugin "BIK Video Player" (BIKPlayer.so).
[PluginLoader]: Loaded plugin "EFF File Importer" (EFFImporter.so).
[Core]: Plugin Loading Complete...
[Core]: GemRB Core Initialization...
[Core]: Initializing Video Driver...
[SDL 2 GL Driver]: Creating display
[SDL 2 GL Driver]: Creating Main Surface: w=0 h=0 fmt=SDL_PIXELFORMAT_RGBA8888
[SDL 2 GL Driver/FATAL]: Can't build shader program: 0:1(1): error: syntax error, unexpected NEW_IDENTIFIER

[Core/FATAL]: Cannot initialize shaders.
[Main]: Press enter to continue...

Any idea on what is going on here? Seems to be a syntax problem with the shaders, but seems strange to me.

Link to comment

The gl backends are experimental, but thanks for the notice. I'd try with -DUSE_OPENGL=1 or if you want to actually play something, use the sdl1 backend.

 

Thanks lynx, but I was trying this to build for the Raspberry Pi after I get it running on the PC, and the Pi is GLES only, and SDL2-only since SDL1 is broken there, and SDL2 works great since it has full Raspberry Pi support.

I take GL/GLES is not mandatory and plain-SDL2 support (surface/texture) is used instead if -DUSE_OPENGL=2 is not passed?

 

EDIT: passing these to cmake did the trick, no more shader errors:

 

cmake .. -DUSE_OPENGL=0 -DUSE_SDL2=1 -DDISABLE_WERROR=1

 

Anyway, GLES support will be important for the Pi (weak CPU, strong GPU), I hope it works someday :)

Link to comment

@lynx, after making it work with plain-SDL2, I get cursor problems on the tittle screen in menus: the cursor is not cleared after each movement so it just overwrites all the screen and makes the game very hard to use:

 

https://www.dropbox.com/s/g9700tbtzg1aai7/2016-03-08-195443_1366x768_scrot.png?dl=0

 

So, I take the plain SDL2 backend is still unfinished/buggy, isn't it?

I've also built an SDL1 version and the error is not there, but without SDL2 the game isn't Pi-ready :(

Link to comment

That is a known problem, though Syntax Error says it's not that hard to fix. We started the sdl2 port to get mobile convergence, so mainly for touch devices — there the cursor is hidden. But yeah, a long-standing issue. Everything else should be fine. You could disable cursors in the config (MouseFeedback), but I'm pretty sure it would become hard to play.

Link to comment

When I say "its not that hard to fix" it is because I'm speaking about my development branch where the UI hierarchy was rewritten completely and the cursors arent hacked into the video driver. In fact it *is* fixed in that branch, but there is much to do before that branch would be usable by anybody that actually wanted to play anything.

 

After the semester ends I'll once again have some free time to work on that over the summer so hopefully get that merged (or at least somewhere people can use it) by the start of the fall semester.

Link to comment

@lynx it seems to work well now, the cursor looks good on SDL2 after that PR!

However, I find something I dont understand: If I use the sdlaudio plugin (I don't want to use OpenAL if I can avoid it, as it's slow on the Pi), the audio lags behind video A LOT. However, using OpenAL it's not lagging.

Many other games use SDL2/SDL_Mixer for audio with no noticeable lag. Maybe you're using a too large buffer for the sample rates or something like that? Any paramer in code I can experiment with?

Link to comment

that's odd, it should be the reverse. Audio is even done in a separate thread. I haven't tried sdl2_mixer in ages though, so I can't say I've /heard/ of this problem. Do you also hit it on a desktop?

 

the plugin is small, I'd start there.

Link to comment

well, then something went bad in its port to sdl2, as the version for sdl1 worked fine. Only our mobile platforms use sdl2 by default and they use openal, so the plugin built against sdl2_mixer probably got zero testing — until you came along.

Link to comment

@lynx: I seem to have found the cause. Since you're initializing audio with a playback rating of just 22050Hz, the 8192 buffer size is too big, so audio buffer takes too much time to be used up, so there is this lag.

Simply changed:

 

if (Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 8192) < 0) {

 

to

 

if (Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 512) < 0) {

 

in gemrb/plugins/SDLAudio/SDLAudio.cpp, and I don't have any more audio lag with the SDLAudio plugin.

I would consider merging, but I don't know if it's a "good enough" fix, or why you went with 8192 to start with, it's VERY high for 22050Hz audio...

 

EDIT: I have also found that some effects in BG1, like birds or music from the tavern, are missing with SDLAudio, while they are audible with OpenAL. Is this a know issue?

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...