Horizon rotates around skybox, while sun halo stay in place.

I am trying to render a skybox in openGL using the code found here: http://csc.lsu.edu/~kooima/misc/cs594/final/part2.html
However, the “horizon” color moves around, while the halo around the sun stays in place, as illustrated in this picture:


(Ignore the terrain please :stuck_out_tongue: )

I have copied the code exactly, except replaced the vertex shader code to use more modern openGL. How could i solve this problem?

(So the actual fragment colors are correct relative to the time of day, just the places they are wrong.)

Read up on Viewing Transformations in the OpenGL Programming Guide (or other source). In particular, get to know what OBJECT SPACE, WORLD SPACE, and EYE SPACE are, and the role of the MODELING and VIEWING transformations in moving between these spaces.

Short answer: you want to position your skybox in WORLD space, not EYE SPACE.

[QUOTE=Dark Photon;1289877]Read up on Viewing Transformations in the OpenGL Programming Guide (or other source). In particular, get to know what OBJECT SPACE, WORLD SPACE, and EYE SPACE are, and the role of the MODELING and VIEWING transformations in moving between these spaces.

Short answer: you want to position your skybox in WORLD space, not EYE SPACE.[/QUOTE]

Thats not the problem, i specifically sent the view matrix to the shader so i could fly around and take pictures from different angles.
The problem is that the sun halo always renders at the top of top of the skybox, regardless of sun position, as seen here:

And the horizon moves around the skybox:

In the above image the sun is setting, so the red glow is correct, but it should not be in the middle of the sky, but on the horizon.