changeset 308:ee32ed29a507

*** empty log message ***
author Sam Lantinga <slouken@libsdl.org>
date Sun, 10 Mar 2002 03:55:45 +0000
parents 0185452e9f83
children 2de77f7b7a28
files src/video/quartz/SDL_QuartzVideo.m
diffstat 1 files changed, 31 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/quartz/SDL_QuartzVideo.m	Sun Mar 10 03:49:25 2002 +0000
+++ b/src/video/quartz/SDL_QuartzVideo.m	Sun Mar 10 03:55:45 2002 +0000
@@ -1208,20 +1208,40 @@
 
 static int    QZ_GL_GetAttribute   (_THIS, SDL_GLattr attrib, int* value) {
 
-/*
-    CGLContextRef ctx = [ gl_context cglContext ];
-    CGLContextParameter param;
-    
+    GLenum attr;
+
+    QZ_GL_MakeCurrent (this);
+
     switch (attrib) {
-    case SDL_GL_RED_SIZE: param = CGLContextParameter break;
-    
+    case SDL_GL_RED_SIZE: attr = GL_RED_BITS;   break;
+    case SDL_GL_BLUE_SIZE: attr = GL_BLUE_BITS;  break;
+    case SDL_GL_GREEN_SIZE: attr = GL_GREEN_BITS; break;
+    case SDL_GL_ALPHA_SIZE: attr = GL_ALPHA_BITS; break;
+    case SDL_GL_DOUBLEBUFFER: attr = GL_DOUBLEBUFFER; break;
+    case SDL_GL_DEPTH_SIZE: attr = GL_DEPTH_BITS;  break;
+    case SDL_GL_STENCIL_SIZE: attr = GL_STENCIL_BITS; break;
+    case SDL_GL_ACCUM_RED_SIZE: attr = GL_ACCUM_RED_BITS; break;
+    case SDL_GL_ACCUM_GREEN_SIZE: attr = GL_ACCUM_GREEN_BITS; break;
+    case SDL_GL_ACCUM_BLUE_SIZE: attr = GL_ACCUM_BLUE_BITS; break;
+    case SDL_GL_ACCUM_ALPHA_SIZE: attr = GL_ACCUM_ALPHA_BITS; break;
+    case SDL_GL_BUFFER_SIZE:
+        {
+            GLint bits = 0;
+            GLint component;
+
+            /* there doesn't seem to be a single flag in OpenGL for this! */
+            glGetIntegerv (GL_RED_BITS, &component);   bits += component;
+            glGetIntegerv (GL_GREEN_BITS,&component);  bits += component;
+            glGetIntegerv (GL_BLUE_BITS, &component);  bits += component;
+            glGetIntegerv (GL_ALPHA_BITS, &component); bits += component;
+
+            *value = bits;
+        }
+        return 0;
     }
-    
-    CGLGetParameter (ctx, param, (long*)value);
-*/
 
-    *value = -1;
-    return -1;
+    glGetIntegerv (attr, value);
+    return 0;
 }
 
 static int    QZ_GL_MakeCurrent    (_THIS) {