Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Windows Shader Programming In Delphi FireMonkey – Apply Color To The GPU Shader

shader programming in delphi firemonkey apply color to the gpu shader

In the first blog post, we quickly explored shader programming in Delphi FireMonkey. And we learned how to create a material source using TCustomMaterial. Then we applied that material to a 3D control. This post is based on a blog post by Embarcadero MVP Erik van Bilsen.

Now, we will add a color property to our 3D control to customize color. This can be achieved by adding a uniform input to the pixel shader for the color. So, on the Delphi side, the Color property should be added to the new material.

[crayon-6762519be75f7668712878/]

Finally, you must update the material source by adding a new Color property. Here is the implementation

[crayon-6762519be75ff963219491/]

And here is our result:

Head over and be sure to check out the full blog post and demo applications here. And stay tuned for the next part which we will add a texture to our 3D control.

You can program easily window shader and apply color to the GPU shader using Delphi’s IDE Software. Try your Free Trial here and begin developing in C++ or Delphi environments right away.

Exit mobile version