Hey guys. I've been having some trouble putting together a Java-based graphics pipeline for my Intro to Computer Graphics course. As it stands right now, I just need to get the northern hemisphere of a sphere (with north facing the user) printed, and throw some lights at it.
This is the pipeline (might be some errors...)
1) Initialize your shape. Do an identity operation on its' matrix and scale it down as you like. 2) Take the shape and begin to iterate through its' faces. 3) Take the vertices of each face, and transform them with your matrix. 4) Take these vertices and do a viewport transformation (move them from -1...n...1 coord plane to 0.....n plane of java) 5) For each face also do phong shading. 6) Take face, split into two triangles, and then do 'scan conversion' for them as well (i.e. split into two smaller triangles, use linear interpolation to determine colors and length of lines to be filled in the image buffer)
I would post code, but it is long and unwieldy and hard to debug. I actually had it working with an alternative pipeline, but this is not general and uses magic numbers. The results of that can be found here:
In that one, phong is done on every pixel, instead of every face, so it's quite slow (should have used lerp).
The code for the broken version is here:
the "correct", and broken, version
(aprilfools in filename is just a date...don't be alarmed)
I'm looking for insight from old hands more than I am for people to debug my code; which is a bit unwieldy right now.
thanks all! -eli