I took the opportunity to rewrite the setupView: method to use the Vertex3D, Vector3D, and Color3D structs we defined back in Part 1. Neither approach is "better", but I thought it might be interesting to see it done a little different way. When I was first learning OpenGL, I found it easier to think in terms of Vertices, Colors, and Triangles, rather than all the various-length arrays of floats. If you're like I was, then you may find this version easier to read and understand.
In addition to use our custom data structures, I also reduced the amount of the ambient light component and moved the light over to the right. I then used the Vector3DMakeWithStartAndEndPoints() to point the moved light at the icosahedron. By moving the light over and having it strike the object at an angle, the effect is a little more dramatic.
-(void)setupView:(GLView*)view
You should feel free to play with the light attributes, add additional lights or icosahedrons, and generally just play around to get a feel for how changes will effect your scene. This stuff is conceptually hard to grok, so don't expect it to come overnight (and if it does, count yourself lucky).
0 comments:
Post a Comment