LWJGL
May 23, 2013, 03:53:09 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Here Texture Loading by JXA !  (Read 14252 times)
broumbroum
Prolific Timewaster
****
Posts: 316



WWW
« on: April 21, 2009, 17: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.
Code:
Sf3Texture._loadTexture(BufferedImage, 0);
Loads a texture in a DataBuffer and
Code:
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
 Cheesy

EDIT : RFE posted with new zip package http://lwjgl.org/forum/index.php/topic,4181.0.html
Logged

Sf3JSwing project, code repo (Apache License) -  http://www.sourceforge.net/p/sf3jswing
Sf3jswing Project Forum - http://apps.sourceforge.net/phpbb/sf3jswing/
broumbroum
Prolific Timewaster
****
Posts: 316



WWW
« Reply #1 on: November 07, 2010, 14:13:00 »

Hi !
updated the link with a new zip, because of the last crash with the webservers, it was broken.
 Grin

EDIT : updated the BufferIO, for re-using of direct buffers (not a big deal =)
Logged

Sf3JSwing project, code repo (Apache License) -  http://www.sourceforge.net/p/sf3jswing
Sf3jswing Project Forum - http://apps.sourceforge.net/phpbb/sf3jswing/
jediTofu
Prolific Timewaster
****
Posts: 280



« Reply #2 on: November 07, 2010, 14:21:30 »

awesome, what image formats are supported?  what features are supported (scaling, cropping, etc.)?
Logged

cool story, bro
broumbroum
Prolific Timewaster
****
Posts: 316



WWW
« Reply #3 on: November 07, 2010, 14:29:43 »

That's supposed to be any by ImageIO.read(f) supported image formats...
Logged

Sf3JSwing project, code repo (Apache License) -  http://www.sourceforge.net/p/sf3jswing
Sf3jswing Project Forum - http://apps.sourceforge.net/phpbb/sf3jswing/
mstWeal
Newbie
*
Posts: 20


« Reply #4 on: November 28, 2010, 00: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  Roll Eyes

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)
Logged
jediTofu
Prolific Timewaster
****
Posts: 280



« Reply #5 on: November 28, 2010, 01:41:23 »

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  Roll Eyes

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)...
Logged

cool story, bro
broumbroum
Prolific Timewaster
****
Posts: 316



WWW
« Reply #6 on: November 28, 2010, 05: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 .
Wink

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

Sf3JSwing project, code repo (Apache License) -  http://www.sourceforge.net/p/sf3jswing
Sf3jswing Project Forum - http://apps.sourceforge.net/phpbb/sf3jswing/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!