PDA

View Full Version : Loading and setting a 3d object in Opengl.



tirengarfio
08-03-2006, 03:04 AM
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?

ppinter1
08-04-2006, 05:10 PM
What operating system / language are you using please?

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

Stuart McDonald
08-06-2006, 04:08 AM
There are lots of .3DS loaders out there. My first google turned up

3DS loader tutorial (http://ironduke.cs.gsu.edu/gso_classes/OpenGL/opengl_resources.htm)

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 (http://www.delgine.com/)

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 (http://www.delgine.com/downloads/misc/CDMFLoader.zip)

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

--STU!

tirengarfio
08-08-2006, 04:53 AM
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++

ppinter1
08-08-2006, 02:30 PM
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

Hylke Donker
08-09-2006, 08:36 AM
lib3ds (http://lib3ds.sourceforge.net) is a nice cross-platform library for loading 3DS files.

ppinter1
08-15-2006, 11:00 PM
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.