LWJGL Forum

Archive => DevIL => Topic started by: broumbroum on April 22, 2009, 00:17:33

Title: Here Texture Loading by JXA !
Post by: broumbroum on April 22, 2009, 00:17:33
Hi all ! Since some have asked for this, I'm just releasing a limited TEXTURE LOADING pack for the LWJGL.org forum here.
there are at most 3 java classes files.
Sf3Texture._loadTexture(BufferedImage, 0);
Loads a texture in a DataBuffer and
validatePixelBuffer();
converts the DataBuffer to any format you want : specify a GL Texture format as _ExtAbgr value and you're on (hopefully) !

Sf3Texture is HIGHLY INSPIRED BY DevIL TextureLoader class I've been found on the web last year. LoL
:D

EDIT : RFE posted with new zip package http://lwjgl.org/forum/index.php/topic,4181.0.html
Title: Re: Here Texture Loading by JXA !
Post by: broumbroum on November 07, 2010, 22:13:00
Hi !
updated the link with a new zip, because of the last crash with the webservers, it was broken.
;D

EDIT : updated the BufferIO, for re-using of direct buffers (not a big deal =)
Title: Re: Here Texture Loading by JXA !
Post by: jediTofu on November 07, 2010, 22:21:30
awesome, what image formats are supported?  what features are supported (scaling, cropping, etc.)?
Title: Re: Here Texture Loading by JXA !
Post by: broumbroum on November 07, 2010, 22:29:43
That's supposed to be any by ImageIO.read(f) supported image formats...
Title: Re: Here Texture Loading by JXA !
Post by: mstWeal on November 28, 2010, 08:56:56
Cool, I can make good use of that. My own texture loading routine is not as performant as it could be as I had problems with some PNGs. On my computer they would show up normal and on a friends computer they looked bluish. If I changed from RGB to BGR it looked ok for my friend but blueish on my machine ^ ^ Therefore I always copy the complete image into another temporary BufferedImage, which makes my texture loading about twice expensive as it should be  ::)

How about including this officially into LWJGL? Maybe not into the core but as optional extension. I see two main reasons for that:
- If these would be official classes they would receive the same treatment as any other LWJGL class when making changes to LWJGL (otherwise a future LWJGL version could make the classes incompatible)
- Pretty much every game developer needs the ability to load textures. If you program it yourself you might not end up with a solution that is as performant as it could be (see my example above)
Title: Re: Here Texture Loading by JXA !
Post by: jediTofu on November 28, 2010, 09:41:23
Quote from: mstWeal on November 28, 2010, 08:56:56
Cool, I can make good use of that. My own texture loading routine is not as performant as it could be as I had problems with some PNGs. On my computer they would show up normal and on a friends computer they looked bluish. If I changed from RGB to BGR it looked ok for my friend but blueish on my machine ^ ^ Therefore I always copy the complete image into another temporary BufferedImage, which makes my texture loading about twice expensive as it should be  ::)

How about including this officially into LWJGL? Maybe not into the core but as optional extension. I see two main reasons for that:
- If these would be official classes they would receive the same treatment as any other LWJGL class when making changes to LWJGL (otherwise a future LWJGL version could make the classes incompatible)
- Pretty much every game developer needs the ability to load textures. If you program it yourself you might not end up with a solution that is as performant as it could be (see my example above)

The recommended way is actually Slick-Util (can also load fonts and sounds/music):
http://slick.cokeandcode.com/wiki/doku.php?id=loading_and_binding_opengl_textures_with_slick-util
http://slick.cokeandcode.com/downloads/util/
http://slick.cokeandcode.com/javadoc-util/

I completely agree that it would be nice to have LWJGL already include image/music loading.  It does have built-in wave loading.  However, I'd rather it not use ImageIO (which Slick-Util and most image libraries out there use)...
Title: Re: Here Texture Loading by JXA !
Post by: broumbroum on November 28, 2010, 13:53:29
I've never been using slick, because I've got good performance with my code.
@jeditofu I also have coded a Sound loading class, which I could provide here. It relies on the same BufferIO class, and has some calls to the jlayer API when handling mp3's. I'll look for an upload soon.
@mstWeal thank you for your feedback, you're welcome ! You may want to post your comment on sf.net/projects/sf3jswing for rating  (http://sourceforge.net/projects/sf3jswing/reviews).
;)

EDIT : I'll post an [RFE] soon. cu
EDIT : RFE posted http://lwjgl.org/forum/index.php/topic,4181.0.html