Merge pull request #8611 from dabingnn/v3_fixGLProgramCrash

V3 fix gl program crash
This commit is contained in:
minggo 2014-10-10 15:28:23 +08:00
commit 7d4a235d46
5 changed files with 18 additions and 42 deletions

View File

@ -2084,22 +2084,23 @@ unsigned int Bundle3D::parseGLProgramAttribute(const std::string& str)
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD3;
}
else if (str == "VERTEX_ATTRIB_TEX_COORD4")
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD4;
}
else if (str == "VERTEX_ATTRIB_TEX_COORD5")
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD5;
}
else if (str == "VERTEX_ATTRIB_TEX_COORD6")
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD6;
}
else if (str == "VERTEX_ATTRIB_TEX_COORD7")
{
return GLProgram::VERTEX_ATTRIB_TEX_COORD7;
}
//comment out them
// else if (str == "VERTEX_ATTRIB_TEX_COORD4")
// {
// return GLProgram::VERTEX_ATTRIB_TEX_COORD4;
// }
// else if (str == "VERTEX_ATTRIB_TEX_COORD5")
// {
// return GLProgram::VERTEX_ATTRIB_TEX_COORD5;
// }
// else if (str == "VERTEX_ATTRIB_TEX_COORD6")
// {
// return GLProgram::VERTEX_ATTRIB_TEX_COORD6;
// }
// else if (str == "VERTEX_ATTRIB_TEX_COORD7")
// {
// return GLProgram::VERTEX_ATTRIB_TEX_COORD7;
// }
else if (str == "VERTEX_ATTRIB_NORMAL")
{
return GLProgram::VERTEX_ATTRIB_NORMAL;

View File

@ -44,7 +44,7 @@
NS_CC_BEGIN
std::string s_attributeNames[] = {GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::ATTRIBUTE_NAME_TEX_COORD1, GLProgram::ATTRIBUTE_NAME_TEX_COORD2,GLProgram::ATTRIBUTE_NAME_TEX_COORD3,GLProgram::ATTRIBUTE_NAME_TEX_COORD4,GLProgram::ATTRIBUTE_NAME_TEX_COORD5,GLProgram::ATTRIBUTE_NAME_TEX_COORD6,GLProgram::ATTRIBUTE_NAME_TEX_COORD7,GLProgram::ATTRIBUTE_NAME_NORMAL, GLProgram::ATTRIBUTE_NAME_BLEND_WEIGHT, GLProgram::ATTRIBUTE_NAME_BLEND_INDEX};
std::string s_attributeNames[] = {GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::ATTRIBUTE_NAME_TEX_COORD1, GLProgram::ATTRIBUTE_NAME_TEX_COORD2,GLProgram::ATTRIBUTE_NAME_TEX_COORD3,GLProgram::ATTRIBUTE_NAME_NORMAL, GLProgram::ATTRIBUTE_NAME_BLEND_WEIGHT, GLProgram::ATTRIBUTE_NAME_BLEND_INDEX};
Sprite3D* Sprite3D::create(const std::string &modelPath)
{

View File

@ -100,10 +100,6 @@ const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD = "a_texCoord";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD1 = "a_texCoord1";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD2 = "a_texCoord2";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD3 = "a_texCoord3";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD4 = "a_texCoord4";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD5 = "a_texCoord5";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD6 = "a_texCoord6";
const char* GLProgram::ATTRIBUTE_NAME_TEX_COORD7 = "a_texCoord7";
const char* GLProgram::ATTRIBUTE_NAME_NORMAL = "a_normal";
const char* GLProgram::ATTRIBUTE_NAME_BLEND_WEIGHT = "a_blendWeight";
const char* GLProgram::ATTRIBUTE_NAME_BLEND_INDEX = "a_blendIndex";
@ -294,10 +290,6 @@ void GLProgram::bindPredefinedVertexAttribs()
{GLProgram::ATTRIBUTE_NAME_TEX_COORD1, GLProgram::VERTEX_ATTRIB_TEX_COORD1},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD2, GLProgram::VERTEX_ATTRIB_TEX_COORD2},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD3, GLProgram::VERTEX_ATTRIB_TEX_COORD3},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD4, GLProgram::VERTEX_ATTRIB_TEX_COORD4},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD5, GLProgram::VERTEX_ATTRIB_TEX_COORD5},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD6, GLProgram::VERTEX_ATTRIB_TEX_COORD6},
{GLProgram::ATTRIBUTE_NAME_TEX_COORD7, GLProgram::VERTEX_ATTRIB_TEX_COORD7},
{GLProgram::ATTRIBUTE_NAME_NORMAL, GLProgram::VERTEX_ATTRIB_NORMAL},
};

View File

@ -87,14 +87,9 @@ public:
VERTEX_ATTRIB_TEX_COORD1,
VERTEX_ATTRIB_TEX_COORD2,
VERTEX_ATTRIB_TEX_COORD3,
VERTEX_ATTRIB_TEX_COORD4,
VERTEX_ATTRIB_TEX_COORD5,
VERTEX_ATTRIB_TEX_COORD6,
VERTEX_ATTRIB_TEX_COORD7,
VERTEX_ATTRIB_NORMAL,
VERTEX_ATTRIB_BLEND_WEIGHT,
VERTEX_ATTRIB_BLEND_INDEX,
VERTEX_ATTRIB_MAX,
// backward compatibility
@ -169,10 +164,6 @@ public:
static const char* ATTRIBUTE_NAME_TEX_COORD1;
static const char* ATTRIBUTE_NAME_TEX_COORD2;
static const char* ATTRIBUTE_NAME_TEX_COORD3;
static const char* ATTRIBUTE_NAME_TEX_COORD4;
static const char* ATTRIBUTE_NAME_TEX_COORD5;
static const char* ATTRIBUTE_NAME_TEX_COORD6;
static const char* ATTRIBUTE_NAME_TEX_COORD7;
static const char* ATTRIBUTE_NAME_NORMAL;
static const char* ATTRIBUTE_NAME_BLEND_WEIGHT;
static const char* ATTRIBUTE_NAME_BLEND_INDEX;

View File

@ -1,9 +1,5 @@
const char* cc3D_PositionNormalTex_vert = STRINGIFY(
\n#define MAX_DIRECTIONAL_LIGHT_NUM 1 \n
\n#define MAX_POINT_LIGHT_NUM 1 \n
\n#define MAX_SPOT_LIGHT_NUM 1 \n
\n#define MAX_AMBIENT_LIGHT_NUM 1 \n
\n#if (MAX_POINT_LIGHT_NUM > 0)\n
uniform vec3 u_PointLightSourcePosition[MAX_POINT_LIGHT_NUM];
@ -55,10 +51,6 @@ void main(void)
);
const char* cc3D_SkinPositionNormalTex_vert = STRINGIFY(
\n#define MAX_DIRECTIONAL_LIGHT_NUM 1 \n
\n#define MAX_POINT_LIGHT_NUM 1 \n
\n#define MAX_SPOT_LIGHT_NUM 1 \n
\n#define MAX_AMBIENT_LIGHT_NUM 1 \n
\n#if (MAX_POINT_LIGHT_NUM > 0)\n
uniform vec3 u_PointLightSourcePosition[MAX_POINT_LIGHT_NUM];