py5book icon indicating copy to clipboard operation
py5book copied to clipboard

Add the shader source code to the shader() example

Open villares opened this issue 8 months ago • 2 comments

Dear @hx2A,

I should have opened an issue... I know this might not be the correct way of fixing this, but I'll open the PR anyway as a way of not forgetting about it and losing the code I retrieved from the Processing examples, which is used on this documentation item (while in the middle of doing something else).

Feel free to close this and/or to instruct me on how to do it properly, and I'll try at some other time :smile: ... we should probably be discussing this in an issue, sorry!

villares avatar Mar 25 '25 20:03 villares

This is a good idea, we should include the shader code. At a minimum it would make working wish shaders slightly less opaque.

How to include it though? A solution here should also be compatible with what I come up with for unit tests. (Eventually) there will be unit tests based on the example code.

hx2A avatar Mar 25 '25 20:03 hx2A

You have explained to me once how the reference is built, using data from Processing... and I suppose there are tables to tweak stuff somewhere.

My first intuition is there should also be a folder with the code for each example, the unit tests would run the sketch code and compare a resulting image with the expected image. Some script would "include" the code into some page source/template or build the final page (which also includes the image). All this would create a complex workflow hard to explain...

villares avatar Mar 25 '25 21:03 villares