Java TextureData Constructor中需要什么类型的信息?
尝试在jogl中创建TextureData对象时,根据某些文档,构造函数采用以下参数:Java TextureData Constructor中需要什么类型的信息?,java,opengl,jogl,Java,Opengl,Jogl,尝试在jogl中创建TextureData对象时,根据某些文档,构造函数采用以下参数: TextureData(GLProfile glp, int internalFormat, int width, int height, int border, int pixelFormat, int pixelType, boolean mipmap, boolean dataIsCompressed, boolean mustFlipVertically, Buffer buffer
TextureData(GLProfile glp,
int internalFormat,
int width,
int height,
int border,
int pixelFormat,
int pixelType,
boolean mipmap,
boolean dataIsCompressed,
boolean mustFlipVertically,
Buffer buffer,
TextureData.Flusher flusher)
“使用指定的参数构造新的TextureData对象,并且数据包含给定的缓冲区。”
我不知道什么类型的信息由“pixelFormat”int、“PixelType”int和flusher表示。有人能解释一下吗?这取决于您提供的图像数据的类型
对于.png,它是GL_RGBA和GL_UNSIGNED_字节。pixelFormat和pixelType可能与glTexImage2D中的格式和类型参数相同。你看过它的Java文档了吗?flusher是可选的,允许释放TextureData对象使用的本机内存,它通常用于销毁直接NIO缓冲区。您不能在您的案例中使用TextureIO.newTextureData()吗?用户3256930是对的。