Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

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

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2011
    Location
    seoul, south korea
    Posts
    15

    Smile 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

  2. #2
    Intern Newbie
    Join Date
    Jun 2010
    Posts
    41
    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,

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2012
    Posts
    6
    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/

  4. #4
    Junior Member Newbie
    Join Date
    Aug 2011
    Location
    seoul, south korea
    Posts
    15
    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

  5. #5
    Junior Member Regular Contributor Kopelrativ's Avatar
    Join Date
    Apr 2011
    Posts
    212
    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.

  6. #6
    Junior Member Newbie
    Join Date
    Aug 2011
    Location
    seoul, south korea
    Posts
    15
    Thank you very much sir.

  7. #7
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    895
    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?

    Quote Originally Posted by Kopelrativ
    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.

  8. #8
    Junior Member Regular Contributor
    Join Date
    Jan 2011
    Location
    Paris, France
    Posts
    230

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

    For to load jpeg files, you can use devIL http://www.geeks3d.com/20090105/tuto...vil-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

    Or use the lib3ds as suggested by Shadoko :

    http://www.donkerdump.nl/node/207
    http://www.gamedev.net/topic/623094-...exture-mapping
    Last edited by The Little Body; 07-07-2012 at 10:32 AM. Reason: add links for 3DS loading
    @+
    Yannoo

  9. #9
    Member Regular Contributor
    Join Date
    Dec 2007
    Posts
    250
    Quote Originally Posted by Bloodust View Post
    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.

  10. #10
    Junior Member Newbie
    Join Date
    Jun 2012
    Posts
    6
    Quote Originally Posted by dukey View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •