From df6a50a23a99e805e6570291dcde83445c013e81 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 16 Nov 2012 18:12:01 +0800 Subject: [PATCH] issue #1555: Fixed some compilation error for marmalade and blackberry ports. --- cocos2dx/platform/blackberry/CCEGLView.cpp | 8 ++ cocos2dx/platform/blackberry/CCGL.h | 10 +- cocos2dx/platform/marmalade/CCGL.h | 143 +-------------------- cocos2dx/proj.blackberry/.cproject | 6 +- cocos2dx/proj.blackberry/.project | 17 ++- cocos2dx/proj.marmalade/cocos2dx.mkf | 12 ++ cocos2dx/shaders/CCGLProgram.cpp | 2 +- samples/HelloCpp/proj.blackberry/.cproject | 4 +- samples/HelloLua/proj.blackberry/.cproject | 4 +- 9 files changed, 52 insertions(+), 154 deletions(-) diff --git a/cocos2dx/platform/blackberry/CCEGLView.cpp b/cocos2dx/platform/blackberry/CCEGLView.cpp index 58bb1df768..8beee098ef 100644 --- a/cocos2dx/platform/blackberry/CCEGLView.cpp +++ b/cocos2dx/platform/blackberry/CCEGLView.cpp @@ -54,6 +54,9 @@ PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = 0; PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = 0; #endif +PFNGLMAPBUFFEROESPROC glMapBuffer = 0; +PFNGLUNMAPBUFFEROESPROC glUnmapBuffer = 0; +PFNGLGETBUFFERPOINTERVOESPROC glGetBufferPointerv = 0; NS_CC_BEGIN @@ -170,6 +173,11 @@ void CCEGLView::initEGLFunctions() } #endif + glMapBuffer = (PFNGLMAPBUFFEROESPROC)eglGetProcAddress("glMapBufferOES"); + glUnmapBuffer = (PFNGLUNMAPBUFFEROESPROC)eglGetProcAddress("glUnmapBufferOES"); + glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVOESPROC)eglGetProcAddress("glGetBufferPointervOES"); + + m_initializedFunctions = true; } diff --git a/cocos2dx/platform/blackberry/CCGL.h b/cocos2dx/platform/blackberry/CCGL.h index fa5e17433e..733c5c80a7 100644 --- a/cocos2dx/platform/blackberry/CCGL.h +++ b/cocos2dx/platform/blackberry/CCGL.h @@ -25,8 +25,10 @@ THE SOFTWARE. #ifndef __CCGL_H__ #define __CCGL_H__ -#define glClearDepth glClearDepthf -#define CC_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES +#define glClearDepth glClearDepthf + +#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES +#define GL_WRITE_ONLY GL_WRITE_ONLY_OES #include #include @@ -39,6 +41,8 @@ THE SOFTWARE. extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays; extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray; extern PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays; - +extern PFNGLMAPBUFFEROESPROC glMapBuffer; +extern PFNGLUNMAPBUFFEROESPROC glUnmapBuffer; +extern PFNGLGETBUFFERPOINTERVOESPROC glGetBufferPointerv; #endif // __CCGL_H__ diff --git a/cocos2dx/platform/marmalade/CCGL.h b/cocos2dx/platform/marmalade/CCGL.h index b61ea9fd7c..574b8a208e 100644 --- a/cocos2dx/platform/marmalade/CCGL.h +++ b/cocos2dx/platform/marmalade/CCGL.h @@ -25,164 +25,31 @@ THE SOFTWARE. #ifndef __CCGL_H__ // MH: Added #define __CCGL_H__ // MH: Added -// -// Common layer for OpenGL stuff -// - -//#include "CCEGLView.h" // MH: Removed #define CC_GLVIEW cocos2d::CCEGLView #define ccglOrtho glOrthof #define ccglClearDepth glClearDepthf #define glClearDepth glClearDepthf // MH: Added to fix compile error (glClearDepth not available under GLES 2.0) +#define glMapBuffer glMapBufferOES +#define glUnmapBuffer glUnmapBufferOES -#if (CC_TARGET_PLATFORM == CC_PLATFORM_QNX) || defined(CC_BADA_2_0) -#define ccglGenerateMipmap CCEGLView::glGenerateMipmapOES -#define ccglGenFramebuffers CCEGLView::glGenFramebuffersOES -#define ccglBindFramebuffer CCEGLView::glBindFramebufferOES -#define ccglFramebufferTexture2D CCEGLView::glFramebufferTexture2DOES -#define ccglDeleteFramebuffers CCEGLView::glDeleteFramebuffersOES -#define ccglCheckFramebufferStatus CCEGLView::glCheckFramebufferStatusOES -#else #define ccglGenerateMipmap glGenerateMipmapOES #define ccglGenFramebuffers glGenFramebuffersOES #define ccglBindFramebuffer glBindFramebufferOES #define ccglFramebufferTexture2D glFramebufferTexture2DOES #define ccglDeleteFramebuffers glDeleteFramebuffersOES #define ccglCheckFramebufferStatus glCheckFramebufferStatusOES -#endif #define ccglTranslate glTranslatef #define CC_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES #define CC_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES #define CC_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES #define CC_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES +#define GL_WRITE_ONLY GL_WRITE_ONLY_OES #include "CCCommon.h" - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) -#include "OpenGLES/ES1/gl.h" -#include "OpenGLES/ES1/glext.h" -#endif - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) -// GL_GLEXT_PROTOTYPES isn't defined in glplatform.h on android ndk r7 -// we manually define it here -#include -#ifndef GL_GLEXT_PROTOTYPES -#define GL_GLEXT_PROTOTYPES 1 -#endif -// normal process -#include -#include -#endif - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WOPHONE) -#include -#include -#endif - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) -#include -#include -#endif - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) -#include -#include "GL/glext.h" - -//declare here while define in CCEGLView_linux.cpp -extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT; -extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT; -extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT; -extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT; -extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT; -extern PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT; - -extern PFNGLGENBUFFERSARBPROC glGenBuffersARB; -extern PFNGLBINDBUFFERARBPROC glBindBufferARB; -extern PFNGLBUFFERDATAARBPROC glBufferDataARB; -extern PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB; -extern PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB; - - - - -#undef ccglOrtho -#undef ccglClearDepth -#undef ccglTranslate -#undef ccglGenerateMipmap -#undef ccglGenFramebuffers -#undef ccglBindFramebuffer -#undef ccglFramebufferTexture2D -#undef ccglDeleteFramebuffers -#undef ccglCheckFramebufferStatus - -#undef CC_GL_FRAMEBUFFER -#undef CC_GL_FRAMEBUFFER_BINDING -#undef CC_GL_COLOR_ATTACHMENT0 -#undef CC_GL_FRAMEBUFFER_COMPLETE - -#define ccglOrtho glOrtho -#define ccglClearDepth glClearDepth -#define ccglTranslate glTranslated - -#define ccglGenerateMipmap glGenerateMipmapEXT -#define ccglGenFramebuffers glGenFramebuffersEXT -#define ccglBindFramebuffer glBindFramebufferEXT -#define ccglFramebufferTexture2D glFramebufferTexture2DEXT -#define ccglDeleteFramebuffers glDeleteFramebuffersEXT -#define ccglCheckFramebufferStatus glCheckFramebufferStatusEXT - - -#define glFrustumf glFrustum -#define glGenBuffers glGenBuffersARB -#define glBindBuffer glBindBufferARB -#define glBufferData glBufferDataARB -#define glBufferSubData glBufferSubDataARB -#define glDeleteBuffers glDeleteBuffersARB - -#define CC_GL_FRAMEBUFFER GL_FRAMEBUFFER -#define CC_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING -#define CC_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0 -#define CC_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE - -#define GL_POINT_SPRITE_OES GL_POINT_SPRITE_ARB -#define GL_COORD_REPLACE_OES GL_COORD_REPLACE_ARB -#define GL_POINT_SIZE_ARRAY_OES GL_POINT_SIZE -#endif - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE) #include -#define CC_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES // MH: Added, cany seem to find it anywhere, is this the correct one? -#endif - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_BADA) -#include "GLES/gl.h" -#include "GLES/glext.h" -#endif - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_QNX) -#include -#include -#endif - -NS_CC_BEGIN; - -/* -OpenGL GLU implementation -*/ - -//typedef float GLfloat; - -/** OpenGL gluLookAt implementation */ -void CC_DLL gluLookAt(GLfloat fEyeX, GLfloat fEyeY, GLfloat fEyeZ, - GLfloat fLookAtX, GLfloat fLookAtY, GLfloat fLookAtZ, - GLfloat fUpX, GLfloat fUpY, GLfloat fUpZ); - -/** OpenGL gluPerspective implementation */ -void CC_DLL gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar); - -NS_CC_END; +#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES // MH: Added, cany seem to find it anywhere, is this the correct one? +#define GL_BGRA GL_BGRA_EXT #endif // __CCGL_H__ // Mh: Added diff --git a/cocos2dx/proj.blackberry/.cproject b/cocos2dx/proj.blackberry/.cproject index 7f9a4e5c7c..6926843336 100644 --- a/cocos2dx/proj.blackberry/.cproject +++ b/cocos2dx/proj.blackberry/.cproject @@ -199,10 +199,12 @@ - - + + + + diff --git a/cocos2dx/proj.blackberry/.project b/cocos2dx/proj.blackberry/.project index c504e72c35..34eb3bb07c 100644 --- a/cocos2dx/proj.blackberry/.project +++ b/cocos2dx/proj.blackberry/.project @@ -27,7 +27,7 @@ org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/cocos2dx/Device-Debug} + ${workspace_loc:/cocos2dx/Device-Release} org.eclipse.cdt.make.core.contents @@ -95,11 +95,6 @@ 1 PARENT-1-PROJECT_LOC/CCDirector.cpp - - CCDrawingPrimitives.cpp - 1 - PARENT-1-PROJECT_LOC/CCDrawingPrimitives.cpp - CCScheduler.cpp 1 @@ -125,6 +120,11 @@ 1 PARENT-1-PROJECT_LOC/cocos2d.cpp + + draw_nodes + 2 + PARENT-1-PROJECT_LOC/draw_nodes + effects 2 @@ -170,6 +170,11 @@ 2 PARENT-1-PROJECT_LOC/particle_nodes + + physics_nodes + 2 + PARENT-1-PROJECT_LOC/physics_nodes + platform 2 diff --git a/cocos2dx/proj.marmalade/cocos2dx.mkf b/cocos2dx/proj.marmalade/cocos2dx.mkf index 34683ccc96..892ff62c02 100644 --- a/cocos2dx/proj.marmalade/cocos2dx.mkf +++ b/cocos2dx/proj.marmalade/cocos2dx.mkf @@ -31,6 +31,7 @@ includepaths "../actions" "../base_nodes" "../cocoa" + "../draw_nodes" "../effects" "../kazmath/include" # "../keyboard_dispatcher" @@ -40,6 +41,7 @@ includepaths "../menu_nodes" "../misc_nodes" "../particle_nodes" + "../physics_nodes" "../shaders" "../script_support" "../sprite_nodes" @@ -76,6 +78,11 @@ files "*.h" "*.cpp" + ("../draw_nodes") + [draw_nodes] + "*.h" + "*.cpp" + ("../effects") [effects] "*.h" @@ -154,6 +161,11 @@ files "*.h" "*.cpp" + ("../physics_nodes") + [physics_nodes] + "*.h" + "*.cpp" + ("../platform") [platforms] "*.h" diff --git a/cocos2dx/shaders/CCGLProgram.cpp b/cocos2dx/shaders/CCGLProgram.cpp index 6734fefb73..9f8b3e8089 100644 --- a/cocos2dx/shaders/CCGLProgram.cpp +++ b/cocos2dx/shaders/CCGLProgram.cpp @@ -143,7 +143,7 @@ bool CCGLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* sour } const GLchar *sources[] = { -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) +#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_LINUX && CC_TARGET_PLATFORM != CC_PLATFORM_MAC) (type == GL_VERTEX_SHADER ? "precision highp float;\n" : "precision mediump float;\n"), #endif "uniform mat4 CC_PMatrix;\n" diff --git a/samples/HelloCpp/proj.blackberry/.cproject b/samples/HelloCpp/proj.blackberry/.cproject index ed51e7e55f..f76600499b 100644 --- a/samples/HelloCpp/proj.blackberry/.cproject +++ b/samples/HelloCpp/proj.blackberry/.cproject @@ -68,7 +68,7 @@