Results 1 to 7 of 7

Thread: Loading and setting a 3d object in Opengl.

  1. #1
    Member Contributor
    Join Date
    Apr 2007
    Posts
    80

    Loading and setting a 3d object in Opengl.

    Hi!

    i want to load in my scene an object 3ds.

    What is the fastest way? Should i convert it first to any native format of OpenGL?

    I would like also to give to the 3d object the position of at least three of its coordinates. I mean:

    if my 3d object is a cube of 2x2x2, i would like to set the coordinate (0,0,0) of the cube in some position of space OpenGL, the coordinate (2,0,0) in another position of the space, and the coordinate (0,2,0) in another position. Is it possible?

  2. #2

    Re: Loading and setting a 3d object in Opengl.

    What operating system / language are you using please?

    OS X with Objective-C, Windoze MFC with C++, Linux with GLUT, etc.?

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jun 2006
    Location
    Edinburgh - Scotland
    Posts
    146

    Re: Loading and setting a 3d object in Opengl.

    There are lots of .3DS loaders out there. My first google turned up

    3DS loader tutorial

    which compiled, ran and seems to be very comprehensive.

    However here's what I did. I wanted a simple free 3D Editor and found

    Delgine 3D

    with that you can import .3DS files. The editor saves files in it's own .dmf format and there is then a really simple single C file to load them C DMF Loader

    It has load, translate, scale and triangulate (turn all polygons into triangles) functions.

    --STU!

  4. #4
    Member Contributor
    Join Date
    Apr 2007
    Posts
    80

    Re: Loading and setting a 3d object in Opengl.

    thanks STU!

    Originally posted by ppinter1:
    What operating system / language are you using please?

    OS X with Objective-C, Windoze MFC with C++, Linux with GLUT, etc.?
    Windoze MFC with C++

  5. #5

    Re: Loading and setting a 3d object in Opengl.

    You might want to have a look at a MFC compliant 3DS mesh loader I wrote a few years ago available at:

    http://www2.p-squared.com:8765/Display3DS.php

    Good luck with your studies, and feel free to drop a line here with any questions (no promises though... it's been ages since I looked at that code).

    Cheers,
    /p2

  6. #6
    Senior Member Regular Contributor
    Join Date
    May 2004
    Location
    Renkum
    Posts
    193

    Re: Loading and setting a 3d object in Opengl.

    lib3ds is a nice cross-platform library for loading 3DS files.

  7. #7

    Re: Loading and setting a 3d object in Opengl.

    Originally posted by ppinter1:
    ... it's been ages since I looked at that code.
    Yeah, the Display3DS kit for Visual Studio 2005 did indeed need some dusting off to:
    • replace calls to fopen and strcpy with secure versions (fopen_s, strcpy_s)
    • replace sizeof with _countof for some char arrays
    • #define WINVER as 0x500 (Windows 2000, the minimum necessary)
    • link the Mesh3DS support library only to standard Windows libraries, as MFC is unnecessary there.

    It should load into VS2005 and compile quietly now.

Similar Threads

  1. Loading object files into OpenGL
    By aeonstrife in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-22-2011, 03:57 AM
  2. is tex env setting bind to texture object
    By Nil_z in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-21-2004, 11:52 PM
  3. loading a .asc object into OpenGL
    By nene in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-30-2003, 05:46 PM
  4. Setting the origin of an object in OpenGL
    By ReAKtor in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-20-2003, 04:42 PM
  5. Replies: 2
    Last Post: 07-28-2003, 07:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean