the most efficient way to calculate center of rect in shader?
Thanks!
The most efficent way is the only way.
Assuming you already have the rectangle accessible for the shader, just do x + w / 2
for find out the horizontal center and y + h / 2
for find out the vertical center.
what if only pass the 4 corner points to VS? is it able to calculate its center by gl_VertexID or something else, if it was possible is it efficient than calculate the center and pass it with the 4 corner points to VS? Thanks!