PDA

View Full Version : Need Suggestions How to load the .3DS file+ .jpg image in opengl



chethan
06-28-2012, 08:06 PM
Hi, Advance thanks.

1. I need the information about how it is possible to load?
2. what are things we have to Keep in mind to load .3ds file with image?


thanks and regards
mysmax

shadocko
06-29-2012, 08:10 AM
Hello,

Your question is not really related to OpenGL.
If you mean you want to load 3DS models then display them using OpenGL, you should look at it as 2 separate subproblems:
1. load 3DS file to a data structure of your choice,
2. display that data using OpenGL.

For the loading part, you might want to look at readily available libraries. Googling for "3DS library" brought up this one : http://code.google.com/p/lib3ds/, which doesn't look bad.

For displaying the model with OpenGL, I suggest you look for information about vertex buffer objects and try to figure out how to store your vertex + index data in those.

Regards,

Bloodust
06-29-2012, 01:36 PM
If you dont want to be limited to 3DS models only, I suggest you look into assimp http://assimp.sourceforge.net/
It can load different models into an intermediate format that you can easily parse and display.
For images I suggest Freeimage http://freeimage.sourceforge.net/

chethan
06-29-2012, 11:43 PM
Sir, Thank you very much for your suggestion. I had googled and collected some sample of 3ds loader but I am faceing a problem with texture and materials render. I had seen a statement in the Lib3ds tutorial that it dont support the texture render. If you have a experience in this please share me.

thanks and regards
mysmax

Kopelrativ
07-02-2012, 12:02 AM
Why do you want to load jpg-files?

One advantage with jpg is that they are smaller than uncompressed files. But this is not really much of an advantage compared to common BMP files:

It is a destructive compression, and you lose information.
When you load it into OpenGL, it is unpacked. That means you don't save any GPU memory, which can be important indeed. There are options to use compressed bitmap formats in OpenGL.
Loading jpg requires libraries or more programming effort, whereas BMP are easy to understand. One page algorithms are available freely.
You don't save any space in the installable delivery package, which is usually created using a good compression algorithm.

chethan
07-04-2012, 02:05 AM
Thank you very much sir.

thokra
07-04-2012, 03:22 AM
chethan: Am I right in thinking that you have a .3Ds model or scene and some textures along with it which you want to render using OpenGL?


When you load it into OpenGL, it is unpacked.

You don't load image files encoded in some format into OpenGL - you don't even load anything into OpenGL (OpenGL isn't a tangible entity). You make raw pixel data available to the implementation (i.e. what comes with the driver) by using the various functions OpenGL specifies. OpenGL specifies no functionality whatsoever to import images in any image file format. You load and decode/decompress an image file into memory using some 3rd party lib. Then you tell your OpenGL implementation to take the raw data and put it into a texture object - or texture buffer or any other object with storage that makes sense in the current situation. I think you meant that but what you write suggests something different. The thread starter seems to be starting out with OpenGL and might get a false impression of what OpenGL offers.

The Little Body
07-07-2012, 09:48 AM
For to load jpeg files, you can use devIL http://www.geeks3d.com/20090105/tutorial-how-to-load-and-display-an-image-with-devil-and-opengl
(it was very simple to use and work too with a lot of others graphics file formats than .jpg files)

For to load 3DS files, this link can perhaps help you for an internal point of view of 3DS files :

http://files.codes-sources.com/fichier.aspx?id=29470&f=3DSLoader.cpp
(http://files.codes-sources.com/fichier.aspx?id=29470&f=3DSLoader.cpp)
Or use the lib3ds as suggested by Shadoko :

http://www.donkerdump.nl/node/207
http://www.gamedev.net/topic/623094-lib3ds-and-texture-mapping

dukey
07-08-2012, 02:20 AM
If you dont want to be limited to 3DS models only, I suggest you look into assimp http://assimp.sourceforge.net/
It can load different models into an intermediate format that you can easily parse and display.
For images I suggest Freeimage http://freeimage.sourceforge.net/

I tried assimp recently. The debug library compiled to 130meg in size. Quite terrifying really.
IMO lib3ds works better.

Bloodust
07-08-2012, 02:46 AM
I tried assimp recently. The debug library compiled to 130meg in size. Quite terrifying really.
IMO lib3ds works better.

What?
The windows binaries that comes with the package are
6.35MB debug dll + 0.227MB debug lib
4.41MB release dll + 0.227MB release lib
I have no idea how you came up with 130MB size debug library but something obviously broke in the process :D

dukey
07-08-2012, 04:57 AM
when i compiled it to a .lib file
it came out 130meg
6meg for a binary is still very large