Android opengl es 和白色纹理

发布于 2024-12-29 07:19:19 字数 194 浏览 2 评论 0原文

我正在 Android 上使用 OpenGL ES 编写一个简单的 2D 游戏。问题在于,某些纹理仅渲染白色条,而不是实际图像。

加载纹理和绑定纹理期间都没有错误。所有纹理的大小都是 2 的幂。

我正在使用扩展 glDrawTexfOES 来绘制纹理。 我怀疑 GPU 内存可能已用完,但如何检查呢?还有其他想法吗?

I'm writing a simple 2D game on Android using OpenGL ES. The problem is that, instead of actual image for some textures only white bar is rendered.

There was neither error during loading textures nor during binding them. All the textures have power of 2 size.

I'm using extension glDrawTexfOES to draw textures.
I suspect that I might be running out of GPU memory, but how do I check that? Any other ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亽野灬性zι浪 2025-01-05 07:19:19

您应该通过两种方式增强代码:

  1. 设置 tex 参数
  2. 设置裁剪参数

类似的 Android 调用是

((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, new int[]{0,0,100,100},0);

在众多其他答案中,有一个指出只需设置 2D 投影的所有内容并绘制一个四边形。

You should enhance the code in two ways:

  1. Set tex parameters
  2. Set crop parameters

The analogous Android call is

((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, new int[]{0,0,100,100},0);

Amongst loads of other answers, there is one stating to just setup everything for 2D projection and draw a quad.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文