[Xquartz-changes] [290] AppleSGLX/trunk

source_changes at macosforge.org source_changes at macosforge.org
Sat Mar 7 01:10:09 PST 2009


Revision: 290
          http://trac.macosforge.org/projects/xquartz/changeset/290
Author:   gstaplin at apple.com
Date:     2009-03-07 01:10:09 -0800 (Sat, 07 Mar 2009)
Log Message:
-----------
Add some detection and stderr output for when the CGL major 
version changes.

Modified Paths:
--------------
    AppleSGLX/trunk/apple_cgl.c
    AppleSGLX/trunk/apple_cgl.h

Modified: AppleSGLX/trunk/apple_cgl.c
===================================================================
--- AppleSGLX/trunk/apple_cgl.c	2009-03-07 08:55:38 UTC (rev 289)
+++ AppleSGLX/trunk/apple_cgl.c	2009-03-07 09:10:09 UTC (rev 290)
@@ -33,6 +33,7 @@
 #include <dlfcn.h>
 
 #include "apple_cgl.h"
+#include "apple_glx.h"
 
 #ifndef OPENGL_FRAMEWORK_PATH
 #define OPENGL_FRAMEWORK_PATH "/System/Library/Frameworks/OpenGL.framework/OpenGL"
@@ -59,6 +60,7 @@
 
 void apple_cgl_init(void) {
     void *h;
+    GLint major = 0, minor = 0;
     
     if(initialized)
 	return;
@@ -74,6 +76,17 @@
 
     dl_handle = h;
 
+    apple_cgl.get_version = sym(h, "CGLGetVersion");
+
+    apple_cgl.get_version(&major, &minor);
+
+    apple_glx_diagnostic("CGL major %d minor %d\n", major, minor);
+
+    if(1 != major) {
+	fprintf(stderr, "WARNING: the CGL major version has changed!\n"
+		"libGL may be incompatible!\n");
+    }
+
     apple_cgl.choose_pixel_format = sym(h, "CGLChoosePixelFormat");
     apple_cgl.destroy_pixel_format = sym(h, "CGLDestroyPixelFormat");
 

Modified: AppleSGLX/trunk/apple_cgl.h
===================================================================
--- AppleSGLX/trunk/apple_cgl.h	2009-03-07 08:55:38 UTC (rev 289)
+++ AppleSGLX/trunk/apple_cgl.h	2009-03-07 09:10:09 UTC (rev 290)
@@ -39,6 +39,8 @@
 #include <OpenGL/gl.h>
 
 struct apple_cgl_api {
+    void (*get_version)(GLint *majorvers, GLint *minorvers);
+    
     CGLError (*choose_pixel_format)(const CGLPixelFormatAttribute *attribs, 
 				    CGLPixelFormatObj *pix, GLint *npix);
     CGLError (*destroy_pixel_format)(CGLPixelFormatObj pix);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/xquartz-changes/attachments/20090307/8611688c/attachment.html>


More information about the Xquartz-changes mailing list