rss feed: Latest Entries | Archive
2019.03.20 @ 10:36:00 GLideN64 with intel graphics on ubuntu 18.04

GLideN64 is an actively developed graphics rendering plugin for Nintendo-64 emulators. However, making it work on the latest ubuntu version with intel graphics isn't particularly straight forward, and took me a good bit of research to figure it out. So I'm writing this up for my future self and anyone else who might want some help along the way. Most of this post will be helpful to anyone trying to compile it regardless of your graphics adapter too.

If you haven't already, first install mupen64plus, this is in the ubuntu software center or see the top of the script to follow). You'll also want to fetch and install m64py, fetch the latest version .deb for Ubuntu/Debian from the m64py homepage.

Next you need to get the GLideN64 source and compile it. There is a wiki page with instructions, or to save you the trouble you can copy/paste the following into a script and run it.

#!/bin/bash

# This script assumes you've installed mupen64plus already.  If not, do this first:
# sudo apt-get -y install mupen64plus-qt

# For folks using mesa (intel) graphics, you'll need to modify whatever you're using to launch mupen to set this environment variable:
# MESA_GL_VERSION_OVERRIDE=3.3COMPAT
# For me, I set this before running m64py.

export TARGET_CPU=amd64
export CC=gcc
export CXX=g++
export BUILD_CONFIGURATION=Release

# Most of this is straight from https://github.com/gonetz/GLideN64/wiki/Build-From-Source-(Linux)
set -e # Exit if anything fails

sudo apt-get -y install git gcc g++ cmake libgl1-mesa-dev libfreetype6-dev libmupen64plus-dev zlib1g-dev

# If we're running this again, then update to the latest source.
if [[ -d GLideN64 ]]; then
    pushd GLideN64
    git pull
else
    git clone https://github.com/gonetz/GLideN64.git
    pushd GLideN64
fi

chmod +x src/getRevision.sh
src/getRevision.sh

mkdir -p projects/cmake
pushd projects/cmake/
cmake -DCMAKE_BUILD_TYPE=Release -DTARGET_CPU=amd64 -DVEC4_OPT=On -DMUPENPLUSAPI=On ../../src/
cmake --build .

# Now it's built, install it.  This line is very specific to 18.04 & x86 specific and, again, assumes mupen64plus is already installed.
# If you're on a different platform you'll need to modify this (or do it manually):
sudo cp plugin/Release/mupen64plus-video-GLideN64.so /usr/lib/x86_64-linux-gnu/mupen64plus/mupen64plus-video-GLideN64.so

popd
popd

Now you're almost there, take note at the start of the script about the environment variable. Without doing this, for intel graphics, I ended up with a no graphics being rendered at all -- just a black screen when I tried to load a game. This last step works around that and requires modifying the m64py launcher. If you're using KDE I had success at simplify editing the launcher directly. On xfce I created this small script which I placed in a "bin" directory I keep under my home dir for such things. Create a file ~/bin/m64py with the entire contents:

MESA_GL_VERSION_OVERRIDE=3.3COMPAT /usr/games/m64py
and make it executable
chmod +x ~/bin/m64py
Finally, change the m64py launcher to run this script instead of m64py directly.

Finally, run m64py and you should be able to now switch the graphics plugin to use the GLideN64 .so that we copied at the end of the compile script. Happy gaming!