One of the points in the triangle is your mouse. The scale (size of pen point pixels) can be set to anything, but only works well with powers of 2 (1, 2, 4, 8, 16, 32, 64, 128) Remix and change the "fragment" function to change the fragment shader (what makes the rainbow)
* I made this project with knowledge about opengl * feel free to use this for anything at all * The thumbnail is a triangle rendered with a scale of 1 using this * This could easily be turned into a 3d renderer with a vertex shader. (I might do that) Rendering optimizations in the triangle: - Calculate the smallest possible rectangle the triangle fits in. - Once the next pixel on the row is not in the triangle, skip to the next row instantly The code of this also contains an axis aligned rectangle drawing function, it isn't that useful though. (I made it to optimize the triangle function) I have no idea why it doesn't work with scales that aren't powers of 2. (maybe decimal points are messing with something)