Hallo,
I has following problem to solve:
I want to compare (pixel-per-pixel) two textures (first generated from many draw shapes, second read from disc) using fragment shader. Unfortunately i'm new in graphics and open gl and i need some help. My idea was:
- Draw some SFML shapes on texture
- Fill second texture with .bmp from disc
- Run fragment shader which will be run on generated texture (.bmp texture will be shader parameter) and will store information about difference for example in alpha channel ((r1-r2)^2+(g1-g2)^2+(b1-b2)^2)
- Run second pixel shader which will sum differences in rows
- Run third shader which will sum "partial sums"
I believe that in result I will have one number - difference between two images.
But I have few questions:
- It is good conception of comparing two images using gpu?
- it is possible to run three different pixel shaders using SFML?
- How can I read my final difference from shader (reading texture values will be probably very slow?)?
- Is there any option for "output" parameter from pixel shader?
I will appreciate any help