summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>1999-09-09 23:47:09 +0000
committerBrian Paul <[email protected]>1999-09-09 23:47:09 +0000
commit00dd504c72e7af8a171a07a952b03bc38982780a (patch)
tree7b44b3358aab6ab77feb28beedd1784018038ab6
parente4c15c12d89315f5913f3350a99471d6f8236e58 (diff)
moved gl_GetString() into get.c
-rw-r--r--src/mesa/main/get.c51
-rw-r--r--src/mesa/main/get.h6
2 files changed, 55 insertions, 2 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 65a682c5472..90d6deb9135 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;
+ }
+}
diff --git a/src/mesa/main/get.h b/src/mesa/main/get.h
index c4e55041f66..fefdb219c95 100644
--- a/src/mesa/main/get.h
+++ b/src/mesa/main/get.h
@@ -1,4 +1,4 @@
-/* $Id: get.h,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: get.h,v 1.2 1999/09/09 23:47:09 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -43,6 +43,10 @@ extern void gl_GetFloatv( GLcontext *ctx, GLenum pname, GLfloat *params );
extern void gl_GetIntegerv( GLcontext *ctx, GLenum pname, GLint *params );
+extern void gl_GetPointerv( GLcontext *ctx, GLenum pname, GLvoid **params );
+
+extern const GLubyte *gl_GetString( GLcontext *ctx, GLenum name );
+
#endif