summary refs log tree commit diff stats
path: root/libs/cocos2d/Platforms/CCGL.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/cocos2d/Platforms/CCGL.h')
-rwxr-xr-xlibs/cocos2d/Platforms/CCGL.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/libs/cocos2d/Platforms/CCGL.h b/libs/cocos2d/Platforms/CCGL.h new file mode 100755 index 0000000..0725f89 --- /dev/null +++ b/libs/cocos2d/Platforms/CCGL.h
@@ -0,0 +1,83 @@
1/*
2 * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 *
4 * Copyright (c) 2010 Ricardo Quesada
5 * Copyright (c) 2011 Zynga Inc.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */
25
26//
27// Common layer for OpenGL stuff
28//
29
30#import <Availability.h>
31
32#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
33#import <OpenGLES/ES1/gl.h>
34#import <OpenGLES/ES1/glext.h>
35#import <OpenGLES/EAGL.h>
36#import "iOS/glu.h"
37#import "iOS/EAGLView.h"
38
39#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
40#import <OpenGL/gl.h>
41#import <OpenGL/glu.h>
42#import <Cocoa/Cocoa.h> // needed for NSOpenGLView
43#import "Mac/MacGLView.h"
44#endif
45
46
47// iOS
48#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
49#define CC_GLVIEW EAGLView
50#define ccglOrtho glOrthof
51#define ccglClearDepth glClearDepthf
52#define ccglGenerateMipmap glGenerateMipmapOES
53#define ccglGenFramebuffers glGenFramebuffersOES
54#define ccglBindFramebuffer glBindFramebufferOES
55#define ccglFramebufferTexture2D glFramebufferTexture2DOES
56#define ccglDeleteFramebuffers glDeleteFramebuffersOES
57#define ccglCheckFramebufferStatus glCheckFramebufferStatusOES
58#define ccglTranslate glTranslatef
59
60#define CC_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
61#define CC_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES
62#define CC_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
63#define CC_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
64
65// Mac
66#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
67#define CC_GLVIEW MacGLView
68#define ccglOrtho glOrtho
69#define ccglClearDepth glClearDepth
70#define ccglGenerateMipmap glGenerateMipmap
71#define ccglGenFramebuffers glGenFramebuffers
72#define ccglBindFramebuffer glBindFramebuffer
73#define ccglFramebufferTexture2D glFramebufferTexture2D
74#define ccglDeleteFramebuffers glDeleteFramebuffers
75#define ccglCheckFramebufferStatus glCheckFramebufferStatus
76#define ccglTranslate glTranslated
77
78#define CC_GL_FRAMEBUFFER GL_FRAMEBUFFER
79#define CC_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
80#define CC_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0
81#define CC_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE
82
83#endif