#include <GL/gl.h>
+#include "main/glheader.h"
#include "glapi.h"
#include "glapitable.h"
-#include "main/dispatch.h"
#include "apple_glx.h"
#include "apple_xgl_api.h"
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);
assert(__applegl_api);
memcpy(__applegl_api, __ogl_framework_api, sizeof(struct _glapi_table));
- SET_ReadPixels(__applegl_api, __applegl_glReadPixels);
- SET_CopyPixels(__applegl_api, __applegl_glCopyPixels);
- SET_CopyColorTable(__applegl_api, __applegl_glCopyColorTable);
- SET_DrawBuffer(__applegl_api, __applegl_glDrawBuffer);
- SET_DrawBuffersARB(__applegl_api, __applegl_glDrawBuffersARB);
- SET_Viewport(__applegl_api, __applegl_glViewport);
+ _glapi_table_patch(__applegl_api, "ReadPixels", __applegl_glReadPixels);
+ _glapi_table_patch(__applegl_api, "CopyPixels", __applegl_glCopyPixels);
+ _glapi_table_patch(__applegl_api, "CopyColorTable", __applegl_glCopyColorTable);
+ _glapi_table_patch(__applegl_api, "DrawBuffers", __applegl_glDrawBuffer);
+ _glapi_table_patch(__applegl_api, "Viewport", __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);
+}