GPU Project 04 – Simple 3D object parser

So, last week we got a basic projection algorithm in place. We “rendered” the vertices of the cube into a bitmap, but we barely know got it see it working. We definitely need something more complicated to see it operating. One option is to just try to hard code a list of larger vertices that describe a more complex object, but doing that by hand is definitely cumbersome, inexact and prone to errors. Instead, I decided to rely on the vast world wide web and find several 3d objects that I could use. It turns out that there are millions of such objects in many, many websites, but all of these are in different formats. After some hunting, I setted on using a .obj format. These are the reasons:

  • Plain ASCII format: Can’t beat this when it comes to ease of parsing
  • No compression
  • Simple 3d object structure.
  • Vertexes and faces are separate.

 

Continue reading