Wednesday, May 6, 2009

3D Models - accidental discovery

Well, in Adrian, when we initially created it, we hard coded the building load routines. But now that we are extending it to load maps on the fly, this had got to go. But I found out that it was a very tedious thing to migrate all this information into a normal file from C code by hand.

So I did a hack, which replaced all the GL function bodies with a simple printf about what they are doing and their coordinates. This caused it to generate an output file, which sequenced the list of OpenGL commands.

For loading the building, all I did was at load time I did a glNewList and put in all the vertices, textures drawing etc into it. Now for rendering, I just call the display list. This seemed like a very nice and unique solution. Basically then I realized that what I have done is exactly what 3D modelling formats do.

You kind of understand things at a whole new level, if you come up with a solution, which turns out to be actually widely used. You would actually know the exact usage of such a solution.

Chill.

No comments:

Post a Comment