Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
DelphiRAD Studio

Fun With 3D: Apply A Texture To A GPU Shader With Delphi FireMonkey


We have been exploring shader programming in Delphi FireMonkey. In the first post, we have learned the fundamentals of computer graphics and prepared the development environment. And created a simple demo application that just renders every pixel using a blue color.

So, in the second tutorial, we have applied a custom color to the GPU shader. And made several additions to the main TCustomMaterialClass.

Now, it is time to apply a texture to the 3D object instead of using a single color. What is a texture? A texture is a bitmap that lives on the GPU. 


To make it happen, we need to do some additional modifications to the Vertex and Pixel shaders. Moreover, on the Delphi side, the material is updated to reflect the new shaders

The material source controls the image bitmap. This bitmap is of type TTextureBitmap, which is a special kind of bitmap that is backed by a texture on the GPU. We connect an OnChange event handler to it so we can update the underlying material when the bitmap changes.

And the result is here:


Be sure to head over and check out the full blog post by Erik van Bilsen to learn more about Shader programming in Delphi FireMonkey!


Coding Boot Camp

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Software Developer | CS(CyberSec) Undergrad at APU Malaysia | Delphi/C++ Builder Enthusiast | Microsoft Learn Student Ambassador | Microsoft Azure Certified
Related posts
C++CodeIDERAD Studio

5 More Tips About Using Strings In Modern C++ Software

CodeDelphiHow-To'sTech Partner

How To Implement Push Notifications In Cross Platform Apps

C++DelphiHow-To'sIDERAD StudioWindows

Windows 10 Apps Development Tutorial for Beginners


What Is An IDE?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.