I highly recommend that you check them out.
Expanding on those examples I've changed them slightly in the following ways:
All credit goes to Lee for his excellent examples. If you want to understand the math behind it all, then definitely read his article. My examples don't have much in the way of comments.
View Source is available for all the following examples, right click below to access the source.
Example #1 - Simple Rotating Cube: | Example #2 - Rotating Triangle: |
Example #3 - Rotating Arrow (with highlighting): | Example #4 - Cube With Image/Bitmap Fill: |
Also, the mouse dragging to rotate works as expected until you've rotated the shape 180 degrees, then it becomes backwards. I haven't spent the time to try and fix this.
The fourth example uses Lee's Shape3D class which encapsulates the 3D functionality in one simple class. It is much cleaner this way.