jpg loader for .3ds textures

  • Follow


Hi,

I have a 3d engine (visual c++ native) based on Opengl.
I recently injected some code to load and display .3ds objects.
However, the code uses only supplied .bmp textures, with
the objects. So, I want to include a .jpg loader to
supplement the .bmp loading. Especially, because almost
all textures with 3ds objects are jpg format nowadays.

I need to convert the jpg's to bitmap format. I read some info on 
OleLoadPicture,
and IPicture, but I think they only load and display, without
converting to bmp format. In my own code I use a LoadBitmapFile()
function and then use the flat image data.

Can anyone give me some sensible solutions for this?

Thanks,

MK


0
Reply x380 (3) 2/13/2010 3:37:44 AM

Hello
You have several libraries that performs jpeg compression/decompression 
like for exemple libjpeg:
http://en.wikipedia.org/wiki/Libjpeg
This kind of library, after calling the right function, returns a buffer 
with raw data that you can directly send to glTexImage2D (I personaly 
use libpng as I prefer non destructive format).
Hope this helps
Cathy L.


Starglider 4 a �crit :
> Hi,
> 
> I have a 3d engine (visual c++ native) based on Opengl.
> I recently injected some code to load and display .3ds objects.
> However, the code uses only supplied .bmp textures, with
> the objects. So, I want to include a .jpg loader to
> supplement the .bmp loading. Especially, because almost
> all textures with 3ds objects are jpg format nowadays.
> 
> I need to convert the jpg's to bitmap format. I read some info on 
> OleLoadPicture,
> and IPicture, but I think they only load and display, without
> converting to bmp format. In my own code I use a LoadBitmapFile()
> function and then use the flat image data.
> 
> Can anyone give me some sensible solutions for this?
> 
> Thanks,
> 
> MK
> 
> 
0
Reply Cathy 2/13/2010 6:54:27 AM


Hi Cathy,

That's great! (msdn didn't really yield much of a result.)
I will take a good look at both, but could you tell me in
advance, which one (or maybe another one) is the easiest/fastest to 
implement?
Since i have a complete engine and game to develop,
I try to spend as little time and energy on every single
subject. (It's just a monster-load of work.)

Thanks,

MK


"Cathy L." <nob@now.fr> schreef in bericht 
news:4b764cad$0$21313$426a74cc@news.free.fr...
> Hello
> You have several libraries that performs jpeg compression/decompression 
> like for exemple libjpeg:
> http://en.wikipedia.org/wiki/Libjpeg
> This kind of library, after calling the right function, returns a buffer 
> with raw data that you can directly send to glTexImage2D (I personaly use 
> libpng as I prefer non destructive format).
> Hope this helps
> Cathy L.
>
>
> Starglider 4 a �crit :
>> Hi,
>>
>> I have a 3d engine (visual c++ native) based on Opengl.
>> I recently injected some code to load and display .3ds objects.
>> However, the code uses only supplied .bmp textures, with
>> the objects. So, I want to include a .jpg loader to
>> supplement the .bmp loading. Especially, because almost
>> all textures with 3ds objects are jpg format nowadays.
>>
>> I need to convert the jpg's to bitmap format. I read some info on 
>> OleLoadPicture,
>> and IPicture, but I think they only load and display, without
>> converting to bmp format. In my own code I use a LoadBitmapFile()
>> function and then use the flat image data.
>>
>> Can anyone give me some sensible solutions for this?
>>
>> Thanks,
>>
>> MK
>> 

0
Reply Starglider 2/13/2010 7:38:58 PM

Hello
I just can't tell you, I only use libPNG (which needed to be rebuilt for 
me) and have no reason to change.
No idea for the others...
Cathy L.

Starglider 4 a �crit :
> Hi Cathy,
> 
> That's great! (msdn didn't really yield much of a result.)
> I will take a good look at both, but could you tell me in
> advance, which one (or maybe another one) is the easiest/fastest to 
> implement?
> Since i have a complete engine and game to develop,
> I try to spend as little time and energy on every single
> subject. (It's just a monster-load of work.)
> 
> Thanks,
> 
> MK
> 
> 
> "Cathy L." <nob@now.fr> schreef in bericht 
> news:4b764cad$0$21313$426a74cc@news.free.fr...
>> Hello
>> You have several libraries that performs jpeg compression/decompression 
>> like for exemple libjpeg:
>> http://en.wikipedia.org/wiki/Libjpeg
>> This kind of library, after calling the right function, returns a buffer 
>> with raw data that you can directly send to glTexImage2D (I personaly use 
>> libpng as I prefer non destructive format).
>> Hope this helps
>> Cathy L.
>>
>>
>> Starglider 4 a �crit :
>>> Hi,
>>>
>>> I have a 3d engine (visual c++ native) based on Opengl.
>>> I recently injected some code to load and display .3ds objects.
>>> However, the code uses only supplied .bmp textures, with
>>> the objects. So, I want to include a .jpg loader to
>>> supplement the .bmp loading. Especially, because almost
>>> all textures with 3ds objects are jpg format nowadays.
>>>
>>> I need to convert the jpg's to bitmap format. I read some info on 
>>> OleLoadPicture,
>>> and IPicture, but I think they only load and display, without
>>> converting to bmp format. In my own code I use a LoadBitmapFile()
>>> function and then use the flat image data.
>>>
>>> Can anyone give me some sensible solutions for this?
>>>
>>> Thanks,
>>>
>>> MK
>>>
> 
0
Reply Cathy 2/13/2010 9:54:29 PM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2010-02-13, Starglider 4 <x@pln.nl> wrote:
> Hi,
>
> I have a 3d engine (visual c++ native) based on Opengl.
> I recently injected some code to load and display .3ds objects.
> However, the code uses only supplied .bmp textures, with
> the objects. So, I want to include a .jpg loader to
> supplement the .bmp loading. Especially, because almost
> all textures with 3ds objects are jpg format nowadays.
>
> I need to convert the jpg's to bitmap format. I read some info on 
> OleLoadPicture,
> and IPicture, but I think they only load and display, without
> converting to bmp format. In my own code I use a LoadBitmapFile()
> function and then use the flat image data.
>
> Can anyone give me some sensible solutions for this?

Have a look at DevIL. It's an Image Loading library that supports a multitude 
of formats, and has an API vaguely similar to that of OpenGL so should 
hopefully fit into your current system reasonably easily. I *think* that it 
actually uses libjpeg, libpng, etc to load the files themselves but wraps it 
in a single consistent layer...

- -- 
Graham Cox

Little girls, like butterflies, need no excuse.
		-- Lazarus Long
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkt5HAIACgkQggFs/sc4TsewaACcDoavpPVl/KZDdM2c5/G9bwt6
yp0AniAkNqLDe9Tcu3knBCEce4A9P2E7
=lPNo
-----END PGP SIGNATURE-----
0
Reply Graham 2/15/2010 10:03:46 AM

"Graham" <graham@grahamcox.co.uk> wrote in message 
news:7tskg2F34vU1@mid.individual.net...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 2010-02-13, Starglider 4 <x@pln.nl> wrote:
>> Hi,
>>
>> I have a 3d engine (visual c++ native) based on Opengl.
>> I recently injected some code to load and display .3ds objects.
>> However, the code uses only supplied .bmp textures, with
>> the objects. So, I want to include a .jpg loader to
>> supplement the .bmp loading. Especially, because almost
>> all textures with 3ds objects are jpg format nowadays.
>>
>> I need to convert the jpg's to bitmap format. I read some info on
>> OleLoadPicture,
>> and IPicture, but I think they only load and display, without
>> converting to bmp format. In my own code I use a LoadBitmapFile()
>> function and then use the flat image data.
>>
>> Can anyone give me some sensible solutions for this?
>
> Have a look at DevIL. It's an Image Loading library that supports a 
> multitude
> of formats, and has an API vaguely similar to that of OpenGL so should
> hopefully fit into your current system reasonably easily. I *think* that 
> it
> actually uses libjpeg, libpng, etc to load the files themselves but wraps 
> it
> in a single consistent layer...

It's interesting you say that purchased 3D objects use JPEG, I was under the 
impression than not only is it 'lossy' but also takes relative long time to 
unpack.
I use libPNG, and automate a PNG conversion process with an art package.



0
Reply Foots 2/16/2010 3:54:47 PM

Here's a bit of code that uses libjpeg to decode an image.

http://www.devise3d.org/devise3d/doxygen/html/TsJPEGDecoder_8cxx-source.html

For comparison, similar code using libpng.

http://www.devise3d.org/devise3d/doxygen/html/TsPNGDecoder_8cxx-source.html

Cheers,
Peter



In article <4b761e95$0$14117$703f8584@textnews.kpn.nl>, x@pln.nl says...
> 
> Hi,
> 
> I have a 3d engine (visual c++ native) based on Opengl.
> I recently injected some code to load and display .3ds objects.
> However, the code uses only supplied .bmp textures, with
> the objects. So, I want to include a .jpg loader to
> supplement the .bmp loading. Especially, because almost
> all textures with 3ds objects are jpg format nowadays.
> 
> I need to convert the jpg's to bitmap format. I read some info on 
> OleLoadPicture,
> and IPicture, but I think they only load and display, without
> converting to bmp format. In my own code I use a LoadBitmapFile()
> function and then use the flat image data.
> 
> Can anyone give me some sensible solutions for this?
> 
> Thanks,
> 
> MK


0
Reply Peter 2/17/2010 3:32:29 AM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2010-02-16, Foots <turn@invalid.com> wrote:
>
> It's interesting you say that purchased 3D objects use JPEG, I was under the 
> impression than not only is it 'lossy' but also takes relative long time to 
> unpack.
> I use libPNG, and automate a PNG conversion process with an art package.
>
Not sure wher eyou got the "purchased 3D objects" thing from, but I doubt they 
would use Jpegs for the very reason you said - Jpegs are lossy. 

I recommended DevIL from personal experience because I use it with both Pngs 
and DDSs, plus it allows you to use almost any (sane) image format you want in  
your app with potentially zero changes required to the code itself...

- -- 
Graham Cox

Television has brought back murder into the home -- where it belongs.
		-- Alfred Hitchcock
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkt8HkUACgkQggFs/sc4TsevHwCcCRwVyBJ5kBlGdR0kT9KbH3dE
ObcAnRu1nH+XeTEan9+otgvcAtsRSnKD
=AY6H
-----END PGP SIGNATURE-----
0
Reply Graham 2/17/2010 4:50:13 PM

"Graham" <graham@grahamcox.co.uk> wrote in message 
news:7u2l25Fe48U1@mid.individual.net...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 2010-02-16, Foots <turn@invalid.com> wrote:
>>
>> It's interesting you say that purchased 3D objects use JPEG, I was under 
>> the
>> impression than not only is it 'lossy' but also takes relative long time 
>> to
>> unpack.
>> I use libPNG, and automate a PNG conversion process with an art package.
>>
> Not sure wher eyou got the "purchased 3D objects" thing from, but I doubt 
> they
> would use Jpegs for the very reason you said - Jpegs are lossy.
>
> I recommended DevIL from personal experience because I use it with both 
> Pngs
> and DDSs, plus it allows you to use almost any (sane) image format you 
> want in
> your app with potentially zero changes required to the code itself...
>
> - -- 
> Graham Cox

The OP said "Especially, because almost all textures with 3ds objects are 
jpg format nowadays."
Which sounds like ordered objects to me, rather than in house artists.
I'll have a look at DevIL at some point, but I'm happy with libpng at the 
moment myself. Thanks though.
Dave





0
Reply Foots 2/18/2010 1:15:31 PM

8 Replies
849 Views

(page loaded in 0.112 seconds)

Similiar Articles:













7/23/2012 3:58:26 PM


Reply: