libSDL for Ubuntu... Translucency broken?


TrevorBradley

Active Member
Joined
Nov 6, 2007
Messages
732
I'm wondering if some clever folk might be able to help me out with a Linux library issue I've been having.

The last time I was developing GA, I was working on a Slackware Linux system. Pretty much everything had to be installed by hand. The libs included in the libs/Linux directory of the binary work great on my new Ubuntu reinstall.

However, if I try a dynamic compile of GA, and run against Ubuntu's libs, there's something funky about the transparency.. It's easiest to see if you run the game and then hit ESC to quit... Take a look at the attached file...

I've managed to track this down to the libSDL library.... if I use the old version I had and replace libSDL, I get the broken translucency. If I revert back to the libSDL I had before, it works fine.

My system cliams to have libsdl1.2debian version 1.2.13-4ubuntu3 installed... I've recently upgraded to Jaunty. However, 1.2.13 is supposedly the same version I had installed on Slackware, so I'm a bit stumped.

The only thing I can think of is that my old Slackware libSDL-1.2.so is 1664794 bytes, the Ubuntu one is 430584 bytes... though I doubt I gave Slackware some weird compile option.

I tried hunting around google for anyone else who had this problem and couldn't find anything definitive. Perhaps I didn't ask right.

I could just recompile libSDL from scratch and use that, but it doesn't seem like the Ubuntu way. Anyone have any suggestions?

Thanks in advance!
 
Each distro may pull the same version of the software from upstream, but they each apply their own patches to get reported bugs fixed quickly (while they wait for upstream to release a stable version with the fix). It could be the version you're using has the fix, and Ubuntu's copy doesn't.
 
javaJake said:
Each distro may pull the same version of the software from upstream, but they each apply their own patches to get reported bugs fixed quickly (while they wait for upstream to release a stable version with the fix). It could be the version you're using has the fix, and Ubuntu's copy doesn't.

They're both version 1.2.13 though, which has confused the heck out of me.

I might just give up, do the evil Slackware thing and just replace the local .so file.. would be nice to know I'm not doing anything stupid as a coder though...
 
Ugh, even more frustrating, when I try to compile all the libSDL libs from scratch into /usr/local/lib, and then run my game against them, I get a segmentation fault:

Code:
trevor@pergamon:~/Projects/GalacticArtifact/trunk$ export LD_LIBRARY_PATH=/usr/local/lib/
trevor@pergamon:~/Projects/GalacticArtifact/trunk$ make clean
rm -f  *.o core GalacticArtifact 
trevor@pergamon:~/Projects/GalacticArtifact/trunk$ make
g++  -c StringParser.cc
g++  -c CaptainNames.cc
g++  -c SoundSystem.cc
g++  -c Font.cc
g++  -c NumberGenerator.cc
g++  -c KeyPressed.cc
g++  -c FrameTimer.cc
g++  -c Coords.cc
g++  -c Artifact.cc
g++  -c Ship.cc
g++  -c View.cc
g++  -c Star.cc
g++  -c Information.cc
g++  -c Messages.cc
g++  -c MessageBuffer.cc
g++  -c AlienInterface.cc
g++  -c ScreenSurface.cc
g++  -c ShipSurface.cc
g++  -c CargoSurface.cc
g++  -c MessageSurface.cc
g++  -c MinimapSurface.cc
g++  -c OverviewSurface.cc
g++  -c GalaxySurface.cc
g++  -c RadarSurface.cc
g++  -c AlienInterfaceSurface.cc
g++  -c InformationSurface.cc
g++  -c VictorySurface.cc
g++  -c VerifyQuitSurface.cc
g++  -c Crypto.cc
g++  -c NetworkEnvelope.cc
g++  -c NetworkConnection.cc
g++  -c GameServer.cc
g++  -c NetworkEvent.cc
g++  -c MenuInterface.cc
g++  -c MenuInterfaceSurface.cc
g++  -c GalacticArtifact.cc
g++ -g -o GalacticArtifact  StringParser.o CaptainNames.o SoundSystem.o Font.o NumberGenerator.o KeyPressed.o FrameTimer.o Coords.o Artifact.o Ship.o View.o Star.o  Information.o Messages.o MessageBuffer.o AlienInterface.o ScreenSurface.o ShipSurface.o CargoSurface.o MessageSurface.o MinimapSurface.o OverviewSurface.o GalaxySurface.o RadarSurface.o AlienInterfaceSurface.o InformationSurface.o VictorySurface.o VerifyQuitSurface.o Crypto.o NetworkEnvelope.o NetworkConnection.o GameServer.o NetworkEvent.o MenuInterface.o MenuInterfaceSurface.o GalacticArtifact.o -lsprig -lSDL_net -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_gfx -lSDL
trevor@pergamon:~/Projects/GalacticArtifact/trunk$ ./GalacticArtifact 
Segmentation fault
trevor@pergamon:~/Projects/GalacticArtifact/trunk$ gdb ./GalacticArtifact 
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) r
Starting program: /home/trevor/Projects/GalacticArtifact/trunk/GalacticArtifact 
[Thread debugging using libthread_db enabled]
[New Thread 0xb7c2c6d0 (LWP 1640)]
[New Thread 0xb7c2bb90 (LWP 1643)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7c2c6d0 (LWP 1640)]
SDL_Flip (screen=0x0) at ./src/video/SDL_video.c:1087
1087		if ( screen == SDL_ShadowSurface ) {
Current language:  auto; currently c

I'm well out of the programming/debugging groove.... I'll likely need some time to get up to speed.... :twisted:

EDIT: This is almost certainly a "compile dynamically against Ubuntu libs, run dynamically against locally compiled libs" issue... I have to figure out how to force g++ to compile dynamically against /usr/local/lib ONLY.
 
TrevorBradley said:
Ugh, even more frustrating, when I try to compile all the libSDL libs from scratch into /usr/local/lib, and then run my game against them, I get a segmentation fault:

Code:
trevor@pergamon:~/Projects/GalacticArtifact/trunk$ export LD_LIBRARY_PATH=/usr/local/lib/
trevor@pergamon:~/Projects/GalacticArtifact/trunk$ make clean
rm -f  *.o core GalacticArtifact 
trevor@pergamon:~/Projects/GalacticArtifact/trunk$ make
g++  -c StringParser.cc
g++  -c CaptainNames.cc
g++  -c SoundSystem.cc
g++  -c Font.cc
g++  -c NumberGenerator.cc
g++  -c KeyPressed.cc
g++  -c FrameTimer.cc
g++  -c Coords.cc
g++  -c Artifact.cc
g++  -c Ship.cc
g++  -c View.cc
g++  -c Star.cc
g++  -c Information.cc
g++  -c Messages.cc
g++  -c MessageBuffer.cc
g++  -c AlienInterface.cc
g++  -c ScreenSurface.cc
g++  -c ShipSurface.cc
g++  -c CargoSurface.cc
g++  -c MessageSurface.cc
g++  -c MinimapSurface.cc
g++  -c OverviewSurface.cc
g++  -c GalaxySurface.cc
g++  -c RadarSurface.cc
g++  -c AlienInterfaceSurface.cc
g++  -c InformationSurface.cc
g++  -c VictorySurface.cc
g++  -c VerifyQuitSurface.cc
g++  -c Crypto.cc
g++  -c NetworkEnvelope.cc
g++  -c NetworkConnection.cc
g++  -c GameServer.cc
g++  -c NetworkEvent.cc
g++  -c MenuInterface.cc
g++  -c MenuInterfaceSurface.cc
g++  -c GalacticArtifact.cc
g++ -g -o GalacticArtifact  StringParser.o CaptainNames.o SoundSystem.o Font.o NumberGenerator.o KeyPressed.o FrameTimer.o Coords.o Artifact.o Ship.o View.o Star.o  Information.o Messages.o MessageBuffer.o AlienInterface.o ScreenSurface.o ShipSurface.o CargoSurface.o MessageSurface.o MinimapSurface.o OverviewSurface.o GalaxySurface.o RadarSurface.o AlienInterfaceSurface.o InformationSurface.o VictorySurface.o VerifyQuitSurface.o Crypto.o NetworkEnvelope.o NetworkConnection.o GameServer.o NetworkEvent.o MenuInterface.o MenuInterfaceSurface.o GalacticArtifact.o -lsprig -lSDL_net -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_gfx -lSDL
trevor@pergamon:~/Projects/GalacticArtifact/trunk$ ./GalacticArtifact 
Segmentation fault
trevor@pergamon:~/Projects/GalacticArtifact/trunk$ gdb ./GalacticArtifact 
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) r
Starting program: /home/trevor/Projects/GalacticArtifact/trunk/GalacticArtifact 
[Thread debugging using libthread_db enabled]
[New Thread 0xb7c2c6d0 (LWP 1640)]
[New Thread 0xb7c2bb90 (LWP 1643)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7c2c6d0 (LWP 1640)]
SDL_Flip (screen=0x0) at ./src/video/SDL_video.c:1087
1087		if ( screen == SDL_ShadowSurface ) {
Current language:  auto; currently c

I'm well out of the programming/debugging groove.... I'll likely need some time to get up to speed.... :twisted:

EDIT: This is almost certainly a "compile dynamically against Ubuntu libs, run dynamically against locally compiled libs" issue... I have to figure out how to force g++ to compile dynamically against /usr/local/lib ONLY.

To compile against your local copy of SDL you need to make sure you specify your include and library paths to your local compiled SDL. By specifying -I and -L like below it tells the compiler and linker to use those directories first before looking in your standard include and library directories.

In your makefile you would set your CPPFLAGS to contain -I/usr/local/include/SDL and LDFLAGS to contain -L/usr/local/lib/SDL

exporting LD_LIBRARY_PATH should not be necessary once you make these changes.

The output of make should look more like this.
g++ -I/usr/local/include/SDL -c GalacticArtifact.cc
g++ -g -o GalacticArtifact StringParser.o CaptainNames.o SoundSystem.o Font.o NumberGenerator.o KeyPressed.o FrameTimer.o Coords.o Artifact.o Ship.o View.o Star.o Information.o Messages.o MessageBuffer.o AlienInterface.o ScreenSurface.o ShipSurface.o CargoSurface.o MessageSurface.o MinimapSurface.o OverviewSurface.o GalaxySurface.o RadarSurface.o AlienInterfaceSurface.o InformationSurface.o VictorySurface.o VerifyQuitSurface.o Crypto.o NetworkEnvelope.o NetworkConnection.o GameServer.o NetworkEvent.o MenuInterface.o MenuInterfaceSurface.o GalacticArtifact.o -L/usr/local/lib/SDL -lsprig -lSDL_net -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_gfx -lSDL
 
I followed this up with the folks on the SDL mailing list, and the problem was I didn't have the x11 dev libraries installed (libxext-dev), and SDL was compiling only for framebuffer. Instant segfault.

It's all compiled and running and... the home-compiled versions of SDL have the same visual glitch as the default ubuntu libraries. Poo.

I'm pretty sure I'm missing some sort of critical library that SDL needs to compile alpha-blending into it, but I don't have the foggiest what library that might be.
 
Can't you just compile with SDL and OpenGL ES 2.0 support? That way you could use the PVR emulator and see how it would probably look like on a real Pandora.
I'm not into SDL so that might not be possible yet or so, but its just an idea.
 
JayFoxRox said:
Can't you just compile with SDL and OpenGL ES 2.0 support? That way you could use the PVR emulator and see how it would probably look like on a real Pandora.
I'm not into SDL so that might not be possible yet or so, but its just an idea.

That would probably mean re-writing the game from scratch. At least the graphic rendering bits. I think I'm going to wait until I have a pandora in my hands before I attempt that kind of optimization.

In other news, there's nothing like stripping a program down to it's bare elements to figure out what's going on. Eventually, I figured out that my graphical glitch went away when I went to a 24 bit colour palette. I'm totally stumped as to why this would happen. The game was always intended to be 16 bit colour.. in fact switching it to 24 breaks the border recognition for for the excluded space regions.
 
is your card driver faking 24 bit?, some do, it may be a driver/lib conflict, iirc ATI cards fake some modes...may be wrong though, it`s been a while since I coded anything that low level.
 
hobbyman III said:
is your card driver faking 24 bit?, some do, it may be a driver/lib conflict, iirc ATI cards fake some modes...may be wrong though, it`s been a while since I coded anything that low level.

This doesn't make sense, as I have my old Slackware libSDL which works just fine with my system. If it was broken across the board I'd totally suspect my NVIDIA video driver.
 
Funny thing, I experienced an exact same looking bug in pygame, when I set a surface to alpha 128. FTR I was using an nvidia card under ubuntu x86.

EDIT: Moreover, it reacted very curiously when I put my mouse cursor over it.
 
Back
Top