@@ -235,7 +235,7 @@ GLProgram::~GLProgram()
235
235
GL::deleteProgram (_program);
236
236
}
237
237
238
-
238
+
239
239
clearHashUniforms ();
240
240
}
241
241
@@ -485,6 +485,9 @@ bool GLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source
485
485
if (compileTimeHeaders.empty ()) {
486
486
#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
487
487
headersDef = (type == GL_VERTEX_SHADER ? " precision mediump float;\n precision mediump int;\n " : " precision mediump float;\n precision mediump int;\n " );
488
+ // Bugfix to make shader variables types constant to be understood by the current Android Virtual Devices or Emulators. This will also eliminate the 0x501 and 0x502 OpenGL Errors during emulation.
489
+ #elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
490
+ headersDef = " #version 100\n precision mediump float;\n precision mediump int;\n " ;
488
491
#elif (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_LINUX && CC_TARGET_PLATFORM != CC_PLATFORM_MAC)
489
492
headersDef = (type == GL_VERTEX_SHADER ? " precision highp float;\n precision highp int;\n " : " precision mediump float;\n precision mediump int;\n " );
490
493
#endif
@@ -925,7 +928,7 @@ void GLProgram::setUniformsForBuiltins(const Mat4 &matrixMV)
925
928
926
929
if (_flags.usesP )
927
930
setUniformLocationWithMatrix4fv (_builtInUniforms[UNIFORM_P_MATRIX], matrixP.m , 1 );
928
-
931
+
929
932
if (_flags.usesMultiViewP )
930
933
{
931
934
Mat4 mats[4 ];
@@ -944,7 +947,7 @@ void GLProgram::setUniformsForBuiltins(const Mat4 &matrixMV)
944
947
Mat4 matrixMVP = matrixP * matrixMV;
945
948
setUniformLocationWithMatrix4fv (_builtInUniforms[UNIFORM_MVP_MATRIX], matrixMVP.m , 1 );
946
949
}
947
-
950
+
948
951
if (_flags.usesMultiViewMVP )
949
952
{
950
953
Mat4 mats[4 ];
@@ -1022,4 +1025,3 @@ inline void GLProgram::clearHashUniforms()
1022
1025
}
1023
1026
1024
1027
NS_CC_END
1025
-
0 commit comments