How to add a texture using GLSL shader

Hi everyone,

Currently I’m trying to realize a pyramid using Ulam spiral ( , adapted in a P3d figure) for the pattern. The pyramid is composed of cubes representing a number. If the number is prime, the cube will appear of a certain color, if it is abundant, of another color… We are asked to make a texture where numbers are displayed. For this, we used PGraphics, and we get this result.

Pyramid and PGraphics:

However, the teacher insisted on using the shader mode, with shaders written in GLSL for displaying the textures. However I don’t really have an idea how to do it. This must have been discussed once in lecture (not recorded) but I don’t really remember.

If anyone has a tutorial or an idea of how to get started right, it would be very helpful.

P.S: If this works, I could move on to the last step which is picking. Normally we have two figures at the end, and if we click (or mouse over) a block representing a number, the block of the other figure representing the same number will be highlighted.

Thank you so much for your time,