hi, problem with iOS-porting and shader compilation. plz help

hi, guys. I’m new with cocos2dx and had been working with it on windows for several months. now i am starting to port my game to IOS6.1. and now i ran into a runtime problem.

I managed to compile the game with xcode and run the ios-simulator, after loaded and presented a starting image (the grey coco nut picture), it crashed with console prompt:

Cocos2d: cocos2d: ERROR: Failed to compile shader:
precision highp float;
uniform mat4 CC_PMatrix;
uniform mat4 CC_MVMatrix;
uniform mat4 CC_MVPMatrix;
uniform vec4 CC_Time;
uniform vec4 CC_SinTime;
uniform vec4 CC_CosTime;
uniform vec4 CC_Random01;
//CC INCLUDES END
>
>
attribute vec4 a_position;
attribute vec2 a_texCoord;
attribute vec4 a_color;
attribute vec2 a_texCoord1;
>
#ifdef GL_ES
varying lowp vec4 v_fragmentColor;
varying mediump vec2 v_texCoord;
#else
varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
varying vec2 v_texCoord1;
#endif
>
void main()
{
gl_Position = CC_MVPMatrix * a_position;
v_fragmentColor = a_color;
v_texCoord = a_texCoord;
v_texCoord1 = a_texCoord1;
}
>
Cocos2d: cocos2d: ERROR: 0:31: Use of undeclared identifier ‘v_texCoord1’
>

seemingly the lines are from /cocos2dx/shaders/ccShader_SpiritMaskBlender_vert.h
it seems that the shader won’t compile on IOS but my game was working and running ok on windows till now.

what can i do with the shader. is it about the macro GL_ES and how can i fix it by least modification ?

in xcode-debug mode, the process stops at code line in file CCGLProgram.cpp .

glGetShaderiv(*shader, GL_COMPILE_STATUS, &status);
>
if (! status)
{

abort(); // debugger stops here
}

ah,yes, i am using an older cocos2dx, version 2.1beta3-2.1.0
since i know hardly nothing ’bout shaders, though learning, could good people tell me any hints? more details will be post when required.

THANK YOU for your attention. any help will be greately and heartfully appreciated.

:smiley: :smiley:

And, one more thing, had anyone ever tangled with the trouble of sem_timedwait on IOS ?…

update:

the solution is straight forward. and i changes the lines as below.

#ifdef GL_ES
varying lowp vec4 v_fragmentColor;
varying mediump vec2 v_texCoord;
varying vec2 v_texCoord1;
#else
varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
#endif

now it works and i got other problems to solve. THANKS ALL.