Colors

Mickey·2022년 1월 27일
0

glium

목록 보기
5/14
post-thumbnail

https://github.com/glium/glium/blob/master/book/tuto-05-colors.md

shader를 수정하여 삼각형 color를 변경

vertex shader 수정

#version 140

in vec2 position;
out vec2 my_attr;      // our new attribute

uniform mat4 matrix;

void main() {
    my_attr = position;     // we need to set the value of each `out` variable.
    gl_Position = matrix * vec4(position, 0.0, 1.0);
}

fragment shader 수정

#version 140

in vec2 my_attr;
out vec4 color;

void main() {
    color = vec4(my_attr, 0.0, 1.0);   // we build a vec4 from a vec2 and two floats
}

profile
Mickey

0개의 댓글