Question

I'm working with SharpGL and have a .3ds model I want to render in my program.

I'm looking for a sample code snippet or a tutorial to get me going.

Edit: Working with .NET to create a WPF application with a SharpGL control for OpenGL drawing.

Was it helpful?

Solution

You need to write an importer/file format reader/loader. Yourself. Which is a major pain. The good thing is that .3ds file format is well-known and documented.

However, the bad thing is that .3ds format is obsolete and does not store all data modern 3d app would require. For example, it does not store surface normals and does not support skinned meshes. I wrote 3ds reader before, it wasn't much fun. The another good thing is that somebody has probably written 3ds loader before and you can find it using google. The bad thing is that (by Murphy's Law) they've probably implemented it in such fashion that will make it completely unusable with your code.

So normally it is recommended to use some other well-documented format (and write reader for THAT format instead). Or you could go ahead and design your own format for models that supports everything you want. However, to export to THIS format from 3ds max, you'll have to your own exporter plugin for 3ds max (using 3ds max sdk) which requires great deal of familiarity with 3d mathematics and programming (in C++). I've written several exporters before, and this is also a major pain.

So the easier solution would be to use some simple format that allows you to easily write a loader. Something text-based, like *.dxf. Or you could search for another 3d model file format that hopefully comes with a library for loading it. For example, collada can be one of the candidates, although I personally greatly dislike the fact it uses XML.

OTHER TIPS

Check out the already available post in this context.

3ds max object to opengl

Satish

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top