3

I'm working on a game which runs quite well on a lot of Android devices (Lexus 7, SG ACe, HTC Desire ...). But especially for SGS1, I can't get better than a black screen. After investigating a lot into the whole code, I think that the problem is located in my shader code. Compilation is ok, link too, but I hear about some incompatibility between different GPU (here http://www.jpct.net/forum2/index.php/topic,2833.15.html for example)

Here's the shader code :

[VERTEX]

uniform mat4 uMVPMatrix;    // Ortho matrix
attribute vec2 vPosition;   // Vertex position
void main(){
    gl_Position = uMVPMatrix * vec4(vPosition, 0.0, 1.0);
}

[FRAGMENT]

precision mediump float;
uniform lowp vec4 CurColor;
void main(){
    gl_FragColor = CurColor;
}

Maybe something is obviously wrong in this, even if it is very basic ? Thank you in advance.

4

2 回答 2

1

我终于弄明白了。我有两个问题:

1) PowerVR 似乎不喜欢制服的“lowp”限定词

2) 在其他着色器中,我为 vPosition 设置了“vec4”,尽管我只通过顶点 (X,Y) 传递了 2 个组件。奇怪的是:为什么其他 GPU 可以处理这样的错误?像 mali (malideveloper.com/developer-resources/tools/...) 提供的那种检查器对于 PowerVR 来说会非常令人耳目一新!

于 2012-09-05T07:19:30.000 回答
0

这里有一些建议:

  • 尝试查看是否有任何 LogCat 错误
  • 看看是否glGetError()返回不同于 0 的东西
  • 更改清除颜色以查看屏幕是否保持黑色,如果更改,则您的对象是不可见的

在你尝试了其中一些之后给我评论。

于 2012-09-03T19:53:43.737 回答