Answers for "each face with its own color"

0

each face with its own color

#version 330

uniform mat4 u_m_matrix;
uniform mat4 u_vp_matrix;

layout (location=0) in vec3 a_position;
//layout (location=1) in vec3 a_normal;

out vec3 vertPos;

void main()
{
    vertPos     = a_position;
    gl_Position = u_vp_matrix * u_m_matrix * vec4(a_position, 1.0);
}
Posted by: Guest on August-18-2021
0

each face with its own color

#version 330

in vec3 vertPos;

out vec4 fragColor;

void main() {

    vec3 posAbs  = abs(vertPos);
    vec3 color   = step(posAbs.yzx, posAbs) * step(posAbs.zxy, posAbs); 
    color       += (1.0 - step(color.zxy * vertPos.zxy, vec3(0.0)));

    fragColor = vec4(color, 1.0);
}
Posted by: Guest on August-18-2021

Browse Popular Code Answers by Language