OpenGL ES的黑色质感的Nexus S
OpenGL的code在Nexus One上,工程不会对的Nexus S.正常工作 纹理似乎并没有呈现,我只剩下黑色纹理的地方应该是。
OpenGL code that works on the Nexus One will not work properly on the Nexus S. Textures don't seem to render and I'm left with just black where textures should be.
任何人有什么想法?
的accepted这里的回答给出的解决了这个问题稍微深入的比我会的,但在这个黑屏问题,并从的Nexus S(和一些其他设备)的出现是严密的关于幂的两个纹理,它并不意味着纹理需要有维度是氧分压。
The accepted answer given here addresses this issue in slightly more depth than I will, but while this black screen issue does arise from the Nexus S (and some other devices) being strict about power-of-two textures, it does not mean that textures need to have dimensions that are a Po2.
在纹理加载code,有可能有下面几行:
In the texture loading code, one may have the following lines:
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
如果这个code被修改,以增加两个线夹紧,然后手机的会支持nPo2纹理提供的一个是确定与夹紧。这里是code与添加的夹紧:
and if this code is modified to add two more lines for clamping, then the phone will support nPo2 textures provided one is ok with clamping. Here is the code with the added clamping:
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);