OpenGL ES的黑色质感的Nexus S [英] OpenGL ES black texture on Nexus S

查看:161
本文介绍了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.

任何人有什么想法?

推荐答案

的<一个href="http://stackoverflow.com/questions/13259263/gles20-texture-not-working-on-some-devices/13259504#13259504">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);

这篇关于OpenGL ES的黑色质感的Nexus S的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆