|
cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
|
00001 /* 00002 * cocos2d for iPhone: http://www.cocos2d-iphone.org 00003 * 00004 * Copyright (c) 2010 Ricardo Quesada 00005 * Copyright (c) 2011 Zynga Inc. 00006 * 00007 * Permission is hereby granted, free of charge, to any person obtaining a copy 00008 * of this software and associated documentation files (the "Software"), to deal 00009 * in the Software without restriction, including without limitation the rights 00010 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00011 * copies of the Software, and to permit persons to whom the Software is 00012 * furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included in 00015 * all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00018 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00020 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00021 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00022 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00023 * THE SOFTWARE. 00024 */ 00025 00026 // 00027 // Common layer for OpenGL stuff 00028 // 00029 00030 #import <Availability.h> 00031 00032 #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 00033 #import <OpenGLES/ES1/gl.h> 00034 #import <OpenGLES/ES1/glext.h> 00035 #import <OpenGLES/EAGL.h> 00036 #import "iOS/glu.h" 00037 #import "iOS/EAGLView.h" 00038 00039 #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 00040 #import <OpenGL/gl.h> 00041 #import <OpenGL/glu.h> 00042 #import <Cocoa/Cocoa.h> // needed for NSOpenGLView 00043 #import "Mac/MacGLView.h" 00044 #endif 00045 00046 00047 // iOS 00048 #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED 00049 #define CC_GLVIEW EAGLView 00050 #define ccglOrtho glOrthof 00051 #define ccglClearDepth glClearDepthf 00052 #define ccglGenerateMipmap glGenerateMipmapOES 00053 #define ccglGenFramebuffers glGenFramebuffersOES 00054 #define ccglBindFramebuffer glBindFramebufferOES 00055 #define ccglFramebufferTexture2D glFramebufferTexture2DOES 00056 #define ccglDeleteFramebuffers glDeleteFramebuffersOES 00057 #define ccglCheckFramebufferStatus glCheckFramebufferStatusOES 00058 #define ccglTranslate glTranslatef 00059 00060 #define CC_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES 00061 #define CC_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES 00062 #define CC_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES 00063 #define CC_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES 00064 00065 // Mac 00066 #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) 00067 #define CC_GLVIEW MacGLView 00068 #define ccglOrtho glOrtho 00069 #define ccglClearDepth glClearDepth 00070 #define ccglGenerateMipmap glGenerateMipmap 00071 #define ccglGenFramebuffers glGenFramebuffers 00072 #define ccglBindFramebuffer glBindFramebuffer 00073 #define ccglFramebufferTexture2D glFramebufferTexture2D 00074 #define ccglDeleteFramebuffers glDeleteFramebuffers 00075 #define ccglCheckFramebufferStatus glCheckFramebufferStatus 00076 #define ccglTranslate glTranslated 00077 00078 #define CC_GL_FRAMEBUFFER GL_FRAMEBUFFER 00079 #define CC_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING 00080 #define CC_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0 00081 #define CC_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE 00082 00083 #endif