此顶点着色器代码适用于除Galaxy Note 2之外的所有设备。
gl_Position = uMVPMatrix * vPosition;
如果我将矩阵乘法反转为:
gl_Position = vPosition * uMVPMatrix;
我实际上可以让事情出现。
不幸的是,反过来需要我完全重写我的转换库。
有没有人知道可能导致这种情况的原因,这是设备的opengl驱动程序错误吗?
着色器代码
private final String vertexShaderCode =
// This matrix member variable provides a hook to manipulate
// the coordinates of the objects that use this vertex shader
"uniform mat4 uMVPMatrix;" +
"attribute vec4 vPosition;" +
"attribute vec2 a_TexCoordinate;" +
"varying vec2 v_TexCoordinate;" +
"void main() {" +
// the matrix must be included as a modifier of gl_Position
"v_TexCoordinate = a_TexCoordinate;" +
"gl_Position = uMVPMatrix * vPosition;" +
"}";
private final String fragmentShaderCode =
"precision mediump float;" +
"uniform sampler2D u_Texture;" +
"varying vec2 v_TexCoordinate;" +
"void main() {" +
" gl_FragColor = texture2D(u_Texture, v_TexCoordinate);" +
//" gl_FragColor = vec4(v_TexCoordinate, 0, 1);" +
"}";