1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org Copyright (c) 2008, 2009 Apple Inc.
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org Permission is hereby granted, free of charge, to any person
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org obtaining a copy of this software and associated documentation files
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (the "Software"), to deal in the Software without restriction,
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org including without limitation the rights to use, copy, modify, merge,
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org publish, distribute, sublicense, and/or sell copies of the Software,
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org and to permit persons to whom the Software is furnished to do so,
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org subject to the following conditions:
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org The above copyright notice and this permission notice shall be
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org included in all copies or substantial portions of the Software.
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org NONINFRINGEMENT.  IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org DEALINGS IN THE SOFTWARE.
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org Except as contained in this notice, the name(s) of the above
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org copyright holders shall not be used in advertising or otherwise to
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org promote the sale, use or other dealings in this Software without
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org prior written authorization.
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org*/
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef APPLE_CGL_H
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define APPLE_CGL_H
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <stdio.h>
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <OpenGL/CGLCurrent.h>
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <OpenGL/CGLTypes.h>
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <OpenGL/OpenGL.h>
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* For GLint and GLsizei on Tiger */
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include <OpenGL/gl.h>
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct apple_cgl_api
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     GLint version_major, version_minor;
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     void (*get_version) (GLint * version_major, GLint * version_minor);
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*choose_pixel_format) (const CGLPixelFormatAttribute * attribs,
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                     CGLPixelFormatObj * pix, GLint * npix);
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*destroy_pixel_format) (CGLPixelFormatObj pix);
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*clear_drawable) (CGLContextObj ctx);
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*flush_drawable) (CGLContextObj ctx);
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*create_context) (CGLPixelFormatObj pix, CGLContextObj share,
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                CGLContextObj * ctx);
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*destroy_context) (CGLContextObj pix);
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*set_current_context) (CGLContextObj ctx);
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLContextObj(*get_current_context) (void);
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   const char *(*error_string) (CGLError error);
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*set_off_screen) (CGLContextObj ctx,
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                GLsizei width, GLsizei height, GLint rowbytes,
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                void *baseaddr);
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*copy_context) (CGLContextObj src, CGLContextObj dst,
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                              GLbitfield mask);
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*create_pbuffer) (GLsizei width,
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                GLsizei height,
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                GLenum target,
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                GLenum internalFormat,
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                GLint max_level, CGLPBufferObj * pbuffer);
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*destroy_pbuffer) (CGLPBufferObj pbuffer);
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     CGLError(*set_pbuffer) (CGLContextObj ctx,
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             CGLPBufferObj pbuffer,
78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                             GLenum face, GLint level, GLint screen);
79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern struct apple_cgl_api apple_cgl;
82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern void apple_cgl_init(void);
84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern void *apple_cgl_get_dl_handle(void);
86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif
88