I use a vertex and fragment shader pair for drawing cylinder impostors for molecular visualization. The shader renders of the order 500.000 cylinders (bonds) on the screen. Clearly, shader optimization is an issue.
For each rendered cylinder, I have to determine whether some vec3, say u, is NOT the zero vector. I might do:
dot(u,u) != 0.0
(u.x != 0.0) || (u.y != 0.0) || (u.z != 0.0)
any(notEqual(u, vec3(0.0, 0.0, 0.0)))
What is the fastest way of doing this? Alternative solutions to the above are more than welcome.
Best regards,
Mads