I am drawing a circle in OpenGL using a simple circle drawing shader that draws a circle around a point passed in. The point needs to be in screen space coordinates i,e, 1 to -1 in the x and y.
The problem is that the circle drawn doesn't stay in the same position like a real sun would, it seems to over rotate compared to other objects in the scene. This is due to it moving out of sync to the SkyBox.
The matrix passed into the SkyBox is:
The calculation for the light sun position so far:
vec4 returnPos = pos;
returnPos.w = 1.0f;
returnPos = projection * (view * returnPos);
return vec2(returnPos.x / returnPos.w, returnPos.y / returnPos.w);
The position passed in to this function (pos) is:
SUN.position + m_activeCamera.position
The view and projection matrix belong to the m_activeCamera.
Pictures to help explain the issue:
If I move the camera from left to the right the sun stays in place, relative to the sky box.
If I rotate the camera the sun moves out of place with the skybox.