I'm having a problem with a 3D engine I'm trying to code in PHP. It doesn't render in realtime or anything all it does is render a static image of a mesh. The zip file contains the files I've been working with. So far, pyramid.wrl and square.wrl render fine, cylinder.wrl won't render, I assume it's because the operations time out. The problem that concerns me is the sphere.wrl. I included the output of the app which is a .png file. If you look closely at it, the problem that's occurring is that some faces on the back of the sphere (it's a very low on polygons that's why it doesn't look much like a sphere) are being drawn in white, when they should be drawn in gray. Gray lines represent back faces, and white lines represent front faces i.e. what you can or can't see. If someone could look over my code and perhaps point out to me where my errors are I'd appreciate it greatly. If there's anything that's not clear, be it mathwise or codewise, lemme know and I'll gladly explain.
Attachments:
parsez.zip - contains the php code
vrml_objects.zip - contains the VRML files the program can work with
sphere.png - sample output of the code that highlights the problem