Reimplemented using OpenGL.