0

我正在尝试创建一个新纹理:

BufferedImage image = ImageIO.read(new File("firstImage.jpg"));
Texture t = TextureIO.newTexture(image,true);  

但是得到

newTexture(File, boolean)类型中的方法TextureIO不适用于arguments (BufferedImage, boolean).

我在进口

import com.jogamp.opengl.util.texture.TextureIO;

根据Javadoc应该阅读哪个newTexture(BufferedImage, Boolean)

那么我做错了什么?

4

2 回答 2

1

最后我决定把图片直接扔到newTexture中。

我的代码看起来像

//BufferedImage im = ImageIO.read(new File("image.jpg"));

Texture t = TextureIO.newTexture(new File("image.jpg"),true);

感谢所有看过的人。

JC

于 2012-11-26T06:13:26.380 回答
1

实际上,该线程有点旧,但我的回答可能对其他人有所帮助。在 JOGL2(与 JOGL1.1 相反)中,您必须使用 AWTTextureIO 来加载 BufferedImages,即Texture t = AWTTextureIO.newTexture(profile, image,true);profile您当前的 GLProfile 在哪里。

于 2014-03-05T17:30:33.693 回答