Need Suggestions How to load the .3DS file+ .jpg image in opengl

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

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 : Google Code Archive - Long-term storage for Google Code Project Hosting., 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,

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/

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

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:
[ul]
[li]It is a destructive compression, and you lose information.[/li][li]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.[/li][li]Loading jpg requires libraries or more programming effort, whereas BMP are easy to understand. One page algorithms are available freely.[/li][li]You don’t save any space in the installable delivery package, which is usually created using a good compression algorithm.[/li][/ul]

Thank you very much sir.

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?

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.

For to load jpeg files, you can use devIL How To Load and Display an Image with DevIL and OpenGL | Geeks3D
(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

[QUOTE=Bloodust;1239472]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/[/QUOTE]

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

[QUOTE=dukey;1239805]I tried assimp recently. The debug library compiled to 130meg in size. Quite terrifying really.
IMO lib3ds works better.[/QUOTE]

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 :smiley:

when i compiled it to a .lib file
it came out 130meg
6meg for a binary is still very large