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