Yes, i'm using my custom shader. There is no warning or error for the shader. It seems like Broadcom is behaving different compared to PowerVR chip.
Here's my custom shader,
vertex shader:
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform mat4 textureMatrix;
uniform vec4 additionalColor;
uniform vec4 ambientColor;
uniform float shininess;
uniform int lightCount;
uniform mat4 skinPalette[17];
uniform vec3 lightPositions[8];
uniform vec3 diffuseColors[8];
uniform vec3 specularColors[8];
uniform float attenuation[8];
attribute vec4 position;
attribute vec3 normal;
attribute vec2 texture0;
attribute vec2 texture1;
attribute vec4 skinWeights;
attribute vec4 skinJointIndices;
varying vec2 texCoord[4];
varying vec4 vertexColor;
void main() {
texCoord[0] = texture0;
texCoord[1] = (textureMatrix * vec4(texture1, 0, 1)).xy;
vec4 myPosition = vec4(0,0,0,0);
vec3 myNormal = vec3(0,0,0);
vec4 vertexTemp;
vec3 normalTemp;
mat4 mat;
mat = skinPalette[int(skinJointIndices[0])];
vertexTemp = mat * position;
vertexTemp *= skinWeights.x;
myPosition += vertexTemp;
normalTemp = mat3(mat) * normal;
normalTemp *= skinWeights.x;
myNormal += normalTemp;
mat = skinPalette[int(skinJointIndices[1])];
vertexTemp = mat * position;
vertexTemp *= skinWeights.y;
myPosition += vertexTemp;
normalTemp = mat3(mat) * normal;
normalTemp *= skinWeights.y;
myNormal += normalTemp;
vec4 vertexPos = modelViewMatrix * myPosition;
vertexColor = ambientColor;
if (lightCount>0) {
// This is correct only if the modelview matrix is orthogonal. In jPCT-AE, it always is...unless you fiddle around with it.
vec3 normalEye = normalize(modelViewMatrix * vec4(myNormal, 0.0)).xyz;
float angle = dot(normalEye, normalize(lightPositions[0] - vertexPos.xyz));
if (angle > 0.0) {
vertexColor += vec4((diffuseColors[0] * angle + specularColors[0] * pow(angle, shininess))*(1.0/(1.0+length(lightPositions[0] - vertexPos.xyz)*attenuation[0])), 1) * additionalColor;
}
}
gl_Position = modelViewProjectionMatrix * myPosition;
}
skinPalette, skinWeights, skinJointIndices are the variables for hardware skinning.
fragment shader:
precision mediump float;
uniform sampler2D textureUnit0;
uniform sampler2D textureUnit1;
uniform int textureCount;
varying vec2 texCoord[4];
varying vec4 vertexColor;
void main() {
vec4 col = texture2D(textureUnit0, texCoord[0]) * vertexColor;
gl_FragColor=col;
}
In addition, I tried with this edited default vertex shader with fragment shader above:
vertex shader:
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform mat4 textureMatrix;
uniform vec4 additionalColor;
uniform vec4 ambientColor;
uniform float shininess;
uniform int lightCount;
uniform vec3 lightPositions[8];
uniform vec3 diffuseColors[8];
uniform vec3 specularColors[8];
uniform float attenuation[8];
attribute vec4 position;
attribute vec3 normal;
attribute vec2 texture0;
attribute vec2 texture1;
varying vec2 texCoord[4];
varying vec4 vertexColor;
void main() {
texCoord[0] = texture0;
texCoord[1] = (textureMatrix * vec4(texture1, 0, 1)).xy;
vec4 vertexPos = modelViewMatrix * position;
vertexColor = ambientColor;
if (lightCount>0) {
// This is correct only if the modelview matrix is orthogonal. In jPCT-AE, it always is...unless you fiddle around with it.
vec3 normalEye = normalize(modelViewMatrix * vec4(normal, 0.0)).xyz;
float angle = dot(normalEye, normalize(lightPositions[0] - vertexPos.xyz));
if (angle > 0.0) {
vertexColor += vec4((diffuseColors[0] * angle + specularColors[0] * pow(angle, shininess))*(1.0/(1.0+length(lightPositions[0] - vertexPos.xyz)*attenuation[0])), 1) * additionalColor;
}
}
gl_Position = modelViewProjectionMatrix * position;
}
The result is even more strange. The object shows only part of it, and the rest of polygons are not showed. But it looks fine in other devices.