Merge pull request #1585 from dumganhar/iss1555-update

issue #1555: Fixed some compilation errors for marmalade and blackberry ports.
This commit is contained in:
James Chen 2012-11-16 02:19:54 -08:00
commit 26b31b0672
9 changed files with 52 additions and 154 deletions

View File

@ -54,6 +54,9 @@ PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = 0;
PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = 0; PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = 0;
#endif #endif
PFNGLMAPBUFFEROESPROC glMapBuffer = 0;
PFNGLUNMAPBUFFEROESPROC glUnmapBuffer = 0;
PFNGLGETBUFFERPOINTERVOESPROC glGetBufferPointerv = 0;
NS_CC_BEGIN NS_CC_BEGIN
@ -170,6 +173,11 @@ void CCEGLView::initEGLFunctions()
} }
#endif #endif
glMapBuffer = (PFNGLMAPBUFFEROESPROC)eglGetProcAddress("glMapBufferOES");
glUnmapBuffer = (PFNGLUNMAPBUFFEROESPROC)eglGetProcAddress("glUnmapBufferOES");
glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVOESPROC)eglGetProcAddress("glGetBufferPointervOES");
m_initializedFunctions = true; m_initializedFunctions = true;
} }

View File

@ -25,8 +25,10 @@ THE SOFTWARE.
#ifndef __CCGL_H__ #ifndef __CCGL_H__
#define __CCGL_H__ #define __CCGL_H__
#define glClearDepth glClearDepthf #define glClearDepth glClearDepthf
#define CC_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#define GL_WRITE_ONLY GL_WRITE_ONLY_OES
#include <EGL/egl.h> #include <EGL/egl.h>
#include <screen/screen.h> #include <screen/screen.h>
@ -39,6 +41,8 @@ THE SOFTWARE.
extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays; extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray; extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray;
extern PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays; extern PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
extern PFNGLMAPBUFFEROESPROC glMapBuffer;
extern PFNGLUNMAPBUFFEROESPROC glUnmapBuffer;
extern PFNGLGETBUFFERPOINTERVOESPROC glGetBufferPointerv;
#endif // __CCGL_H__ #endif // __CCGL_H__

View File

@ -25,164 +25,31 @@ THE SOFTWARE.
#ifndef __CCGL_H__ // MH: Added #ifndef __CCGL_H__ // MH: Added
#define __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 CC_GLVIEW cocos2d::CCEGLView
#define ccglOrtho glOrthof #define ccglOrtho glOrthof
#define ccglClearDepth glClearDepthf #define ccglClearDepth glClearDepthf
#define glClearDepth glClearDepthf // MH: Added to fix compile error (glClearDepth not available under GLES 2.0) #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 ccglGenerateMipmap glGenerateMipmapOES
#define ccglGenFramebuffers glGenFramebuffersOES #define ccglGenFramebuffers glGenFramebuffersOES
#define ccglBindFramebuffer glBindFramebufferOES #define ccglBindFramebuffer glBindFramebufferOES
#define ccglFramebufferTexture2D glFramebufferTexture2DOES #define ccglFramebufferTexture2D glFramebufferTexture2DOES
#define ccglDeleteFramebuffers glDeleteFramebuffersOES #define ccglDeleteFramebuffers glDeleteFramebuffersOES
#define ccglCheckFramebufferStatus glCheckFramebufferStatusOES #define ccglCheckFramebufferStatus glCheckFramebufferStatusOES
#endif
#define ccglTranslate glTranslatef #define ccglTranslate glTranslatef
#define CC_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES #define CC_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
#define CC_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES #define CC_GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES
#define CC_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES #define CC_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
#define CC_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES #define CC_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES
#define GL_WRITE_ONLY GL_WRITE_ONLY_OES
#include "CCCommon.h" #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 <GLES/glplatform.h>
#ifndef GL_GLEXT_PROTOTYPES
#define GL_GLEXT_PROTOTYPES 1
#endif
// normal process
#include <GLES/gl.h>
#include <GLES/glext.h>
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WOPHONE)
#include <GLES/gl.h>
#include <GLES/glext.h>
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#include <GLES/gl.h>
#include <GLES/glext.h>
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
#include <GL/gl.h>
#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 <IwGL.h> #include <IwGL.h>
#define CC_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES // MH: Added, cany seem to find it anywhere, is this the correct one? #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES // MH: Added, cany seem to find it anywhere, is this the correct one?
#endif #define GL_BGRA GL_BGRA_EXT
#if (CC_TARGET_PLATFORM == CC_PLATFORM_BADA)
#include "GLES/gl.h"
#include "GLES/glext.h"
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_QNX)
#include <GLES/gl.h>
#include <GLES/glext.h>
#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;
#endif // __CCGL_H__ // Mh: Added #endif // __CCGL_H__ // Mh: Added

View File

@ -199,10 +199,12 @@
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="support"/> <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="support"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="text_input_node"/> <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="text_input_node"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="textures"/> <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="textures"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="tileMap_parallax_nodes"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="touch_dispatcher"/> <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="touch_dispatcher"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="extensions"/> <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="extensions"/>
<entry excluding="actions|base_nodes|cocoa|effects|include|kazmath|keypad_dispatcher|label_nodes|layers_scenes_transitions_nodes|menu_nodes|misc_nodes|particle_nodes|platform|script_support|shaders|sprite_nodes|support|text_input_node|textures|tileMap_parallax_nodes|touch_dispatcher|extensions" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name=""/> <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="draw_nodes"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="physics_nodes"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="tilemap_parallax_nodes"/>
<entry excluding="actions|base_nodes|cocoa|effects|include|kazmath|keypad_dispatcher|label_nodes|layers_scenes_transitions_nodes|menu_nodes|misc_nodes|particle_nodes|platform|script_support|shaders|sprite_nodes|support|text_input_node|textures|touch_dispatcher|extensions|draw_nodes|physics_nodes|tilemap_parallax_nodes" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name=""/>
</sourceEntries> </sourceEntries>
</configuration> </configuration>
</storageModule> </storageModule>

View File

@ -27,7 +27,7 @@
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key> <key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/cocos2dx/Device-Debug}</value> <value>${workspace_loc:/cocos2dx/Device-Release}</value>
</dictionary> </dictionary>
<dictionary> <dictionary>
<key>org.eclipse.cdt.make.core.contents</key> <key>org.eclipse.cdt.make.core.contents</key>
@ -95,11 +95,6 @@
<type>1</type> <type>1</type>
<locationURI>PARENT-1-PROJECT_LOC/CCDirector.cpp</locationURI> <locationURI>PARENT-1-PROJECT_LOC/CCDirector.cpp</locationURI>
</link> </link>
<link>
<name>CCDrawingPrimitives.cpp</name>
<type>1</type>
<locationURI>PARENT-1-PROJECT_LOC/CCDrawingPrimitives.cpp</locationURI>
</link>
<link> <link>
<name>CCScheduler.cpp</name> <name>CCScheduler.cpp</name>
<type>1</type> <type>1</type>
@ -125,6 +120,11 @@
<type>1</type> <type>1</type>
<locationURI>PARENT-1-PROJECT_LOC/cocos2d.cpp</locationURI> <locationURI>PARENT-1-PROJECT_LOC/cocos2d.cpp</locationURI>
</link> </link>
<link>
<name>draw_nodes</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/draw_nodes</locationURI>
</link>
<link> <link>
<name>effects</name> <name>effects</name>
<type>2</type> <type>2</type>
@ -170,6 +170,11 @@
<type>2</type> <type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/particle_nodes</locationURI> <locationURI>PARENT-1-PROJECT_LOC/particle_nodes</locationURI>
</link> </link>
<link>
<name>physics_nodes</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/physics_nodes</locationURI>
</link>
<link> <link>
<name>platform</name> <name>platform</name>
<type>2</type> <type>2</type>

View File

@ -31,6 +31,7 @@ includepaths
"../actions" "../actions"
"../base_nodes" "../base_nodes"
"../cocoa" "../cocoa"
"../draw_nodes"
"../effects" "../effects"
"../kazmath/include" "../kazmath/include"
# "../keyboard_dispatcher" # "../keyboard_dispatcher"
@ -40,6 +41,7 @@ includepaths
"../menu_nodes" "../menu_nodes"
"../misc_nodes" "../misc_nodes"
"../particle_nodes" "../particle_nodes"
"../physics_nodes"
"../shaders" "../shaders"
"../script_support" "../script_support"
"../sprite_nodes" "../sprite_nodes"
@ -76,6 +78,11 @@ files
"*.h" "*.h"
"*.cpp" "*.cpp"
("../draw_nodes")
[draw_nodes]
"*.h"
"*.cpp"
("../effects") ("../effects")
[effects] [effects]
"*.h" "*.h"
@ -154,6 +161,11 @@ files
"*.h" "*.h"
"*.cpp" "*.cpp"
("../physics_nodes")
[physics_nodes]
"*.h"
"*.cpp"
("../platform") ("../platform")
[platforms] [platforms]
"*.h" "*.h"

View File

@ -143,7 +143,7 @@ bool CCGLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* sour
} }
const GLchar *sources[] = { 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"), (type == GL_VERTEX_SHADER ? "precision highp float;\n" : "precision mediump float;\n"),
#endif #endif
"uniform mat4 CC_PMatrix;\n" "uniform mat4 CC_PMatrix;\n"

View File

@ -68,7 +68,7 @@
</option> </option>
<option id="com.qnx.qcc.option.linker.security.1794064552" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/> <option id="com.qnx.qcc.option.linker.security.1794064552" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.linker.libraryPaths.1757627798" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths"> <option id="com.qnx.qcc.option.linker.libraryPaths.1757627798" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/cocos2dx/Device-Debug}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/cocos2dx/Device-Release}&quot;"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/lib"/> <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/lib"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/usr/lib"/> <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/usr/lib"/>
<listOptionValue builtIn="false" value="../../../../cocos2dx/proj.blackberry/${ConfigName}"/> <listOptionValue builtIn="false" value="../../../../cocos2dx/proj.blackberry/${ConfigName}"/>
@ -97,7 +97,7 @@
<externalSettings containerId="cocos2dx;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> <externalSettings containerId="cocos2dx;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier">
<externalSetting> <externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/cocos2dx"/> <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/cocos2dx"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/cocos2dx/Device-Debug"/> <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/cocos2dx/Device-Release"/>
<entry flags="RESOLVED" kind="libraryFile" name="cocos2dx"/> <entry flags="RESOLVED" kind="libraryFile" name="cocos2dx"/>
</externalSetting> </externalSetting>
</externalSettings> </externalSettings>

View File

@ -76,7 +76,7 @@
</option> </option>
<option id="com.qnx.qcc.option.linker.security.1794064552" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/> <option id="com.qnx.qcc.option.linker.security.1794064552" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.linker.libraryPaths.1757627798" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths"> <option id="com.qnx.qcc.option.linker.libraryPaths.1757627798" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/cocos2dx/Device-Debug}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/cocos2dx/Device-Release}&quot;"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/lib"/> <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/lib"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/usr/lib"/> <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/usr/lib"/>
<listOptionValue builtIn="false" value="../../../../cocos2dx/proj.blackberry/${ConfigName}"/> <listOptionValue builtIn="false" value="../../../../cocos2dx/proj.blackberry/${ConfigName}"/>
@ -108,7 +108,7 @@
<externalSettings containerId="cocos2dx;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> <externalSettings containerId="cocos2dx;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier">
<externalSetting> <externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/cocos2dx"/> <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/cocos2dx"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/cocos2dx/Device-Debug"/> <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/cocos2dx/Device-Release"/>
<entry flags="RESOLVED" kind="libraryFile" name="cocos2dx"/> <entry flags="RESOLVED" kind="libraryFile" name="cocos2dx"/>
</externalSetting> </externalSetting>
</externalSettings> </externalSettings>