Ioquake compiled on Raspberry Pi 2 runs with black screen from the console

I’m unable to get ioquake3 to run with video. The program runs with a black screen, but the sounds run fine. I have to quit by blindly entering the console and typing /quit.

I have compiled SDL2 with the following PKGBUILD for Arch Linux. This file has been altered from the original:

# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Modified by Fred Morcos <fred.morcos@gmail.com> for the Raspberry Pi
pkgname=sdl2
pkgver=2.0.3
pkgrel=1
pkgdesc="A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard (Version 2)"
arch=('i686' 'x86_64' 'armv7h')
url="http://www.libsdl.org"
license=('MIT')
depends=('glibc' 'libxext' 'libxrender' 'libx11' 'libgl' 'libxcursor')
makedepends=('alsa-lib' 'mesa' 'libxrandr' 'libxinerama' 'wayland' 'libxkbcommon')
optdepends=('alsa-lib: ALSA audio driver'
            'libpulse: PulseAudio audio driver')
source=("http://www.libsdl.org/release/SDL2-${pkgver}.tar.gz")
md5sums=('fe6c61d2e9df9ef570e7e80c6e822537')

prepare() {
  mkdir -p build
}

export CC="gcc -I/opt/vc/include -I/usr/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -L/opt/vc/lib"

build() {
  cd build
    ../SDL2-$pkgver/configure --prefix=/usr \
    --host=arm-raspberry-linux-gnueabihf \
    --enable-sdl-dlopen \
    --disable-arts --disable-esd --disable-nas \
    --enable-alsa \
    --disable-pulseaudio \
    --disable-video-wayland \
    --without-x --disable-video-x11 --disable-x11-shared \
    --disable-video-x11-xcursor --disable-video-x11-xinerama \
    --disable-video-x11-xinput --disable-video-x11-xrandr \
    --disable-video-x11-scrnsaver --disable-video-x11-xshape \
    --disable-video-x11-vm --disable-video-opengl \
    --disable-video-directfb --enable-video-opengles \
    --enable-video-dummy \
    --disable-rpath
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
  install -Dm644 ../SDL2-$pkgver/COPYING.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

I am attempting to use the build_rpi_rasbian script that I found and slightly modified. The original is here: https://github.com/raspberrypi/quake3/blob/master/build_rpi_raspbian.sh

#!/bin/bash
# this script builds q3 with SDL
# invoke with ./build.sh
# or ./build.sh clean to clean before build

# directory containing the ARM shared libraries (rootfs, lib/ of SD card)
# specifically libEGL.so and libGLESv2.so
ARM_LIBS=/opt/vc/lib
SDL_LIB=lib

# directory containing baseq3/ containing .pk3 files - baseq3 on CD
BASEQ3_DIR="/home/${USER}/"

# directory to find khronos linux make files (with include/ containing
# headers! Make needs them.)
#INCLUDES="-I/opt/bcm-rootfs/opt/vc/include -I/opt/bcm-rootfs/opt/vc/include/interface/vcos/pthreads"

## rpi version
INCLUDES="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads"

# prefix of arm cross compiler installed
## commented out for rpi
#CROSS_COMPILE=bcm2708-

# clean
if [ $# -ge 1 ] && [ $1 = clean ]; then
   echo "clean build"
   rm -rf build/*
fi

# sdl not disabled
make -j4 -f Makefile COPYDIR="$BASEQ3_DIR" ARCH=arm \
        CC=""$CROSS_COMPILE"gcc" USE_SVN=0 USE_CURL=0 USE_OPENAL=0 \
        CFLAGS="-DVCMODS_MISC -DVCMODS_OPENGLES -DVCMODS_DEPTH -DVCMODS_REPLACETRIG $INCLUDES" \
        LDFLAGS="-L"$ARM_LIBS" -L$SDL_LIB -lSDL2 -lvchostif -lvmcs_rpc_client -lvcfiled_check \
                -lbcm_host -lkhrn_static -lvchiq_arm -lopenmaxil -lEGL -lGLESv2 -lvcos -lrt -pthread"

# copy the required pak3 files over
# cp "$BASEQ3_DIR"/baseq3/*.pk3 "build/release-linux-arm/baseq3/"
# cp -a lib build/release-linux-arm/baseq3/
exit 0

I had to prepend “SDL2/” to the source code files that complained about missing libraries during the compile. These are in ioq3/code/sys/sys_loadlib.h and ioq3/code/sdl/sdl_input.h. Other than that, the source is the same.

Here is the output of ioquake3:

ioq3 1.36_GIT_c4f5176-2015-02-18 linux-arm Feb 27 2015
----- FS_Startup -----
Current search path:
/home/pi/.q3a/baseq3
./baseq3
./baseq3/pak8.pk3 (9 files)
./baseq3/pak7.pk3 (4 files)
./baseq3/pak6.pk3 (64 files)
./baseq3/pak5.pk3 (7 files)
./baseq3/pak4.pk3 (272 files)
./baseq3/pak3.pk3 (4 files)
./baseq3/pak2.pk3 (148 files)
./baseq3/pak1.pk3 (26 files)
./baseq3/pak0.pk3 (3539 files)

----------------------
4073 files in pk3 files
execing default.cfg
execing q3config.cfg
couldn't exec autoexec.cfg
Hunk_Clear: reset the hunk ok
----- Client Initialization -----
----- Initializing Renderer ----
Trying to load "renderer_opengl1_arm.so" from "."...
-------------------------------
QKEY found.
----- Client Initialization Complete -----
----- R_Init -----
SDL using driver "RPI"
Initializing OpenGL display
Display aspect: 1.778
...setting mode 3: 640 480
Using 24 color bits, 24 depth, 8 stencil display.
Available modes: '1920x1080'
GL_RENDERER: VideoCore IV HW
Initializing OpenGL extensions
...GL_EXT_texture_compression_s3tc not found
...GL_S3_s3tc not found
...GL_EXT_texture_env_add not found
...GL_ARB_multitexture not found
...GL_EXT_compiled_vertex_array not found
...GL_EXT_texture_filter_anisotropic not found
glGetError 0x500
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
glGetError 0x502
Initializing Shaders
glGetError 0x502
glGetError 0x502

GL_VENDOR: Broadcom
GL_RENDERER: VideoCore IV HW
GL_VERSION: OpenGL ES 2.0
GL_EXTENSIONS: GL_OES_compressed_ETC1_RGB8_texture GL_OES_compressed_paletted_texture GL_OES_texture_npot GL_OES_depth24 GL_OES_vertex_half_float GL_OES_EGL_image GL_OES_EGL_image_external GL_EXT_discard_framebuffer GL_OES_rgb8_rgba8 GL_OES_depth32 GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_APPLE_rgb_422 GL_EXT_debug_marker
GL_MAX_TEXTURE_SIZE: 2048
GL_MAX_TEXTURE_UNITS_ARB: 0

PIXELFORMAT: color(24-bits) Z(24-bit) stencil(8-bits)
MODE: 3, 640 x 480 fullscreen hz:N/A
GAMMA: software w/ 0 overbright bits
rendering primitives: multiple glArrayElement
texturemode: GL_LINEAR_MIPMAP_NEAREST
picmip: 1
texture bits: 0
multitexture: disabled
compiled vertex arrays: disabled
texenv add: disabled
compressed textures: disabled
----- finished R_Init -----
glGetError 0x502
------ Initializing Sound ------
SDL_Init( SDL_INIT_AUDIO )... OK
SDL audio driver is "alsa".
SDL_AudioSpec:
  Format:   AUDIO_S16LSB
  Freq:     22050
  Samples:  512
  Channels: 2
Starting SDL audio callback...
SDL audio initialized.
----- Sound Info -----
    1 stereo
16384 samples
   16 samplebits
    1 submission_chunk
22050 speed
0x206ea18 dma buffer
No background file.
----------------------
Sound initialization successful.
--------------------------------
Sound memory manager started
Loading vm file vm/ui.qvm...
File "vm/ui.qvm" found in "./baseq3/pak8.pk3"
Architecture doesn't have a bytecode compiler, using interpreter
ui loaded in 2348480 bytes on the hunk
35 arenas parsed
32 bots parsed
glGetError 0x502
glGetError 0x502
--- Common Initialization Complete ---
IP: 127.0.0.1
IP: 192.168.1.36
IP6: ::1
IP6: fe80::ba27:ebff:fee7:63a7%eth0
Opening IP6 socket: [::]:27960
Opening IP socket: 0.0.0.0:27960
]/quit
----- Client Shutdown (Client quit) -----
RE_Shutdown( 1 )
Hunk_Clear: reset the hunk ok
Closing SDL audio device...
SDL audio device shut down.
-----------------------

ioquake3 will compile fine and run fine without the build_rpi_rasbian script, but it is very slow.

Is there some other way I can get this to run with the OpenGLES libraries included with the Raspberry Pi 2?

Thank you for any help!

We don’t have an official GLES branch or renderer yet, so unfortunately you’re left to the various ioquake3 forks for that. The last good one I was familiar with was kwaak3 for android but that has not been updated in years. https://code.google.com/p/kwaak3/

The glGetError 0x502 means OpenGL is out of memory. Try increasing the Raspberry Pi’s GPU memory in the main / GPU memory split. Probably need to add gles render code though.

I went ahead and increased the split to 384 MB but I got the same error. I get 0x0500, 0x0501 and 0x0502, and some of those are illegal instructions if I’m reading the descriptions right.

The executable runs fine if you are blind. :slight_smile:

I have the free time, but I don’t have the ability to fix this and contribute. I am not familiar with OpenGL, and that seems to be the first step to take. Then, I’d have to learn OpenGL ES, which seems to be markedly different. I looked at a free class at MIT Courseware on graphics, but it only loosely introduces OpenGL. Most of the work I’ve done in programming concerns databases.

Try using this fork of ioq3:

You also need the libudev development package

You will need to compile SDL2 yourself with these configure options:

./configure --host=armv7l-raspberry-linux-gnueabihf --disable-video-x11 --disable-video-opengl

Good luck.