Took me some effort, but I managed to implement Z-Buffering on my toy OpenGL ES 1.0 Common Lite implementation. The depth interpolation was a bit of a pain, but surprisingly, computing the normalized Z values for each vertex was the real chore here!

Also worth reminding that this is GL ES 1.0 CL, which is fixed-point exclusive (hence the imprecision overwall).

I also haven't implemented perspective correction yet.

edit: spelling

#screenshotsaturday #opengl

With a bit more work, extended the same computation to also handle the colour interpolation

...which won't obey `glDisableClientState(GL_COLOR_ARRAY);` for now :)

Still a lot to go, but got some very basic per vertex lightning to go.

The state machine for materials and lights in GL ES 1.0 CL is surprisingly complex (given the use-case) and I'm cheating heavily here. But We have to start somewhere.

There's also some severe underflow/overflow problem that I need to address.

Finally, combined the texture mapping, the lighting and the colour interpolation.

I feel like this is a good proof-of-concept to stop and start reading the specs more seriously, as well as investigating what other people have done in this space, so I can learn from them.

This is also a good time to start adding tests and documentation, testing on real hardware and cleaning up the code.

I'm here for the long run :)

#screenshotsaturday #opengl