]> git.tdb.fi Git - libs/gl.git/commitdiff
Set gl_Layer separately for each vertex
authorMikko Rasa <tdb@tdb.fi>
Sun, 12 Dec 2021 11:17:30 +0000 (13:17 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 12 Dec 2021 11:17:30 +0000 (13:17 +0200)
EmitVertex invalidates *all* output variables so they must be written
again for the next one.

shaderlib/cubemap_effect.glsl

index b865a7abdc6238edfe8ed9652ee9ad716650ad25..883175263550843095796c1c76cb630f824b4f7e 100644 (file)
@@ -17,9 +17,9 @@ void main()
 {
        for(int i=0; i<6; ++i)
        {
-               gl_Layer = i;
                for(int j=0; j<3; ++j)
                {
+                       gl_Layer = i;
                        gl_Position = gl_in[j].gl_Position;
                        out vec3 texcoord = faces[i]*vec3(gl_in[j].gl_Position.xy, 1.0);
                        EmitVertex();