|
1 /* |
|
2 SDL - Simple DirectMedia Layer |
|
3 Copyright (C) 1997-2010 Sam Lantinga |
|
4 |
|
5 This library is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU Lesser General Public |
|
7 License as published by the Free Software Foundation; either |
|
8 version 2.1 of the License, or (at your option) any later version. |
|
9 |
|
10 This library is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 Lesser General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU Lesser General Public |
|
16 License along with this library; if not, write to the Free Software |
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
|
19 Sam Lantinga |
|
20 slouken@libsdl.org |
|
21 */ |
|
22 |
|
23 #import <UIKit/UIKit.h> |
|
24 #import <OpenGLES/EAGL.h> |
|
25 #import <OpenGLES/ES1/gl.h> |
|
26 #import <OpenGLES/ES1/glext.h> |
|
27 #import "SDL_uikitview.h" |
|
28 /* |
|
29 This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass. |
|
30 The view content is basically an EAGL surface you render your OpenGL scene into. |
|
31 Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel. |
|
32 */ |
|
33 /* *INDENT-OFF* */ |
|
34 @interface SDL_uikitopenglview : SDL_uikitview { |
|
35 |
|
36 @private |
|
37 /* The pixel dimensions of the backbuffer */ |
|
38 GLint backingWidth; |
|
39 GLint backingHeight; |
|
40 |
|
41 EAGLContext *context; |
|
42 |
|
43 /* OpenGL names for the renderbuffer and framebuffers used to render to this view */ |
|
44 GLuint viewRenderbuffer, viewFramebuffer; |
|
45 |
|
46 /* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */ |
|
47 GLuint depthRenderbuffer; |
|
48 |
|
49 } |
|
50 |
|
51 @property (nonatomic, retain, readonly) EAGLContext *context; |
|
52 |
|
53 - (void)swapBuffers; |
|
54 - (void)setCurrentContext; |
|
55 |
|
56 - (id)initWithFrame:(CGRect)frame |
|
57 retainBacking:(BOOL)retained \ |
|
58 rBits:(int)rBits \ |
|
59 gBits:(int)gBits \ |
|
60 bBits:(int)bBits \ |
|
61 aBits:(int)aBits \ |
|
62 depthBits:(int)depthBits; |
|
63 |
|
64 @end |
|
65 /* *INDENT-ON* */ |