Image An open-source Delphi project, which illustrates several texture mapping algorithms, 3D rendering pipeline and PQ Torus Knot runtime generation. The project comes with compiled binary and full source code.

Although technologies OpenGL and Direct3D both have hardware implementation of texture mapping, there are systems where such implementation is not available. The code can be converted to FreePascal /Lazarus with minimal effort and can be particularly useful on embedded systems.

The project uses several pieces from Asphyre Sphinx to simplify tasks such as image loading and software rendering canvas. All the required units were included in the package to make it self-contained.

  • The application generates a 3D mesh in run-time based on PQ Torus Knot explanation written on Jim Scott's blog.
  • The software 3D pipeline uses SIMD/SSE vector transformation routines originally published embedded in C/C++ by Cort Stratton in 2002. The code was adapted to work with Delphi.
  • The application contains Affine Texture Mapping code originally written in C/C++ and published in "fatmap2.zip" package by Mats Byggmastar in 1997. The code was ported to Delphi.
  • In addition, the application uses Perspective Texture Mapping code originally written in C/C++ by Chris Hecker and published in his articles. The code was ported to Delphi and is available with the kind permission of the author.
  • In order to render triangles properly on the screen, the application uses an implementation of Sutherland-Hodgman algorithm for clipping polygons with optional perspective correction.

Source + Binary download (04-Dec-2007):