[ioquake3] 15/33: Support parsing OpenGL ES version strings

Simon McVittie smcv at debian.org
Mon Oct 30 14:00:26 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository ioquake3.

commit da07a6dbd9e391194720a45ab995b2954a72f307
Author: Zack Middleton <zack at cloemail.com>
Date:   Sun Oct 1 22:53:21 2017 -0500

    Support parsing OpenGL ES version strings
    
    The renderers don't support OpenGL ES though.
---
 code/renderercommon/qgl.h |  2 ++
 code/sdl/sdl_glimp.c      | 24 +++++++++++++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/code/renderercommon/qgl.h b/code/renderercommon/qgl.h
index 29fee3e..ab9c35c 100644
--- a/code/renderercommon/qgl.h
+++ b/code/renderercommon/qgl.h
@@ -306,6 +306,8 @@ QGL_EXT_direct_state_access_PROCS;
 #undef GLE
 
 extern int qglMajorVersion, qglMinorVersion;
+extern int qglesMajorVersion, qglesMinorVersion;
 #define QGL_VERSION_ATLEAST( major, minor ) ( qglMajorVersion > major || ( qglMajorVersion == major && qglMinorVersion >= minor ) )
+#define QGLES_VERSION_ATLEAST( major, minor ) ( qglesMajorVersion > major || ( qglesMajorVersion == major && qglesMinorVersion >= minor ) )
 
 #endif
diff --git a/code/sdl/sdl_glimp.c b/code/sdl/sdl_glimp.c
index b52da43..11b291c 100644
--- a/code/sdl/sdl_glimp.c
+++ b/code/sdl/sdl_glimp.c
@@ -54,6 +54,7 @@ cvar_t *r_centerWindow;
 cvar_t *r_sdlDriver;
 
 int qglMajorVersion, qglMinorVersion;
+int qglesMajorVersion, qglesMinorVersion;
 
 void (APIENTRYP qglActiveTextureARB) (GLenum texture);
 void (APIENTRYP qglClientActiveTextureARB) (GLenum texture);
@@ -239,7 +240,7 @@ static qboolean GLimp_GetProcAddresses( void ) {
 	}
 #endif
 
-	// OpenGL 1.0
+	// OpenGL 1.0 and OpenGL ES 1.0
 	GLE(const GLubyte *, GetString, GLenum name)
 
 	if ( !qglGetString ) {
@@ -252,17 +253,28 @@ static qboolean GLimp_GetProcAddresses( void ) {
 		Com_Error( ERR_FATAL, "GL_VERSION is NULL\n" );
 	}
 
-	sscanf( version, "%d.%d", &qglMajorVersion, &qglMinorVersion );
+	if ( Q_stricmpn( "OpenGL ES", version, 9 ) == 0 ) {
+		char profile[6]; // ES, ES-CM, or ES-CL
+		sscanf( version, "OpenGL %5s %d.%d", profile, &qglesMajorVersion, &qglesMinorVersion );
+		// common lite profile (no floating point) is not supported
+		if ( Q_stricmp( profile, "ES-CL" ) == 0 ) {
+			qglesMajorVersion = 0;
+			qglesMinorVersion = 0;
+		}
+	} else {
+		sscanf( version, "%d.%d", &qglMajorVersion, &qglMinorVersion );
+	}
 
-	// require OpenGL 1.1
-	if ( QGL_VERSION_ATLEAST( 1, 1 ) ) {
+	// require OpenGL 1.1 or OpenGL ES 1.0
+	// FIXME: Not all of these functions are available in OpenGL ES
+	if ( QGL_VERSION_ATLEAST( 1, 1 ) /*|| QGLES_VERSION_ATLEAST( 1, 0 )*/ ) {
 		QGL_1_0_PROCS;
 		QGL_1_1_PROCS;
 	} else {
 		Com_Error( ERR_FATAL, "Unsupported OpenGL Version: %s\n", version );
 	}
 
-	if ( QGL_VERSION_ATLEAST( 3, 0 ) ) {
+	if ( QGL_VERSION_ATLEAST( 3, 0 ) || QGLES_VERSION_ATLEAST( 3, 0 ) ) {
 		QGL_3_0_PROCS;
 	}
 
@@ -283,6 +295,8 @@ static void GLimp_ClearProcAddresses( void ) {
 
 	qglMajorVersion = 0;
 	qglMinorVersion = 0;
+	qglesMajorVersion = 0;
+	qglesMinorVersion = 0;
 
 	QGL_1_0_PROCS;
 	QGL_1_1_PROCS;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git



More information about the Pkg-games-commits mailing list