PDA

View Full Version : Texture Mapping in Delphi



LP
04-12-2007, 07:25 PM
For the past few weeks in the time between work I've been porting texture mapping code originally written in C/C++. The reason is that it could be particularly useful on embedded systems and, of course, for demo scene contests, such as TMDC (http://www.taat.fi/tmdc).

As a result, I've published a sample project, which shows some of the popular algorithms that were previously used in C/C++ and now are available in Delphi. They can be converted to FreePascal/Lazarus with minimal effort.

The project features Affine Texture Mapping, Perspective Texture Mapping, Polygon Clipping using Sutherland-Hodgman algorithm and vector transformation using SIMD/SSE instructions. These algorithms are used in a sample 3D software rendering pipeline, which is capable of displaying textured 3D meshes. An algorithm for generating a PQ Torus Knot in run-time is also provided.

You can obtain the project at this location. (http://www.afterwarp.net/content/view/29/).
Any comments and suggestions are welcome.

Screenshot:
http://img104.imageshack.us/img104/1527/image3zr2.th.png (http://img104.imageshack.us/my.php?image=image3zr2.png)

paul_nicholls
04-12-2007, 10:58 PM
This sounds great! :)

I am going to look at the source code as earlier on this year I did make a simple OpenGL based software renderer, but I couldn't get perspective texture mapping working. It was also very slow on the gp2x when I tried it there (the main reason I wrote it).

keep up the great work lifepower! :)
cheers,
Paul

Luuk van Venrooij
05-12-2007, 12:32 PM
Very nice, I tried to write a software renderer once. Never got past wireframe cube:).