From 00dd504c72e7af8a171a07a952b03bc38982780a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Sep 1999 23:47:09 +0000 Subject: moved gl_GetString() into get.c --- src/mesa/main/get.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/get.c') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 65a682c547..90d6deb913 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */ +/* $Id: get.c,v 1.2 1999/09/09 23:47:09 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -34,6 +34,7 @@ #include "context.h" #include "enable.h" #include "enums.h" +#include "extensions.h" #include "get.h" #include "macros.h" #include "mmath.h" @@ -3690,3 +3691,51 @@ void gl_GetPointerv( GLcontext *ctx, GLenum pname, GLvoid **params ) return; } } + + + +const GLubyte *gl_GetString( GLcontext *ctx, GLenum name ) +{ + static char result[1000]; + static char *vendor = "Brian Paul"; + static char *version = "1.2.1 Mesa 3.1 beta"; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0); + + /* First see if device driver can satisfy this call */ + switch (name) { + case GL_VENDOR: + case GL_RENDERER: + case GL_VERSION: + if (ctx->Driver.GetString) { + const GLubyte *str = (*ctx->Driver.GetString)(ctx, name); + if (str && str[0]) + return str; + } + break; + /* Extensions always handled by extensions.c */ + case GL_EXTENSIONS: + return (GLubyte *) gl_extensions_get_string( ctx ); + default: + gl_error( ctx, GL_INVALID_ENUM, "glGetString" ); + return (GLubyte *) 0; + } + + /* If we get here, device driver didn't return a string */ + switch (name) { + case GL_VENDOR: + return (GLubyte *) vendor; + case GL_RENDERER: + strcpy(result, "Mesa"); + if (ctx->Driver.RendererString) { + strcat(result, " "); + strcat(result, (*ctx->Driver.RendererString)()); + } + return (GLubyte *) result; + case GL_VERSION: + return (GLubyte *) version; + default: + /* caught above */ + return NULL; + } +} -- cgit v1.2.3