您如何在LWJGL中使用非2幂纹理? [英] How do you use not-power-of-2 textures in LWJGL?

查看:72
本文介绍了您如何在LWJGL中使用非2幂纹理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Slick Util的Texture类为lwjgl加载纹理,但是显然这会迫使您的纹理的幂为2.

I'm using Slick Util's Texture class to load textures for lwjgl, but apparently that forces your texture to a power of 2.

您将如何使用不是2的幂的纹理? (我真的不想在图像的边缘添加透明像素以使其为2的幂.)

How would you use a texture that's not a power of 2? (I really don't want to add transparent pixels to the edge of the image to make it a power of 2.)

我在某个地方看到了可行的方法,但是我找不到任何方法.

I've seen somewhere that it's possible, but I can't find any way of doing it.

推荐答案

stick-utils软件包强制您使用二次幂纹理的原因是图形卡要加载的原因.在可能的情况下,应将所有图像打包成较大的2幂次方纹理,然后从中进行绘制,而不是分别加载所有纹理.

The reason the stick-utils package forces you to use power-of-two textures is this is what graphics cards like to load. Where possible, you should pack all your images in to a large power-of-two texture and draw from that instead of loading all the textures separately.

因此,虽然并非不可能,但有一定理由使其变得困难.

So whilst it's not impossible, there is a reason it is made hard.

这篇关于您如何在LWJGL中使用非2幂纹理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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