2012-11-25 19 views
0

我試圖創建一個新的紋理:爲什麼TextureIO不接受newTexture(BufferedImage中,布爾

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

,但得到

在類型TextureIO方法newTexture(File, boolean)是不適用於arguments (BufferedImage, boolean)

我進口

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

根據Javadoc應該閱讀newTexture(BufferedImage, Boolean)

那麼我做錯了什麼?

回答

1

最後,我決定將圖像直接投射到新紋理中。

我的代碼看起來像

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

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

感謝所有誰看着。

JC

1

其實,線程有點舊,但我的答案可能會幫助其他人。在JOGL2中(與JOGL1.1相反),您必須使用AWTTextureIO加載BufferedImages,即Texture t = AWTTextureIO.newTexture(profile, image,true);,其中profile是您當前的GLProfile。