본문 바로가기
College Study/GLSL

[GLSL] Color

by 2den 2022. 1. 5.
728x90

 


vec3 red = vec3(1.0,0.0,0.0);
red.x = 1.0;
red.y = 0.0;
red.z = 0.0;
 
vec4 vector;
vector[0] = vector.r = vector.x = vector.s;
vector[1] = vector.g = vector.y = vector.t;
vector[2] = vector.b = vector.z = vector.p;
vector[3] = vector.a = vector.w = vector.q;
 
vec3 yellow, magenta, green;

// Making Yellow
yellow.rg = vec2(1.0);  // Assigning 1. to red and green channels
yellow[2] = 0.0;        // Assigning 0. to blue channel

// Making Magenta
magenta = yellow.rbg;   // Assign the channels with green and blue swapped

// Making Green
green.rgb = yellow.bgb; // Assign the blue channel of Yellow (0) to red and blue channels
 

swizzle

 

728x90

'College Study > GLSL' 카테고리의 다른 글

[GLSL] Atan  (0) 2022.01.05
[GLSL] Mix  (0) 2022.01.05
[GLSL] Gain  (0) 2022.01.05
[GLSL] Shaping Functions  (0) 2022.01.05
[GLSL] Smoothstep  (0) 2022.01.05

댓글