apple: Use the correct (OpenGL.framework) glViewport and glScissor during init
authorJeremy Huddleston <jeremyhu@apple.com>
Fri, 21 Oct 2011 07:22:40 +0000 (00:22 -0700)
committerJeremy Huddleston <jeremyhu@apple.com>
Fri, 21 Oct 2011 07:34:06 +0000 (00:34 -0700)
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
src/glx/apple/apple_glapi.c
src/glx/apple/apple_glx.h
src/glx/apple/apple_glx_pbuffer.c
src/glx/apple/apple_glx_pixmap.c
src/glx/apple/apple_glx_surface.c

index 34f726efb64275ed4610cab1126e944a06221916..9a670bcfbb0cc94e58f5dc4c76fb57c32318809c 100644 (file)
 struct _glapi_table * __ogl_framework_api = NULL;
 struct _glapi_table * __applegl_api = NULL;
 
-void apple_glapi_set_dispatch(void) {
-    if(__applegl_api)  {
-        _glapi_set_dispatch(__applegl_api);
+static void _apple_glapi_create_table(void) {
+    if (__applegl_api)
         return;
-    }
 
     __ogl_framework_api = _glapi_create_table_from_handle(apple_cgl_get_dl_handle(), "gl");
     assert(__ogl_framework_api);
@@ -68,6 +66,15 @@ void apple_glapi_set_dispatch(void) {
     SET_DrawBuffer(__applegl_api, __applegl_glDrawBuffer);
     SET_DrawBuffersARB(__applegl_api, __applegl_glDrawBuffersARB);
     SET_Viewport(__applegl_api, __applegl_glViewport);
+}
 
+void apple_glapi_set_dispatch(void) {
+    _apple_glapi_create_table();
     _glapi_set_dispatch(__applegl_api);
 }
+
+void apple_glapi_oglfw_viewport_scissor(GLint x, GLint y, GLsizei width, GLsizei height) {
+    _apple_glapi_create_table();
+    __ogl_framework_api->Viewport(x, y, width, height);
+    __ogl_framework_api->Scissor(x, y, width, height);
+}
index c70fc009dd5a02d894196db237b07d6c3dcc87c4..ce8c4884d1aaea63c39358c64147a2a95def7329 100644 (file)
@@ -46,5 +46,6 @@ void apple_glx_waitx(Display * dpy, void *ptr);
 int apple_get_dri_event_base(void);
 
 void apple_glapi_set_dispatch(void);
+void apple_glapi_oglfw_viewport_scissor(GLint x, GLint y, GLsizei width, GLsizei height);
 
 #endif
index 2817cda23b7b445af4f1979c23f5998607370115..142f4cce994a212b2647651656cee093cf9db905 100644 (file)
@@ -84,8 +84,7 @@ pbuffer_make_current(struct apple_glx_context *ac,
    }
 
    if (!ac->made_current) {
-      glViewport(0, 0, pbuf->width, pbuf->height);
-      glScissor(0, 0, pbuf->width, pbuf->height);
+      apple_glapi_oglfw_viewport_scissor(0, 0, pbuf->width, pbuf->height);
       ac->made_current = true;
    }
 
index 4586707909b69c1d855a8c7912c319b91af13625..bee0ec98bef203793829224a3ed18be6f6a9b036 100644 (file)
@@ -80,8 +80,7 @@ pixmap_make_current(struct apple_glx_context *ac,
    }
 
    if (!ac->made_current) {
-      glViewport(0, 0, p->width, p->height);
-      glScissor(0, 0, p->width, p->height);
+      apple_glapi_oglfw_viewport_scissor(0, 0, p->width, p->height);
       ac->made_current = true;
    }
 
index 6db2910a464de7137e6ead62b620a482567f1c86..39f513034dc329f2bbfb9eb085e4089a86d838a8 100644 (file)
@@ -53,8 +53,7 @@ update_viewport_and_scissor(Display * dpy, GLXDrawable drawable)
 
    XGetGeometry(dpy, drawable, &root, &x, &y, &width, &height, &bd, &depth);
 
-   glViewport(0, 0, width, height);
-   glScissor(0, 0, width, height);
+   apple_glapi_oglfw_viewport_scissor(0, 0, width, height);
 }
 
 static bool