Monday, February 11, 2008

Functioning (but buggy) graphics engine

Success over the past week!

I have succeeded in setting up some semblance of a graphics engine in this Neon Culture build. A prototype of the cell object class, another class taking in two images and turning them into cell arrays, and the main class to handle all assigning of vertices and indices are all done. Currently it only dices one image up into one mass of cells, and that image is drawn starting at the origin. Which image is chosen for the process is changed by altering a hard-coded string (yes, it makes me wince too, but in my defense it is only set in one place and then passed out from there so at least I'm not going to end up with many concurrent string issues) which is the file name of the image I have ready. I intend to implement a function that will pop up a file browser at startup, and in fact have the following resources ready to help me accomplish that:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx
http://www.java2s.com/Code/CSharp/GUI-Windows-Form/showsbrowsingforafile.htm

In addition, there is a rather annoying bug that has resulted in an incorrect interpretation of the image's colors. Instead of a vibrant picture, the result is a grayish, muddied mess. My first thought was that that it has shifted which bits it was reading to the right or left to result in incorrect colors, but the cells are all gray, and one would think that even by random chance there would be some vibrant colors. They are getting averaged out somewhere and I'm not sure how yet. Also, the camera is in the wrong place, and perhaps top of my list is setting up a CVS repository. Never have your source code in one place only!

However, all of that aside, here are some promising benchmarks:

50,000 pixel image
  • Time to convert into 50,000 cell objects: negligible
  • Vertices to display on screen: 3,000,000
  • Indices to display on screen: 120,000,000
  • Frames per second: approximately 30
Back to work!

-Tyler

No comments: