MaestroOscuro's picture

Loading Mesh


I came from directx programming (c#), and I'm going to create a free mmorpg, playable from Linux and Windows.
Looking OpenTK examples, I think it have a good design, so I want to use it.

The game defs are completed, but before starting with the game engine I need to learn the basics of GL and OpenTK, because I need to know what can I do, and how, of course. Then I'll make some tests to set the max complexity of each scene.

My first question is: how to load and render meshes (and the file format I need)?
I'll make the first objects with 3DMAX, and then I'll convert it to the format needed.

Thanks in advance.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Welcome! :)

OpenTK is a low-level library, which means it doesn't load and render meshes by itself (although it is possible that we will provide such utilities in the future, outside of the "core" library). In DirectX terms, it is roughly analogous to a combination of Direct3D, DirectSound and DirectInput, with a few X functions thrown in.

It does not provide any model loading capabilities by itself. As such, you are free to decide which file format to use: Milkshape's MS3D, Microsoft's X or Id's MD5 formats are good bets, as they are fairly widespread.

Next, you will need a loader for this format. You can either write your own or, probably better, adapt existing implementations. The Axiom engine and Irrlicht3d.Net should have such loaders already, and many more should be floating in the webs (just beware of licensing issues if you plan to keep your project closed-source!)

Once you have loaded the model into memory, you will have to animate and render it, which is a very large topic by itself. Once again, this is out of OpenTK's scope, except maybe for the math functions provided in OpenTK.Math and the texture loading functions which will be added in OpenTK.Utilities.

In the end you will have a list of primitives and textures, which you will need feed into OpenGL for rendering - this is the place where OpenTK comes into play, through OpenTK.OpenGL.

Don't hesitate to ask any questions you might need.

Inertia's picture

If you're looking for a quickstart, check out

Tao is similar to OpenTK (although not as elegant :P) so it will probably be a task of a few hours to port the .3ds loader (last post) to OpenTK. That format does not support skeletal animation, but for static models it will probably be your best choice as you can save out .3ds files directly from 3D Studio Max, instead of going through conversion steps.

Like Fiddler pointed out, for animated models you will probably have to check axiom, irrlicht or ogre engine and see what you can harvest out of those - or be patient and see what OpenTK.Utilities will bring ;)

MaestroOscuro's picture

Ok, thx!

Now I have a lot of work :)

About the sources, it will be open (gpl or lgpl, I'm not sure).
When I reach the checkpoint 1 (a little 2d interface in the front and some bots walking over the ground) I'll show the project.

Thx again.

the Fiddler's picture

Np, you're welcome :)