I'm a relative noob when it comes to shaders, and I'm coming up against a wall. I'm trying use a vertex shader to generate texture coordinates for a jit.gl.mesh that re-create OpenGL's GL_SPHERE_MAP mode for a reflection effect. This would ideally mimic the behavior of OB3D's tex_map attribute (@tex_map 2).
I have created a shader (attached) that I believe should be doing this. The code is essentially a direct copy of the source taken from the Orange Book and the Shadergen program. Unfortunately the shader does not work as expected - it appears that it's referencing a single coordinate rather than map across the entire texture.
I'm hoping that someone with more shader experience can comment. Any insight would be greatly appreciated!