From 10125caa7fc2ad7c7641a99734ed2c0c31164da1 Mon Sep 17 00:00:00 2001 From: sukibaby <163092272+sukibaby@users.noreply.github.com> Date: Thu, 8 Aug 2024 01:34:13 -0700 Subject: [PATCH] Remove GLU dependency gluGetString, gluBuild2DMipmaps, and gluErrorString are all functions from the GLU library, which is not part of OpenGL. This lets the game run without libGLU1 (or whatever it's called on a given distro). Update README.md --- README.md | 6 +++--- src/RageDisplay_OGL.cpp | 45 +++++++++++++++++------------------------ 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index f1c078eb2c..0642bb5ca2 100644 --- a/README.md +++ b/README.md @@ -44,11 +44,11 @@ You can choose between using the installer or using the portable build. Using th * **Debian-based**: - * `sudo apt install libgdk-pixbuf-2.0-0 libgl1 libglu1-mesa libglvnd0 libgtk-3-0 libusb-0.1-4 libxinerama1 libxtst6` + * `sudo apt install libgdk-pixbuf-2.0-0 libgl1 libglvnd0 libgtk-3-0 libusb-0.1-4 libxinerama1 libxtst6` * **Fedora-based**: - * `sudo yum install gdk-pixbuf2 mesa-libGLU gtk3 libusb-compat-0.1 libXinerama libXtst` + * `sudo yum install gdk-pixbuf2 gtk3 libusb-compat-0.1 libXinerama libXtst` * **Arch Linux**: @@ -56,7 +56,7 @@ You can choose between using the installer or using the portable build. Using th * **OpenSUSE**: - * `sudo zypper install libGLU1` + * OpenSUSE comes with everything you need pre-installed. ### Build From Source diff --git a/src/RageDisplay_OGL.cpp b/src/RageDisplay_OGL.cpp index c529133407..b1da902266 100644 --- a/src/RageDisplay_OGL.cpp +++ b/src/RageDisplay_OGL.cpp @@ -484,12 +484,11 @@ RString RageDisplay_Legacy::Init( const VideoModeParams &p, bool bAllowUnacceler // Log driver details g_pWind->LogDebugInformation(); - LOG->Info( "OGL Vendor: %s", glGetString(GL_VENDOR) ); - LOG->Info( "OGL Renderer: %s", glGetString(GL_RENDERER) ); - LOG->Info( "OGL Version: %s", glGetString(GL_VERSION) ); - LOG->Info( "OGL Max texture size: %i", GetMaxTextureSize() ); - LOG->Info( "OGL Texture units: %i", g_iMaxTextureUnits ); - LOG->Info( "GLU Version: %s", gluGetString(GLU_VERSION) ); + LOG->Info("OGL Vendor: %s", reinterpret_cast(glGetString(GL_VENDOR))); + LOG->Info("OGL Renderer: %s", reinterpret_cast(glGetString(GL_RENDERER))); + LOG->Info("OGL Version: %s", reinterpret_cast(glGetString(GL_VERSION))); + LOG->Info("OGL Max texture size: %i", GetMaxTextureSize()); + LOG->Info("OGL Texture units: %i", g_iMaxTextureUnits); /* Pretty-print the extension string: */ LOG->Info( "OGL Extensions:" ); @@ -2288,38 +2287,30 @@ std::uintptr_t RageDisplay_Legacy::CreateTexture( ASSERT( iRealFormat == GL_RGBA8 ); } - LOG->Trace( "%s (format %s, %ix%i, format %s, type %s, pixfmt %i, imgpixfmt %i)", - bGenerateMipMaps? "gluBuild2DMipmaps":"glTexImage2D", + LOG->Trace("%s (format %s, %ix%i, format %s, type %s, pixfmt %i, imgpixfmt %i)", + "glTexImage2D", GLToString(glTexFormat).c_str(), pImg->w, pImg->h, GLToString(glImageFormat).c_str(), - GLToString(glImageType).c_str(), pixfmt, SurfacePixFmt ); + GLToString(glImageType).c_str(), pixfmt, SurfacePixFmt); DebugFlushGLErrors(); - if (bGenerateMipMaps) - { - GLenum error = gluBuild2DMipmaps( - GL_TEXTURE_2D, glTexFormat, + glTexImage2D( + GL_TEXTURE_2D, 0, glTexFormat, + power_of_two(pImg->w), power_of_two(pImg->h), 0, + glImageFormat, glImageType, nullptr ); + if (pImg->pixels) + glTexSubImage2D( GL_TEXTURE_2D, 0, + 0, 0, pImg->w, pImg->h, glImageFormat, glImageType, pImg->pixels ); - ASSERT_M( error == 0, (char *) gluErrorString(error) ); - } - else - { - glTexImage2D( - GL_TEXTURE_2D, 0, glTexFormat, - power_of_two(pImg->w), power_of_two(pImg->h), 0, - glImageFormat, glImageType, nullptr ); - if (pImg->pixels) - glTexSubImage2D( GL_TEXTURE_2D, 0, - 0, 0, - pImg->w, pImg->h, - glImageFormat, glImageType, pImg->pixels ); - DebugAssertNoGLError(); + if (bGenerateMipMaps) { + glGenerateMipmap(GL_TEXTURE_2D); } + DebugAssertNoGLError(); /* Sanity check: */ if (pixfmt == RagePixelFormat_PAL)