我正在使用 lwjgl 的端口stb_image
来加载jpg
图像。问题是,我总是得到一个null
,ByteBuffer
因为什么都没有加载。这是代码:
int[] width = new int[1], height = new int[1], nrChannels = new int[1];
ByteBuffer data = stbi_load("/textures/container.jpg",width, height,nrChannels,0);
if(data == null)
throw new RuntimeException("Failed to load texture."); //I get this exception.
我的纹理的位置:
我当然是这样尝试的:
ByteBuffer data = stbi_load("container.jpg",width, height,nrChannels,0);
同样的结果,没有加载。我究竟做错了什么?