纹理自动换行模式重复不工作 [英] Texture wrap mode repeat is not working

查看:276
本文介绍了纹理自动换行模式重复不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Android手机平台,与OpenGL ES 2.0的。

I am using the Android mobile platform, with OpenGL ES 2.0.

当我做一个纹理像这样,在我的场景贴图正确绘制

When I make a texture like so, the textures in my scene draw correctly

 //Generate there texture pointer
 GLES20.glGenTextures(1, textureHandle, 0);

    // parameters - we have to make sure we clamp the textures to the edges!!!
            GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[0]);
    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);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER,GLES20.GL_LINEAR);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER,GLES20.GL_LINEAR);

不过,我希望能够滚动纹理,我相信设置自动换行模式为GLES20.GL_REPEAT将使得所需的计算更可能的。但是,使用code,如下面的时候。

However, I want to be able to scroll a texture, and I believe setting the wrap mode to GLES20.GL_REPEAT would make the needed calculation more possible. However, when using code such as below.

            //Generate there texture pointer
            GLES20.glGenTextures(1, textureHandle, 0);

    // parameters - we have to make sure we clamp the textures to the edges!!!
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[0]);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S,GLES20.GL_REPEAT);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,GLES20.GL_REPEAT);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER,GLES20.GL_LINEAR);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER,GLES20.GL_LINEAR);

每质感的黑色。我在这里所做的唯一的区别是GLES20.GL_REPEAT参数名称在调用GLES20.glTexParameteri设置。这看起来非常奇怪。有没有人有一些想法分享?

Every texture is black. The only difference I have made here is the setting of the GLES20.GL_REPEAT parameter name in the call to GLES20.glTexParameteri. This seems really odd. Does anyone have some ideas to share?

我AP preciate任何帮助。
谢谢你。

I appreciate any help. Thanks.

推荐答案

是纹理大小的两(POT)的权力?如果没有,有自动换行模式为NPOT纹理一定的局限性,只能GL_CLAMP_TO_EDGE支持在这种情况下,这是你所看到的。

Is the texture sizes power of two (POT)? If not, there is some limitations on the wrap modes for NPOT textures, only GL_CLAMP_TO_EDGE is supported in that case, which is what you're seeing.

这篇关于纹理自动换行模式重复不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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