Translate glossary section (partly) and swap all/any page

pull/303/head
Hoang.Vu 4 years ago
parent 1ac1f5654f
commit ebbf78cc65

@ -0,0 +1,9 @@
## GL_ES
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,291 @@
# Chú giải
## Xếp theo nhóm
* CÁC KIỂU DỮ LIỆU
[void](./?lan=vi&search=void),
[bool](./?lan=vi&search=bool),
[int](./?lan=vi&search=int),
[float](./?lan=vi&search=float),
[bvec2](./?lan=vi&search=bvec2),
[bvec3](./?lan=vi&search=bvec3),
[bvec4](./?lan=vi&search=bvec4),
[ivec2](./?lan=vi&search=ivec2),
[ivec3](./?lan=vi&search=ivec3),
[ivec4](./?lan=vi&search=ivec4),
[vec2](./?lan=vi&search=vec2),
[vec3](./?lan=vi&search=vec3),
[vec4](./?lan=vi&search=vec4),
[mat2](./?lan=vi&search=mat2),
[mat3](./?lan=vi&search=mat3),
[mat4](./?lan=vi&search=mat4),
[sampler2D](./?lan=vi&search=sampler2D),
[samplerCube](./?lan=vi&search=samplerCube),
[struct](./?lan=vi&search=struct)
* CÁC QUALIFIER
[attribute](./?lan=vi&search=attribute),
[const](./?lan=vi&search=const),
[uniform](./?lan=vi&search=uniform),
[varying](./?lan=vi&search=varying),
[precision](./?lan=vi&search=precision),
[highp](./?lan=vi&search=highp),
[mediump](./?lan=vi&search=mediump),
[lowp](./?lan=vi&search=lowp),
[in](./?lan=vi&search=in),
[out](./?lan=vi&search=out),
[inout](./?lan=vi&search=inout)
* CÁC BIẾN CÓ SẴN
[gl_Position](./?lan=vi&search=gl_Position),
[gl_PointSize](./?lan=vi&search=gl_PointSize),
[gl_PointCoord](index.hmtl#gl_PointCoord),
[gl_FrontFacing](./?lan=vi&search=gl_FrontFacing),
[gl_FragCoord](./?lan=vi&search=gl_FragCoord),
[gl_FragColor](./?lan=vi&search=gl_FragColor)
* CÁC HẰNG SỐ CÓ SẴN
[gl_MaxVertexAttribs](./?lan=vi&search=gl_MaxVertexAttribs),
[gl_MaxVaryingVectors](./?lan=vi&search=gl_MaxVaryingVectors),
[gl_MaxVertexTextureImageUnits](./?lan=vi&search=gl_MaxVertexTextureImageUnits),
[gl_MaxCombinedTextureImageUnits](./?lan=vi&search=gl_MaxCombinedTextureImageUnits),
[gl_MaxTextureImageUnits](./?lan=vi&search=gl_MaxTextureImageUnits),
[gl_MaxFragmentUniformVectors](./?lan=vi&search=gl_MaxFragmentUniformVectors),
[gl_MaxDrawBuffers](./?lan=vi&search=gl_MaxDrawBuffers)
* CÁC HÀM LƯỢNG GIÁC
[radians()](./?lan=vi&search=radians),
[degrees()](./?lan=vi&search=degrees),
[sin()](./?lan=vi&search=sin),
[cos()](./?lan=vi&search=cos),
[tan()](./?lan=vi&search=tan),
[asin()](./?lan=vi&search=asin),
[acos()](./?lan=vi&search=acos),
[atan()](./?lan=vi&search=atan)
* CÁC HÀM LUỸ THỪA
[pow()](./?lan=vi&search=pow),
[exp()](./?lan=vi&search=exp),
[log()](./?lan=vi&search=log),
[exp2()](./?lan=vi&search=exp2),
[log2()](./?lan=vi&search=log2),
[sqrt()](./?lan=vi&search=sqrt),
[inversesqrt()](./?lan=vi&search=inversesqrt)
* CÁC HÀM TOÁN HỌC CƠ BẢN
[abs()](./?lan=vi&search=abs),
[sign()](./?lan=vi&search=sign),
[floor()](./?lan=vi&search=floor),
[ceil()](./?lan=vi&search=ceil),
[fract()](./?lan=vi&search=fract),
[mod()](./?lan=vi&search=mod),
[min()](./?lan=vi&search=min),
[max()](./?lan=vi&search=max),
[clamp()](./?lan=vi&search=clamp),
[mix()](./?lan=vi&search=mix),
[step()](./?lan=vi&search=step),
[smoothstep()](./?lan=vi&search=smoothstep)
* CÁC HÀM HÌNH HỌC
[length()](./?lan=vi&search=length),
[distance()](./?lan=vi&search=distance),
[dot()](./?lan=vi&search=dot),
[cross()](./?lan=vi&search=cross),
[normalize()](./?lan=vi&search=normalize),
[facefoward()](./?lan=vi&search=facefoward),
[reflect()](./?lan=vi&search=reflect),
[refract()](./?lan=vi&search=refract)
* CÁC HÀM MA TRẬN
[matrixCompMult()](./?lan=vi&search=matrixCompMult)
* CÁC HÀM VECTOR
[lessThan()](./?lan=vi&search=lessThan),
[lessThanEqual()](./?lan=vi&search=lessThanEqual),
[greaterThan()](./?lan=vi&search=greaterThan),
[greaterThanEqual()](./?lan=vi&search=greaterThanEqual),
[equal()](./?lan=vi&search=equal),
[notEqual()](./?lan=vi&search=notEqual),
[any()](./?lan=vi&search=any),
[all()](./?lan=vi&search=all),
[not()](./?lan=vi&search=not)
* CÁC HÀM TEXTURE
[texture2D()](./?lan=vi&search=texture2D),
[textureCube()](./?lan=vi&search=textureCube)
## Xếp theo thứ tự từ điển
* A
[abs()](./?lan=vi&search=abs),
[acos()](./?lan=vi&search=acos),
[all()](./?lan=vi&search=all),
[any()](./?lan=vi&search=any),
[asin()](./?lan=vi&search=asin),
[atan()](./?lan=vi&search=atan),
[attribute](./?lan=vi&search=attribute)
* B
[bool](./?lan=vi&search=bool),
[bvec2](./?lan=vi&search=bvec2),
[bvec3](./?lan=vi&search=bvec3),
[bvec4](./?lan=vi&search=bvec4)
* C
[ceil()](./?lan=vi&search=ceil),
[clamp()](./?lan=vi&search=clamp),
[const](./?lan=vi&search=const),
[cos()](./?lan=vi&search=cos),
[cross()](./?lan=vi&search=cross)
* D
[degrees()](./?lan=vi&search=degrees),
[dFdx()](./?lan=vi&search=dFdx),
[dFdy()](./?lan=vi&search=dFdy),
[distance()](./?lan=vi&search=distance),
[dot()](./?lan=vi&search=dot)
* E
[equal()](./?lan=vi&search=equal),
[exp()](./?lan=vi&search=exp),
[exp2()](./?lan=vi&search=exp2)
* F
[faceforward()](./?lan=vi&search=faceforward),
[float](./?lan=vi&search=float),
[floor()](./?lan=vi&search=floor),
[fract()](./?lan=vi&search=fract)
* G
[greaterThan()](./?lan=vi&search=greaterThan),
[greaterThanEqual()](./?lan=vi&search=greaterThanEqual),
[gl_FragColor](./?lan=vi&search=gl_FragColor),
[gl_FragCoord](./?lan=vi&search=gl_FragCoord),
[gl_FrontFacing](./?lan=vi&search=gl_FrontFacing),
[gl_PointCoord](index.hmtl#gl_PointCoord),
[gl_PointSize](./?lan=vi&search=gl_PointSize),
[gl_Position](./?lan=vi&search=gl_Position),
[gl_MaxCombinedTextureImageUnits](./?lan=vi&search=gl_MaxCombinedTextureImageUnits),
[gl_MaxDrawBuffers](./?lan=vi&search=gl_MaxDrawBuffers),
[gl_MaxFragmentUniformVectors](./?lan=vi&search=gl_MaxFragmentUniformVectors),
[gl_MaxVaryingVectors](./?lan=vi&search=gl_MaxVaryingVectors),
[gl_MaxVertexAttribs](./?lan=vi&search=gl_MaxVertexAttribs),
[gl_MaxVertexTextureImageUnits](./?lan=vi&search=gl_MaxVertexTextureImageUnits),
[gl_MaxTextureImageUnits](./?lan=vi&search=gl_MaxTextureImageUnits)
* H
[highp](./?lan=vi&search=highp)
* I
[in](./?lan=vi&search=in),
[inout](./?lan=vi&search=inout),
[int](./?lan=vi&search=int),
[inversesqrt()](./?lan=vi&search=inversesqrt),
[ivec2](./?lan=vi&search=ivec2),
[ivec3](./?lan=vi&search=ivec3),
[ivec4](./?lan=vi&search=ivec4)
* L
[length()](./?lan=vi&search=length),
[lessThan()](./?lan=vi&search=lessThan),
[lessThanEqual()](./?lan=vi&search=lessThanEqual),
[log()](./?lan=vi&search=log),
[log2()](./?lan=vi&search=log2),
[lowp](./?lan=vi&search=lowp)
* M
[matrixCompMult()](./?lan=vi&search=matrixCompMult),
[mat2](./?lan=vi&search=mat2),
[mat3](./?lan=vi&search=mat3),
[mat4](./?lan=vi&search=mat4),
[max()](./?lan=vi&search=max),
[mediump](./?lan=vi&search=mediump),
[min()](./?lan=vi&search=min),
[mix()](./?lan=vi&search=mix),
[mod()](./?lan=vi&search=mod)
* N
[normalize()](./?lan=vi&search=normalize),
[not()](./?lan=vi&search=not),
[notEqual()](./?lan=vi&search=notEqual)
* O
[out](./?lan=vi&search=out)
* P
[precision](./?lan=vi&search=precision),
[pow()](./?lan=vi&search=pow)
* R
[radians()](./?lan=vi&search=radians),
[reflect()](./?lan=vi&search=reflect),
[refract()](./?lan=vi&search=refract)
* S
[sampler2D](./?lan=vi&search=sampler2D),
[samplerCube](./?lan=vi&search=samplerCube),
[sign()](./?lan=vi&search=sign),
[sin()](./?lan=vi&search=sin),
[smoothstep()](./?lan=vi&search=smoothstep),
[sqrt()](./?lan=vi&search=sqrt),
[step()](./?lan=vi&search=step),
[struct](./?lan=vi&search=struct)
* T
[tan()](./?lan=vi&search=tan),
[texture2D()](./?lan=vi&search=texture2D),
[textureCube()](./?lan=vi&search=textureCube)
* U
[uniform](./?lan=vi&search=uniform)
* V
[varying](./?lan=vi&search=varying),
[vec2](./?lan=vi&search=vec2),
[vec3](./?lan=vi&search=vec3),
[vec4](./?lan=vi&search=vec4),
[void](./?lan=vi&search=void)

@ -0,0 +1,21 @@
## Abs
Tính giá trị tuyệt đối của một hoặc nhiều số.
### Các phiên bản
```glsl
float abs(float x)
vec2 abs(vec2 x)
vec3 abs(vec3 x)
vec4 abs(vec4 x)
```
### Các tham số
```x``` số muốn tính giá trị tuyệt đối
### Mô tả
```abs()``` trả về giá trị tuyệt đối của ```x```.
<div class="simpleFunction" data="y = abs(x); "></div>
### Tham khảo thêm
[sign()](/glossary/?lan=vi&search=sign), [min()](/glossary/?lan=vi&search=min), [max()](/glossary/?lan=vi&search=max), [Chương 5: Các hàm số cơ bản](../05/?lan=vi)

@ -0,0 +1,21 @@
## Acos
Tính góc lượng giác ứng với giá trị cosine
### Các phiên bản
```glsl
float acos(float x)
vec2 acos(vec2 x)
vec3 acos(vec3 x)
vec4 acos(vec4 x)
```
### Các tham số
```x``` giá trị cosine cần tìm góc lượng giác tương ứng
### Mô tả
```acos()``` góc lượng giác (đơn vị radian) ứng với cosine bằng ```x```.
<div class="simpleFunction" data="y = acos(x); "></div>
### Tham khảo thêm
[cos()](/glossary/?lan=vi&search=cos), [sin()](/glossary/?lan=vi&search=sin), [asin()](/glossary/?lan=vi&search=asin), [tan()](/glossary/?lan=vi&search=tan), [atan()](/glossary/?lan=vi&search=atan), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,29 @@
## All
Kiểm tra xem toàn bộ các thành phần trong 1 vector boolean có cùng bằng true không
### Các phiên bản
```glsl
bool any(bvec2 x)
bool any(bvec3 x)
bool any(bvec4 x)
```
### Các tham số
```x``` vector boolean cần kiểm tra
### Mô tả
```all()``` trả về ```true``` nếu tất cả các thành phần trong vector ```x``` đều bằng ```true``` và trả về ```false``` nếu ngược lại. Tương đương với:
```glsl
bool all(bvec x){ // bvec có thể thay bằng bvec2, bvec3 or bvec4
bool result = true;
int i;
for (i = 0; i < x.length(); ++i)
{
result &= x[i];
}
return result;
}
```
### Tham khảo thêm
[any()](/glossary/?lan=vi&search=any), [not()](/glossary/?lan=vi&search=not)

@ -1,29 +1,29 @@
## Any
Check whether any element of a boolean vector is true
## All
Check whether all elements of a boolean vector are true
### Declaration
```glsl
bool all(bvec2 x)
bool all(bvec3 x)
bool all(bvec4 x)
bool any(bvec2 x)
bool any(bvec3 x)
bool any(bvec4 x)
```
### Parameters
```x``` specifies the vector to be tested for truth.
### Description
```any()``` returns true if any element of ```x``` is ```true``` and ```false``` otherwise. It is functionally equivalent to:
```all()``` returns true if all elements of ```x``` are ```true``` and ```false``` otherwise. It is functionally equivalent to:
```glsl
bool any(bvec x) { // bvec can be bvec2, bvec3 or bvec4
bool result = false;
bool all(bvec x){ // bvec can be bvec2, bvec3 or bvec4
bool result = true;
int i;
for (i = 0; i < x.length(); ++i) {
result |= x[i];
for (i = 0; i < x.length(); ++i)
{
result &= x[i];
}
return result;
}
```
### See Also
[any()](/glossary/?search=any), [not()](/glossary/?search=not)

@ -0,0 +1,29 @@
## Any
Kiểm tra xem có giá trị nào trong 1 vector kiểu boolean bằng true không
### Các phiên bản
```glsl
bool all(bvec2 x)
bool all(bvec3 x)
bool all(bvec4 x)
```
### Các tham số
```x``` vector cần kiểm tra
### Mô tả
```any()``` trả về ```true``` nếu có bất kỳ một giá trị nào trong vector ```x``` bằng ```true```, ngược lại trả về ```false```. Hàm này tương đương với:
```glsl
bool any(bvec x) { // bvec can be bvec2, bvec3 or bvec4
bool result = false;
int i;
for (i = 0; i < x.length(); ++i) {
result |= x[i];
}
return result;
}
```
### Tham khảo thêm
[any()](/glossary/?lan=vi&search=any), [not()](/glossary/?lan=vi&search=not)

@ -1,29 +1,29 @@
## All
Check whether all elements of a boolean vector are true
## Any
Check whether any element of a boolean vector is true
### Declaration
```glsl
bool any(bvec2 x)
bool any(bvec3 x)
bool any(bvec4 x)
bool all(bvec2 x)
bool all(bvec3 x)
bool all(bvec4 x)
```
### Parameters
```x``` specifies the vector to be tested for truth.
### Description
```all()``` returns true if all elements of ```x``` are ```true``` and ```false``` otherwise. It is functionally equivalent to:
```any()``` returns true if any element of ```x``` is ```true``` and ```false``` otherwise. It is functionally equivalent to:
```glsl
bool all(bvec x){ // bvec can be bvec2, bvec3 or bvec4
bool result = true;
bool any(bvec x) { // bvec can be bvec2, bvec3 or bvec4
bool result = false;
int i;
for (i = 0; i < x.length(); ++i)
{
result &= x[i];
for (i = 0; i < x.length(); ++i) {
result |= x[i];
}
return result;
}
```
### See Also
[any()](/glossary/?search=any), [not()](/glossary/?search=not)

@ -0,0 +1,21 @@
## Asin
Tính góc lượng giác ứng với giá trị sine
### Các phiên bản
```glsl
float asin(float x)
vec2 asin(vec2 x)
vec3 asin(vec3 x)
vec4 asin(vec4 x)
```
### Các tham số
```x``` giá trị sine cần tìm góc lượng giác tương ứng
### Mô tả
```asin()``` trả về góc lượng giác (đơn vị radian) tương ứng với giá trị sine bằng ```x```.
<div class="simpleFunction" data="y = asin(x); "></div>
### Tham khảo thêm
[cos](/glossary/?lan=vi&search=cos), [sin](/glossary/?lan=vi&search=sin), [acos](/glossary/?lan=vi&search=acos), [tan](/glossary/?lan=vi&search=tan), [atan](/glossary/?lan=vi&search=atan), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,29 @@
## Atan
Tính góc lượng giác tương ứng với giá trị tan
### Các phiên bản
```glsl
float atan(float y, float x)
vec2 atan(vec2 y, vec2 x)
vec3 atan(vec3 y, vec3 x)
vec4 atan(vec4 y, vec4 x)
float atan(float y_over_x)
vec2 atan(vec2 y_over_x)
vec3 atan(vec3 y_over_x)
vec4 atan(vec4 y_over_x)
```
### Các tham số
```y``` tử số của hàm tan
```x``` mẫu số của hàm tan
```y_over_x``` giá trị tan dạng phân số cần tìm góc tương ứng
### Mô tả
```atan()``` trả về góc lượng giác (đơn vị radian) ứng với tan bằng ```y,x``` hoặc ```y_over_x```, tuỳ theo phiên bản được sử dụng. Ở phiên bản đầu tiên thì dấu của ```y``` và ```x``` sẽ được dùng để xác định góc phần tư của góc lượng giác. Kết quả trả về trong trường hợp này sẽ nằm trong khoảng [-PI, PI]. Nếu ```x``` bằng không thì kết quả không xác định.
Ở phiên bản thứ hai, ```atan()``` trả về góc lượng giác (đơn vị radian) ứng với tan bằng ```y_over_x```. Kết quả trả về trong trường hợp này sẽ nằm trong khoảng [-PI/2, PI/2].
### Tham khảo thêm
[cos](/glossary/?lan=vi&search=cos), [acos](/glossary/?lan=vi&search=acos), [sin](/glossary/?lan=vi&search=sin), [asin](/glossary/?lan=vi&search=asin), [atan](/glossary/?lan=vi&search=atan), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi), [Chapter 06: Color](/06/)

@ -0,0 +1,15 @@
## Attribute
Đánh dấu dữ liệu về các đỉnh của mesh.
### Ví dụ
```glsl
attribute vec4 v_color;
```
### Mô tả
```attribute``` đánh dấu dữ liệu về các đỉnh của mesh gửi từ môi trường WebGL/OpenGL cho vertex shader.
Vì vertex shader chỉ thực thi một lần cho mỗi đỉnh, nên các thuộc tính của mỗi đỉnh phải được chỉ đích danh: vị trí, màu sắc, vector pháp tuyến và toạ độ UV.
### Tham khảo thêm
[const](/glossary/?lan=vi&search=const), [uniform](/glossary/?lan=vi&search=uniform), [varying](/glossary/?lan=vi&search=varying), [Chương 03: Uniform](/03/?lan=vi)

@ -0,0 +1,15 @@
## Bool
Kiểu dữ liệu boolean
### Các phiên bản
```glsl
bool aBool = true;
bool bBool = bool(aInt);
bool cBool = bool(aFloat);
```
### Mô tả
```bool``` chỉ nhận 1 trong 2 giá trị đúng hoặc sai
### Tham khảo thêm
[void](/glossary/?lan=vi&search=void), [bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [struct](/glossary/?lan=vi&search=struct)

@ -0,0 +1,20 @@
## Bvec2
Vector boolean 2 chiều
### Các phiên bản
```glsl
bvec2 aBvec2 = bvec2(true, true);
bvec2 bBvec2 = bvec2(true);
bvec2 cBvec2 = bvec2(aBvec3);
bvec2 dBvec2 = bvec2(aBvec3.x, aBvec3.y);
```
### Mô tả
```bvec2``` vector boolean gồm 2 thành phần. Nó có thể được khởi tạo bằng các cách:
- Chỉ định giá trị của từng thành phần
- Chỉ định 1 giá trị chung cho cả 2 thành phần
- Lấy giá trị từ 1 vector nhiều chiều hơn. Các thành phần sẽ được khởi tạo theo thứ tự.
### Tham khảo thêm
[bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [ivec2](/glossary/?lan=vi&search=ivec2), [ivec3](/glossary/?lan=vi&search=ivec3), [ivec4](/glossary/?lan=vi&search=ivec4), [vec2](/glossary/?lan=vi&search=vec2), [vec3](/glossary/?lan=vi&search=vec3), [vec4](/glossary/?lan=vi&search=vec4), [mat2](/glossary/?lan=vi&search=mat2), [mat3](/glossary/?lan=vi&search=mat3), [mat4](/glossary/?lan=vi&search=mat4)

@ -0,0 +1,24 @@
## Bvec3
Vector boolean 3 chiều
### Các phiên bản
```glsl
vec3 aBvec3 = bvec3(true, true, true);
vec3 bBvec3 = bvec3(true);
vec3 cBvec3 = bvec3(aBvec4);
vec3 dBvec3 = bvec3(aBvec4.x, aBvec4.y, aBvec4.z);
vec3 eBvec3 = bvec3(aBvec2, aBool);
vec3 fBvec3 = bvec3(aBvec2.x, aBvec2.y, aBool);
```
### Mô tả
```bvec3``` vector boolean gồm 3 thành phần. Nó có thể được khởi tạo bằng các cách:
- Chỉ định giá trị của từng thành phần
- Chỉ định 1 giá trị chung cho cả 3 thành phần
- Lấy giá trị từ 1 vector nhiều chiều hơn. Các thành phần sẽ được khởi tạo theo thứ tự.
- Lấy giá trị theo thứ tự lần lượt từ nhiều vector, miễn là đủ 3 thành phần.
### Tham khảo thêm
[bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [ivec2](/glossary/?lan=vi&search=ivec2), [ivec3](/glossary/?lan=vi&search=ivec3), [ivec4](/glossary/?lan=vi&search=ivec4), [vec2](/glossary/?lan=vi&search=vec2), [vec3](/glossary/?lan=vi&search=vec3), [vec4](/glossary/?lan=vi&search=vec4), [mat2](/glossary/?lan=vi&search=mat2), [mat3](/glossary/?lan=vi&search=mat3), [mat4](/glossary/?lan=vi&search=mat4)

@ -0,0 +1,20 @@
## Bvec4
Vector boolean 4 chiều
### Các phiên bản
```glsl
vec4 aBvec4 = bvec4(true, true, true, true);
vec4 bBvec4 = bvec4(true);
vec4 cBvec4 = bvec4(aBvec2, aBool, aBvec3);
vec4 dBvec4 = bvec4(aBvec2.x, aBvec2.y, aBool, aBvec3.x);
```
### Mô tả
```bvec4``` vector boolean gồm 4 thành phần. Nó có thể được khởi tạo bằng các cách:
- Chỉ định giá trị của từng thành phần
- Chỉ định 1 giá trị chung cho cả 4 thành phần
- Lấy giá trị theo thứ tự lần lượt từ nhiều vector, miễn là đủ 4 thành phần.
### Tham khảo thêm
[bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [ivec2](/glossary/?lan=vi&search=ivec2), [ivec3](/glossary/?lan=vi&search=ivec3), [ivec4](/glossary/?lan=vi&search=ivec4), [vec2](/glossary/?lan=vi&search=vec2), [vec3](/glossary/?lan=vi&search=vec3), [vec4](/glossary/?lan=vi&search=vec4), [mat2](/glossary/?lan=vi&search=mat2), [mat3](/glossary/?lan=vi&search=mat3), [mat4](/glossary/?lan=vi&search=mat4)

@ -0,0 +1,21 @@
## Ceil
Tìm số nguyên lớn hơn hoặc bằng gần nhất (làm tròn lên).
### Các phiên bản
```glsl
float ceil(float x)
vec2 ceil(vec2 x)
vec3 ceil(vec3 x)
vec4 ceil(vec4 x)
```
### Các tham số
```x``` giá trị cần làm tròn
### Mô tả
```ceil()``` làm tròn ```x``` thành số lớn hơn hoặc bằng.
<div class="simpleFunction" data="y = ceil(x); "></div>
### Tham khảo thêm
[floor](/glossary/?lan=vi&search=floor), [fract](/glossary/?lan=vi&search=fract), [mod](/glossary/?lan=vi&search=mod), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,29 @@
## Clamp
Giới hạn 1 giá trị nằm trong 1 khoảng.
### Các phiên bản
```glsl
float clamp(float x, float minVal, float maxVal)
vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal)
vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal)
vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal)
vec2 clamp(vec2 x, float minVal, float maxVal)
vec3 clamp(vec3 x, float minVal, float maxVal)
vec4 clamp(vec4 x, float minVal, float maxVal)
```
### Các tham số
```x``` giá trị cần giới hạn.
```minVal``` giá trị nhỏ nhất trong khoảng giới hạn
```maxVal``` giá trị lớn nhất trong khoảng giới hạn
### Mô tả
```clamp()``` trả về giá trị ```x``` sau khi đã đảm bảo nó nằm trong khoảng từ ```minVal``` tới ```maxVal```. Cách tính chi tiết: ```min(max(x, minVal), maxVal)```.
<div class="simpleFunction" data="y = clamp(x,0.,1.); "></div>
### Tham khảo thêm
[min](/glossary/?lan=vi&search=min), [abs](/glossary/?lan=vi&search=abs), [max](/glossary/?lan=vi&search=max)

@ -0,0 +1,13 @@
## Const
Qualifier đánh dấu một hằng số
### Ví dụ
```glsl
const float PI = 3.14159265359;
```
### Mô tả
```const``` khiến cho giá trị của một biến không thể bị thay đổi
### Tham khảo thêm
[attribute](/glossary/?lan=vi&search=attribute), [uniform](/glossary/?lan=vi&search=uniform), [varying](/glossary/?lan=vi&search=varying)

@ -0,0 +1,21 @@
## Cos
Tính hàm cosine của 1 góc lượng giác
### Các phiên bản
```glsl
float cos(float angle)
vec2 cos(vec2 angle)
vec3 cos(vec3 angle)
vec4 cos(vec4 angle)
```
### Các tham số
```angle``` góc lượng giác (đơn vị radian) cần tính cosine
### Mô tả
```cos()``` trả về giá trị cosine tương ứng với góc ```angle```
<div class="simpleFunction" data="y = cos(x); "></div>
### Tham khảo thêm
[acos](/glossary/?lan=vi&search=acos), [sin](/glossary/?lan=vi&search=sin), [asin](/glossary/?lan=vi&search=asin), [tan](/glossary/?lan=vi&search=tan), [atan](/glossary/?lan=vi&search=atan), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,19 @@
## Cross
Tính tích có hướng của 2 vector
### Các phiên bản
```glsl
vec3 cross(vec3 x, vec3 y)
```
### Các tham số
```x``` Vector thứ nhất
```y``` Vector thứ hai
### Mô tả
```cross()``` trả về tích có hướng của hai vector ```x``` và ```y```. Các tham số đầu vào phải là các vector số thực 3 chiều.
### Tham khảo thêm
[dot()](/glossary/?lan=vi&search=dot)

@ -0,0 +1,17 @@
## DFdx
Tính đạo hàm riêng của x
### Các phiên bản
```glsl
genType dFdx( genType p);
```
### Các tham số
```p``` biểu thức cần tính đạo hàm riêng
### Mô tả
Chỉ được dùng trong fragment shader, hàm ```dFdx``` sẽ trả về đạo hàm riêng của biểu thức ```p``` ứng với giá trị```x```. Đạo hàm được tính bằng phương pháp sai phân hữu hạn. Không tính được kết quả của đạo hàm bậc cao như ```dFdx(dFdx(n))```. Giả thiết là biểu thức ```p``` là một hàm liên tục.
### Tham khảo thêm
[dFdy()](/glossary/?lan=vi&search=dFdy)

@ -0,0 +1,17 @@
## DFdy
Tính đạo hàm riêng của y
### Các phiên bản
```glsl
genType dFdx( genType p);
```
### Các tham số
```p``` biểu thức cần tính đạo hàm riêng
### Mô tả
Chỉ được dùng trong fragment shader, hàm ```dFdy``` sẽ trả về đạo hàm riêng của biểu thức ```p``` ứng với giá trị```x```. Đạo hàm được tính bằng phương pháp sai phân hữu hạn. Không tính được kết quả của đạo hàm bậc cao như ```dFdy(dFdy(n))```. Giả thiết là biểu thức ```p``` là một hàm liên tục.
### Tham khảo thêm
[dFdx()](/glossary/?lan=vi&search=dFdx)

@ -0,0 +1,19 @@
## Degrees
Chuyển đổi góc từ đơn vị radian sang độ
### Các phiên bản
```glsl
float degrees(float radians)
vec2 degrees(vec2 radians)
vec3 degrees(vec3 radians)
vec4 degrees(vec4 radians)
```
### Các tham số
```radians``` góc theo đơn vị radian
### Mô tả
```degrees()``` trả về góc tính bằng độ tương ứng, theo công thức: ```(180.0 * radians)/PI```
### Tham khảo thêm
[radians](/glossary/?lan=vi&search=radians)

@ -0,0 +1,24 @@
## Distance
Tính khoảng cách giữa hai điểm
### Các phiên bản
```glsl
float distance(float p0, float p1)
float distance(vec2 p0, vec2 p1)
float distance(vec3 p0, vec3 p1)
float distance(vec4 p0, vec4 p1)
```
### Các tham số
```p0``` Điểm đầu tiên
```p1``` Điểm thứ hai
### Mô tả
```distance()``` trả về khoảng cách giữa hai điểm ```p0``` và ```p1```.
<div class="codeAndCanvas" data="../07/circle-making.frag"></div>
### Tham khảo thêm
[length()](/glossary/?lan=vi&search=length), [normalize()](/glossary/?lan=vi&search=normalize), [Chapter 07: Shapes](/07/)

@ -0,0 +1,28 @@
## Dot
Tính tích vô hướng của hai vector
### Các phiên bản
```glsl
float dot(float x, float y)
float dot(vec2 x, vec2 y)
float dot(vec3 x, vec3 y)
float dot(vec4 x, vec4 y)
```
### Các tham số
```x``` Vector thứ nhất
```y``` Vector thứ hai
### Mô tả
```dot()``` trả về tích vô hướng của hai vector ```x``` và ```y``` theo công thức ```x[0]⋅y[0]+x[1]⋅y[1]+...```
Nếu ```x``` và ```y``` giống nhau thì căn bậc hai của tích vô hướng sẽ bằng đúng chiều dài của vector.
are the same the square root of the dot product is equivalent to the length of the vector. The input parameters can be floating scalars or float vectors. In case of floating scalars the dot function is trivial and returns the product of x and y.
<div class="codeAndCanvas" data="../07/circle.frag"></div>
### Tham khảo thêm
[cross()](/glossary/?lan=vi&search=cross), [Chapter 07: Shapes](/07/)

@ -0,0 +1,24 @@
## Equal
Perform a component-wise equal-to comparison of two vectors
### Các phiên bản
```glsl
bvec2 equal(vec2 x, vec2 y)
bvec3 equal(vec3 x, vec3 y)
bvec4 equal(vec4 x, vec4 y)
bvec2 equal(ivec2 x, ivec2 y)
bvec3 equal(ivec3 x, ivec3 y)
bvec4 equal(ivec4 x, ivec4 y)
```
### Các tham số
```x``` Specifies the first vector to be used in the comparison operation.
```y``` Specifies the second vector to be used in the comparison operation.
### Mô tả
```equal()``` returns a boolean vector in which each element ```i``` is computed as ```x[i] == y[i]```.
### Tham khảo thêm
[lessThanEqual()](/glossary/?lan=vi&search=lessThanEqual), [lessThan()](/glossary/?lan=vi&search=lessThan), [greaterThanEqual()](/glossary/?lan=vi&search=greaterThanEqual), [greaterThan()](/glossary/?lan=vi&search=greaterThan), [notEqual()](/glossary/?lan=vi&search=notEqual), [any()](/glossary/?lan=vi&search=any), [all()](/glossary/?lan=vi&search=all), [not()](/glossary/?lan=vi&search=not)

@ -0,0 +1,22 @@
## Exp
Return the natural exponentiation of the parameter
### Các phiên bản
```glsl
float exp(float x)
vec2 exp(vec2 x)
vec3 exp(vec3 x)
vec4 exp(vec4 x)
```
### Các tham số
```x``` specify the value to exponentiate.
### Mô tả
```exp()``` returns the natural exponentiation of ```x```.
<div class="simpleFunction" data="y = exp(x); "></div>
### Tham khảo thêm
[log](/glossary/?lan=vi&search=log), [log2](/glossary/?lan=vi&search=log2), [exp2](/glossary/?lan=vi&search=exp2), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,22 @@
## Exp2
Return 2 raised to the power of the parameter
### Các phiên bản
```glsl
float exp2(float x)
vec2 exp2(vec2 x)
vec3 exp2(vec3 x)
vec4 exp2(vec4 x)
```
### Các tham số
```x``` specify the value of the power to which 2 will be raised.
### Mô tả
```exp2()``` returns 2 raised to the power of ```x```.
<div class="simpleFunction" data="y = exp2(x); "></div>
### Tham khảo thêm
[log](/glossary/?lan=vi&search=log), [log2](/glossary/?lan=vi&search=log2), [exp](/glossary/?lan=vi&search=exp), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,23 @@
## Faceforward
Return a vector pointing in the same direction as another
### Các phiên bản
```glsl
float faceforward(float N, float I, float Nref)
vec2 faceforward(vec2 N, vec2 I, vec2 Nref)
vec3 faceforward(vec3 N, vec3 I, vec3 Nref)
vec4 faceforward(vec4 N, vec4 I, vec4 Nref)
```
### Các tham số
```N``` specifies the vector to orient.
```I``` specifies the incident vector.
```Nref``` specifies the reference vector.
### Mô tả
```faceforward()``` orients a vector to point away from a surface as defined by its normal. ```If dot(Nref, I) < 0``` faceforward returns ```N```, otherwise it returns ```-N```.
### Tham khảo thêm
[reflect()](/glossary/?lan=vi&search=reflect), [refract()](/glossary/?lan=vi&search=refract)

@ -0,0 +1,15 @@
## Float
Floating-point variable type
### Các phiên bản
```glsl
float aFloat = 1.0;
float bFloat = float(aBool);
float cFloat = float(aInt);
```
### Mô tả
```float``` is used for floating point values.
### Tham khảo thêm
[void](/glossary/?lan=vi&search=void), [bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [struct](/glossary/?lan=vi&search=struct)

@ -0,0 +1,21 @@
## Floor
Find the nearest integer less than or equal to the parameter
### Các phiên bản
```glsl
float floor(float x)
vec2 floor(vec2 x)
vec3 floor(vec3 x)
vec4 floor(vec4 x)
```
### Các tham số
```x``` specify the value to evaluate.
### Mô tả
```floor()``` returns a value equal to the nearest integer that is less than or equal to ```x```.
<div class="simpleFunction" data="y = floor(x); "></div>
### Tham khảo thêm
[ceil](/glossary/?lan=vi&search=ceil), [fract](/glossary/?lan=vi&search=fract), [mod](/glossary/?lan=vi&search=mod), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,21 @@
## Fract
Compute the fractional part of the argument
### Các phiên bản
```glsl
float fract(float x)
vec2 fract(vec2 x)
vec3 fract(vec3 x)
vec4 fract(vec4 x)
```
### Các tham số
```x``` specify the value to evaluate.
### Mô tả
```fract()``` returns the fractional part of ```x```. This is calculated as ```x - floor(x)```.
<div class="simpleFunction" data="y = fract(x); "></div>
### Tham khảo thêm
[floor](/glossary/?lan=vi&search=floor), [ceil](/glossary/?lan=vi&search=ceil), [mod](/glossary/?lan=vi&search=mod), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,9 @@
## Gl_FragColor
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## G_FragCoord
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_FrontFacing
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_MaxCombinedTextureImages
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_MaxDrawBuffers
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_MaxFragmentUniformVectors
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_MaxTextureImageUnits
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_MaxVaryingVectors
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_MaxVertexAttrbis
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_MaxVertexTextureImageUnits
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_PointCoord
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_PointSize
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Gl_Position
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,24 @@
## GreaterThan
Perform a component-wise greater-than comparison of two vectors
### Các phiên bản
```glsl
bvec2 greaterThan(vec2 x, vec2 y)
bvec3 greaterThan(vec3 x, vec3 y)
bvec4 greaterThan(vec4 x, vec4 y)
bvec2 greaterThan(ivec2 x, ivec2 y)
bvec3 greaterThan(ivec3 x, ivec3 y)
bvec4 greaterThan(ivec4 x, ivec4 y)
```
### Các tham số
```x``` specifies the first vector to be used in the comparison operation.
```y``` specifies the second vector to be used in the comparison operation.
### Mô tả
```greaterThan()``` returns a boolean vector in which each element ```i``` is computed as ```x[i] > y[i]```.
### Tham khảo thêm
[lessThanEqual()](/glossary/?lan=vi&search=lessThanEqual), [lessThan()](/glossary/?lan=vi&search=lessThan), [greaterThanEqual()](/glossary/?lan=vi&search=greaterThanEqual), [equal()](/glossary/?lan=vi&search=equal), [notEqual()](/glossary/?lan=vi&search=notEqual), [any()](/glossary/?lan=vi&search=any), [all()](/glossary/?lan=vi&search=all), [not()](/glossary/?lan=vi&search=not)

@ -0,0 +1,24 @@
## GreaterThanEqual
Perform a component-wise greater-than-or-equal comparison of two vectors
### Các phiên bản
```glsl
bvec2 greaterThanEqual(vec2 x, vec2 y)
bvec3 greaterThanEqual(vec3 x, vec3 y)
bvec4 greaterThanEqual(vec4 x, vec4 y)
bvec2 greaterThanEqual(ivec2 x, ivec2 y)
bvec3 greaterThanEqual(ivec3 x, ivec3 y)
bvec4 greaterThanEqual(ivec4 x, ivec4 y)
```
### Các tham số
```x``` specifies the first vector to be used in the comparison operation.
```y``` specifies the second vector to be used in the comparison operation.
### Mô tả
```greaterThanEqual()``` returns a boolean vector in which each element ```i``` is computed as ```x[i] ≥ y[i]```.
### Tham khảo thêm
[lessThanEqual()](/glossary/?lan=vi&search=lessThanEqual), [lessThan()](/glossary/?lan=vi&search=lessThan), [greaterThan()](/glossary/?lan=vi&search=greaterThan), [equal()](/glossary/?lan=vi&search=equal), [notEqual()](/glossary/?lan=vi&search=notEqual), [any()](/glossary/?lan=vi&search=any), [all()](/glossary/?lan=vi&search=all), [not()](/glossary/?lan=vi&search=not)

@ -0,0 +1,9 @@
## Highp
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## In
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -1,6 +1,16 @@
<?php
$path = "..";
$README = "README";
$language = "";
if ( !empty($_GET['lan']) ) {
if (file_exists($README.'-'.$_GET['lan'].'.md')) {
$language = '-'.$_GET['lan'];
$README .= $language;
}
}
if(!empty($_GET))
$subtitle = ": ".$_GET['search'];
@ -15,10 +25,10 @@
<?php
$Parsedown = new Parsedown();
if(empty($_GET))
echo $Parsedown->text(file_get_contents ('README.md'));
if(empty($_GET['search']))
echo $Parsedown->text(file_get_contents($README.'.md'));
else
echo $Parsedown->text(file_get_contents ( $_GET['search'].'/README.md' ));
echo $Parsedown->text(file_get_contents ( $_GET['search'].'/'.$README.'.md' ));
echo '
</div>

@ -0,0 +1,9 @@
## Inout
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,15 @@
## Int
Integer data type
### Các phiên bản
```glsl
int aInt = 42;
int bInt = int(aBool);
int cInt = int(aFloat);
```
### Mô tả
```int``` is used for integer values.
### Tham khảo thêm
[void](/glossary/?lan=vi&search=void), [bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [ivec2](/glossary/?lan=vi&search=ivec2), [ivec3](/glossary/?lan=vi&search=ivec3), [ivec4](/glossary/?lan=vi&search=ivec4)

@ -0,0 +1,22 @@
## Inversesqrt
Return the inverse of the square root of the parameter
### Các phiên bản
```glsl
float inversesqrt(float x)
vec2 inversesqrt(vec2 x)
vec3 inversesqrt(vec3 x)
vec4 inversesqrt(vec4 x)
```
### Các tham số
```x``` specify the value of which to take the inverse of the square root.
### Mô tả
```inversesqrt()``` returns the inverse of the square root of ```x```.
<div class="simpleFunction" data="y = inversesqrt(x); "></div>
### Tham khảo thêm
[pow](/glossary/?lan=vi&search=pow), [sqrt](/glossary/?lan=vi&search=sqrt), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,21 @@
## Ivec2
2 dimensional integer vector
### Các phiên bản
```glsl
bvec2 aIvec2 = ivec2(1, 1);
bvec2 bIvec2 = ivec2(1);
bvec2 cIvec2 = ivec2(aIvec3);
bvec2 dIvec2 = ivec2(aIvec3.x, aIvec3.y);
```
### Mô tả
```ivec2``` is an integer vector with two components. It can be initialized by:
- Providing a scalar value for each component.
- Providing one scalar value. This value is used for all components.
- Providing a vector of higher dimension. The respective values are used to initialize the components.
### Tham khảo thêm
[bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [ivec2](/glossary/?lan=vi&search=ivec2), [ivec3](/glossary/?lan=vi&search=ivec3), [ivec4](/glossary/?lan=vi&search=ivec4), [vec2](/glossary/?lan=vi&search=vec2), [vec3](/glossary/?lan=vi&search=vec3), [vec4](/glossary/?lan=vi&search=vec4), [mat2](/glossary/?lan=vi&search=mat2), [mat3](/glossary/?lan=vi&search=mat3), [mat4](/glossary/?lan=vi&search=mat4)

@ -0,0 +1,25 @@
## Ivec3
3 dimensional integer vector
### Các phiên bản
```glsl
vec3 aIvec3 = ivec3(1, 1, 1);
vec3 bIvec3 = ivec3(1);
vec3 cIvec3 = ivec3(aIvec4);
vec3 dIvec3 = ivec3(aIvec4.x, aIvec4.y, aIvec4.z);
vec3 eIvec3 = ivec3(aIvec2, aInt);
vec3 fIvec3 = ivec3(aIvec2.x, aIvec2.y, aInt);
```
### Mô tả
```ivec3``` is an integer vector with three components. It can be initialized by:
- Providing a scalar value for each component.
- Providing one scalar value. This value is used for all components.
- Providing a vector of higher dimension. The respective values are used to initialize the components.
- Providing a combination of vectors and/or scalars. The respective values are used to initialize the vector. The arguments of the constructor must have at least as many components as the vector that is initialized.
### Tham khảo thêm
[bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [ivec2](/glossary/?lan=vi&search=ivec2), [ivec3](/glossary/?lan=vi&search=ivec3), [ivec4](/glossary/?lan=vi&search=ivec4), [vec2](/glossary/?lan=vi&search=vec2), [vec3](/glossary/?lan=vi&search=vec3), [vec4](/glossary/?lan=vi&search=vec4), [mat2](/glossary/?lan=vi&search=mat2), [mat3](/glossary/?lan=vi&search=mat3), [mat4](/glossary/?lan=vi&search=mat4)

@ -0,0 +1,21 @@
## Ivec4
4 dimensional integer vector
### Các phiên bản
```glsl
vec4 aIvec4 = ivec4(1, 1, 1, 1);
vec4 bIvec4 = ivec4(1);
vec4 cIvec4 = ivec4(aIvec2, aInteger, aIvec3);
vec4 dIvec4 = ivec4(aIvec2.x, aIvec2.y, aInt, aIvec3.x);
```
### Mô tả
```ivec4``` is an integer vector with four components. It can be initialized by:
- Providing a scalar value for each component.
- Providing one scalar value. This value is used for all components.
- Providing a combination of vectors and/or scalars. The respective values are used to initialize the vector. The arguments of the constructor must have at least as many components as the vector that is initialized.
### Tham khảo thêm
[bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [ivec2](/glossary/?lan=vi&search=ivec2), [ivec3](/glossary/?lan=vi&search=ivec3), [ivec4](/glossary/?lan=vi&search=ivec4), [vec2](/glossary/?lan=vi&search=vec2), [vec3](/glossary/?lan=vi&search=vec3), [vec4](/glossary/?lan=vi&search=vec4), [mat2](/glossary/?lan=vi&search=mat2), [mat3](/glossary/?lan=vi&search=mat3), [mat4](/glossary/?lan=vi&search=mat4)

@ -0,0 +1,22 @@
## Length
Calculate the length of a vector
### Các phiên bản
```glsl
float length(float x)
float length(vec2 x)
float length(vec3 x)
float length(vec4 x)
```
### Các tham số
```x``` specifies a vector of which to calculate the length.
### Mô tả
```length()``` returns the length of the vector.
<div class="codeAndCanvas" data="../07/circle-making.frag"></div>
### Tham khảo thêm
[distance()](/glossary/?lan=vi&search=distance), [normalize()](/glossary/?lan=vi&search=normalize), [Chapter 07: Shapes](/07/)

@ -0,0 +1,24 @@
## LessThan
Perform a component-wise less-than comparison of two vectors
### Các phiên bản
```glsl
bvec2 lessThan(vec2 x, vec2 y)
bvec3 lessThan(vec3 x, vec3 y)
bvec4 lessThan(vec4 x, vec4 y)
bvec2 lessThan(ivec2 x, ivec2 y)
bvec3 lessThan(ivec3 x, ivec3 y)
bvec4 lessThan(ivec4 x, ivec4 y)
```
### Các tham số
```x``` specifies the first vector to be used in the comparison operation.
```y``` specifies the second vector to be used in the comparison operation.
### Mô tả
```lessThan()``` returns a boolean vector in which each element ```i``` is computed as ```x[i] < y[i]```.
### Tham khảo thêm
[lessThanEqual()](/glossary/?lan=vi&search=lessThanEqual), [greaterThan()](/glossary/?lan=vi&search=greaterThan), [greaterThanEqual()](/glossary/?lan=vi&search=greaterThanEqual), [equal()](/glossary/?lan=vi&search=equal), [notEqual()](/glossary/?lan=vi&search=notEqual), [any()](/glossary/?lan=vi&search=any), [all()](/glossary/?lan=vi&search=all), [not()](/glossary/?lan=vi&search=not)

@ -0,0 +1,24 @@
## LessThanEqual
Perform a component-wise less-than-or-equal comparison of two vectors
### Các phiên bản
```glsl
bvec2 lessThanEqual(vec2 x, vec2 y)
bvec3 lessThanEqual(vec3 x, vec3 y)
bvec4 lessThanEqual(vec4 x, vec4 y)
bvec2 lessThanEqual(ivec2 x, ivec2 y)
bvec3 lessThanEqual(ivec3 x, ivec3 y)
bvec4 lessThanEqual(ivec4 x, ivec4 y)
```
### Các tham số
```x``` specifies the first vector to be used in the comparison operation.
```y``` specifies the second vector to be used in the comparison operation.
### Mô tả
```lessThanEqual()``` returns a boolean vector in which each element ```i``` is computed as ```x[i] ≤ y[i]```.
### Tham khảo thêm
[lessThan()](/glossary/?lan=vi&search=lessThan), [greaterThan()](/glossary/?lan=vi&search=greaterThan), [greaterThanEqual()](/glossary/?lan=vi&search=greaterThanEqual), [equal()](/glossary/?lan=vi&search=equal), [notEqual()](/glossary/?lan=vi&search=notEqual), [any()](/glossary/?lan=vi&search=any), [all()](/glossary/?lan=vi&search=all), [not()](/glossary/?lan=vi&search=not)

@ -0,0 +1,22 @@
## Log
Return the natural logarithm of the parameter
### Các phiên bản
```glsl
float log(float x)
vec2 log(vec2 x)
vec3 log(vec3 x)
vec4 log(vec4 x)
```
### Các tham số
```x``` specify the value of which to take the natural logarithm.
### Mô tả
```log()``` returns the natural logarithm of ```x```.
<div class="simpleFunction" data="y = log(x); "></div>
### Tham khảo thêm
[log2](/glossary/?lan=vi&search=log2), [exp](/glossary/?lan=vi&search=exp), [exp2](/glossary/?lan=vi&search=exp2), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,22 @@
## Log2
Return the base 2 logarithm of the parameter
### Các phiên bản
```glsl
float log2(float x)
vec2 log2(vec2 x)
vec3 log2(vec3 x)
vec4 log2(vec4 x)
```
### Các tham số
```x``` specify the value of which to take the base 2 logarithm.
### Mô tả
```log2()``` returns the base 2 logarithm of ```x```.
<div class="simpleFunction" data="y = log2(x); "></div>
### Tham khảo thêm
[log](/glossary/?lan=vi&search=log), [exp](/glossary/?lan=vi&search=exp), [exp2](/glossary/?lan=vi&search=exp2), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,9 @@
## Lowp
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Main
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,34 @@
## Mat2
2x2 floating point matrix
### Các phiên bản
```glsl
mat2 aMat2 = mat2(1.0, 0.0, // 1. column
0.0, 1.0); // 2. column
mat2 bMat2 = mat2(1.0);
mat2 cMat2 = mat2(aVec2, bVec2);
mat2 dMat2 = mat2(aVec3, aFloat);
```
### Mô tả
```mat2``` data type is compose for a 2x2 matrix of floating point. As you can see above, can be initialize in different ways:
- Providing a value for each component column by column.
- Providing one value that is used for the components on the main diagonal.
- Providing a combination of vectors and scalars.
In the same way data can be accessed component-wise or column by column:
```glsl
mat2 aMat2;
aMat2[1][1] = 1.0;
float aFloat = aMat2[1][1];
aMat2[0] = vec2(1.0);
vec2 aVec2 = aMat2[0];
```
### Tham khảo thêm
[mat3](/glossary/?lan=vi&search=mat3), [mat4](/glossary/?lan=vi&search=mat4), [matrixCompMult()](/glossary/?lan=vi&search=matrixCompMult)

@ -0,0 +1,37 @@
## Mat3
3x3 floating point matrix
### Các phiên bản
```glsl
mat3 aMat3 = mat3(1.0, 0.0, 0.0, // 1. column
0.0, 1.0, 0.0, // 2. column
0.0, 0.0, 1.0); // 3. column
mat3 bMat3 = mat3(1.0);
mat3 cMat3 = mat3(aVec3, bVec3, cVec3);
mat3 dMat3 = mat3(aVec4, aVec3, bVec4, aFloat);
```
### Mô tả
```mat3``` data type is compose for a 3x3 matrix of floating point. As you can see above, can be initialize in different ways:
- Providing a value for each component column by column.
- Providing one value that is used for the components on the main diagonal.
- Providing a combination of vectors and scalars.
In the same way data can be accessed component-wise or column by column:
```glsl
mat3 aMat3;
aMat3[2][2] = 1.0;
float aFloat = aMat3[2][2];
aMat3[0] = vec3(1.0);
vec3 aVec3 = aMat3[0];
```
### Tham khảo thêm
[mat2](/glossary/?lan=vi&search=mat2), [mat4](/glossary/?lan=vi&search=mat4), [matrixCompMult()](/glossary/?lan=vi&search=matrixCompMult)

@ -0,0 +1,36 @@
## Mat4
4x4 floating point matrix
### Các phiên bản
```glsl
mat4 aMat4 = mat4(1.0, 0.0, 0.0, 0.0, // 1. column
0.0, 1.0, 0.0, 0.0, // 2. column
0.0, 0.0, 1.0, 0.0, // 3. column
0.0, 0.0, 0.0, 1.0); // 4. column
mat4 bMat4 = mat4(1.0);
mat4 cMat4 = mat4(aVec4, bVec4, cVec4, dVec4);
mat4 dMat4 = mat4(aVec4, aVec3, bVec4, cVec4, aFloat);
```
### Mô tả
```mat4``` data type is compose for a 4x4 matrix of floating point. As you can see above, can be initialize in different ways:
- Providing a value for each component column by column.
- Providing one value that is used for the components on the main diagonal.
- Providing a combination of vectors and scalars.
In the same way data can be accessed component-wise or column by column:
```glsl
aMat4[3][3] = 1.0;
float aFloat = aMat4[3][3];
aMat4[0] = vec4(1.0);
vec4 aVec4 = aMat4[0];
```
### Tham khảo thêm
[mat2](/glossary/?lan=vi&search=mat2), [mat3](/glossary/?lan=vi&search=mat3), [matrixCompMult()](/glossary/?lan=vi&search=matrixCompMult)

@ -0,0 +1,20 @@
## MatrixCompMult
Perform a component-wise multiplication of two matrices
### Các phiên bản
```glsl
mat2 matrixCompMult(mat2 x, mat2 y)
mat3 matrixCompMult(mat3 x, mat3 y)
mat4 matrixCompMult(mat4 x, mat4 y)
```
### Các tham số
```x``` specifies the first matrix multiplicand.
```y``` specifies the second matrix multiplicand.
### Mô tả
```matrixCompMult()``` performs a component-wise multiplication of two matrices, yielding a result matrix where each component, ```result[i][j]``` is computed as the scalar product of ```x[i][j]``` and ```y[i][j]```.
### Tham khảo thêm
[Chapter 08: Matrix](../08/)

@ -0,0 +1,27 @@
## Max
Return the greater of two values
### Các phiên bản
```glsl
float max(float x, float y)
vec2 max(vec2 x, vec2 y)
vec3 max(vec3 x, vec3 y)
vec4 max(vec4 x, vec4 y)
vec2 max(vec2 x, float y)
vec3 max(vec3 x, float y)
vec4 max(vec4 x, float y)
```
### Các tham số
```x``` specify the first value to compare.
```y``` specify the second value to compare.
### Mô tả
```max()``` returns the maximum of the two parameters. It returns ```y``` if ```y``` is greater than ```x```, otherwise it returns ```x```.
<div class="simpleFunction" data="y = max(x,0.5); "></div>
### Tham khảo thêm
[min](/glossary/?lan=vi&search=min), [abs](/glossary/?lan=vi&search=abs), [clamp](/glossary/?lan=vi&search=clamp), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,9 @@
## Mediump
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,27 @@
## Min
Return the lesser of two values
### Các phiên bản
```glsl
float min(float x, float y)
vec2 min(vec2 x, vec2 y)
vec3 min(vec3 x, vec3 y)
vec4 min(vec4 x, vec4 y)
vec2 min(vec2 x, float y)
vec3 min(vec3 x, float y)
vec4 min(vec4 x, float y)
```
### Các tham số
```x``` specify the first value to compare.
```y``` specify the second value to compare.
### Mô tả
```min()``` returns the minimum of the two parameters. It returns ```y``` if ```y``` is less than ```x```, otherwise it returns ```x```.
<div class="simpleFunction" data="y = min(x,0.5); "></div>
### Tham khảo thêm
[max](/glossary/?lan=vi&search=max), [abs](/glossary/?lan=vi&search=abs), [clamp](/glossary/?lan=vi&search=clamp), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,32 @@
## Mix
Constrain a value to lie between two further values
### Các phiên bản
```glsl
float mix(float x, float y, float a)
vec2 mix(vec2 x, vec2 y, vec2 a)
vec3 mix(vec3 x, vec3 y, vec3 a)
vec4 mix(vec4 x, vec4 y, vec4 a)
vec2 mix(vec2 x, vec2 y, float a)
vec3 mix(vec3 x, vec3 y, float a)
vec4 mix(vec4 x, vec4 y, float a)
```
### Các tham số
```x``` Specify the start of the range in which to interpolate.
```y``` Specify the end of the range in which to interpolate.
```a``` Specify the value to use to interpolate between x and y.
### Mô tả
```mix()``` performs a linear interpolation between ```x``` and ```y``` using ```a``` to weight between them. The return value is computed as ```x×(1a)+y×a```.
<div class="codeAndCanvas" data="../06/mix.frag"></div>
<div class="codeAndCanvas" data="../06/gradient.frag"></div>
### Tham khảo thêm
[min](/glossary/?lan=vi&search=min), [max](/glossary/?lan=vi&search=max), [Chapter 06: Color](/06/)

@ -0,0 +1,26 @@
## Mod
Compute value of one parameter modulo another
### Các phiên bản
```glsl
float mod(float x, float y)
vec2 mod(vec2 x, vec2 y)
vec3 mod(vec3 x, vec3 y)
vec4 mod(vec4 x, vec4 y)
vec2 mod(vec2 x, float y)
vec3 mod(vec3 x, float y)
vec4 mod(vec4 x, float y)
```
### Các tham số
```x``` specify the value to evaluate.
```y``` specify the value to obtain the modulo of.
### Mô tả
```mod()``` returns the value of ```x``` modulo ```y```. This is computed as ```x - y * floor(x/y)```.
<div class="simpleFunction" data="y = mod(x,1.5); "></div>
### Tham khảo thêm
[floor](/glossary/?lan=vi&search=floor), [fract](/glossary/?lan=vi&search=fract), [ceil](/glossary/?lan=vi&search=ceil), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,20 @@
## Normalize
Calculate the unit vector in the same direction as the input vector
### Các phiên bản
```glsl
float normalize(float x)
vec2 normalize(vec2 x)
vec3 normalize(vec3 x)
vec4 normalize(vec4 x)
```
### Các tham số
```x``` specifies the vector to normalize.
### Mô tả
```normalize()``` returns a vector with the same direction as its parameter, ```x```, but with length 1.
### Tham khảo thêm
[length()](/glossary/?lan=vi&search=length)

@ -0,0 +1,18 @@
## Not
Logically invert a boolean vector
### Các phiên bản
```glsl
bvec2 not(bvec2 x)
bvec3 not(bvec3 x)
bvec4 not(bvec4 x)
```
### Các tham số
```x``` specifies the vector to be inverted.
### Mô tả
```not()``` logically inverts the boolean vector ```x```. It returns a new boolean vector for which each element ```i``` is computed as ```!x[i]```.
### Tham khảo thêm
[any()](/glossary/?lan=vi&search=any), [all()](/glossary/?lan=vi&search=all)

@ -0,0 +1,24 @@
## NotEqual
Perform a component-wise not-equal-to comparison of two vectors
### Các phiên bản
```glsl
bvec2 notEqual(vec2 x, vec2 y)
bvec3 notEqual(vec3 x, vec3 y)
bvec4 notEqual(vec4 x, vec4 y)
bvec2 notEqual(ivec2 x, ivec2 y)
bvec3 notEqual(ivec3 x, ivec3 y)
bvec4 notEqual(ivec4 x, ivec4 y)
```
### Các tham số
```x``` specifies the first vector to be used in the comparison operation.
```y``` specifies the second vector to be used in the comparison operation.
### Mô tả
```notEqual()``` returns a boolean vector in which each element ```i``` is computed as ```x[i] != y[i]```.
### Tham khảo thêm
[lessThanEqual()](/glossary/?lan=vi&search=lessThanEqual), [lessThan()](/glossary/?lan=vi&search=lessThan), [greaterThanEqual()](/glossary/?lan=vi&search=greaterThanEqual), [greaterThan()](/glossary/?lan=vi&search=greaterThan), [equal()](/glossary/?lan=vi&search=equal), [any()](/glossary/?lan=vi&search=any), [all()](/glossary/?lan=vi&search=all), [not()](/glossary/?lan=vi&search=not)

@ -0,0 +1,9 @@
## Out
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,24 @@
## Pow
Return the value of the first parameter raised to the power of the second.
### Các phiên bản
```glsl
float pow(float x, float y)
vec2 pow(vec2 x, vec2 y)
vec3 pow(vec3 x, vec3 y)
vec4 pow(vec4 x, vec4 y)
```
### Các tham số
```x``` specify the value to raise to the power ```y```.
```y``` specify the power to which to raise ```x```.
### Mô tả
```pow()``` returns the value of ```x``` raised to the ```y``` power.
<div class="simpleFunction" data="y = pow(x,3.0); "></div>
### Tham khảo thêm
[inversesqrt](/glossary/?lan=vi&search=inversesqrt), [sqrt](/glossary/?lan=vi&search=sqrt), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,9 @@
## Precision
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,19 @@
## Radians
Convert a quantity in degrees to radians
### Các phiên bản
```glsl
float radians(float degrees)
vec2 radians(vec2 degrees)
vec3 radians(vec3 degrees)
vec4 radians(vec4 degrees)
```
### Các tham số
```degrees``` specify the quantity, in degrees, to be converted to radians.
### Mô tả
```radians()``` converts a quantity, specified in degrees into radians. That is, the return value is ```(PI * degrees)/180```.
### Tham khảo thêm
[degrees](/glossary/?lan=vi&search=degrees)

@ -0,0 +1,24 @@
## Reflect
Calculate the reflection direction for an incident vector
### Các phiên bản
```glsl
float reflect(float I, float N)
vec2 reflect(vec2 I, vec2 N)
vec3 reflect(vec3 I, vec3 N)
vec4 reflect(vec4 I, vec4 N)
```
### Các tham số
```I``` specifies the incident vector.
```N``` specifies the normal vector.or.
### Mô tả
For a given incident vector ```I``` and surface normal ```N``` reflect returns the reflection direction calculated as ```I - 2.0 * dot(N, I) * N```.
```N``` should be normalized in order to achieve the desired result.
### Tham khảo thêm
[dot()](/glossary/?lan=vi&search=dot), [refract()](/glossary/?lan=vi&search=refract)

@ -0,0 +1,34 @@
## Refract
Calculate the refraction direction for an incident vector
### Các phiên bản
```glsl
float refract(float I, float N, float eta)
vec2 refract(vec2 I, vec2 N, float eta)
vec3 refract(vec3 I, vec3 N, float eta)
vec4 refract(vec4 I, vec4 N, float eta)
```
### Các tham số
```I``` specifies the incident vector.
```N``` specifies the normal vector.
```eta``` specifies the ratio of indices of refraction.
### Mô tả
For a given incident vector ```I```, surface normal ```N``` and ratio of indices of refraction, ```eta```, refract returns the refraction vector, ```R```.
```R``` is calculated as:
```glsl
k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I));
if (k < 0.0)
R = genType(0.0); // or genDType(0.0)
else
R = eta * I - (eta * dot(N, I) + sqrt(k)) * N;
```
The input parameters ```I``` and ```N``` should be normalized in order to achieve the desired result.
### Tham khảo thêm
[dot()](/glossary/?lan=vi&search=dot), [reflect()](/glossary/?lan=vi&search=reflect)

@ -0,0 +1,9 @@
## Return
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## Sampler2D
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,9 @@
## SamplerCube
### Các phiên bản / Example
### Các tham số
### Mô tả
### Tham khảo thêm

@ -0,0 +1,21 @@
## Sign
Extract the sign of the parameter
### Các phiên bản
```glsl
float sign(float x)
vec2 sign(vec2 x)
vec3 sign(vec3 x)
vec4 sign(vec4 x)
```
### Các tham số
```x``` specify the value from which to extract the sign.
### Mô tả
```sign()``` returns -1.0 if x is less than 0.0, 0.0 if x is equal to 0.0, and +1.0 if x is greater than 0.0.
<div class="simpleFunction" data="y = sign(x); "></div>
### Tham khảo thêm
[abs](/glossary/?lan=vi&search=abs), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,21 @@
## Sin
Return the sine of the parameter
### Các phiên bản
```glsl
float sin(float angle)
vec2 sin(vec2 angle)
vec3 sin(vec3 angle)
vec4 sin(vec4 angle)
```
### Các tham số
```angle``` specify the quantity, in radians, of which to return the sine.
### Mô tả
```sin()``` returns the trigonometric sine of angle.
<div class="simpleFunction" data="y = sin(x); "></div>
### Tham khảo thêm
[acos](/glossary/?lan=vi&search=acos), [cos](/glossary/?lan=vi&search=cos), [asin](/glossary/?lan=vi&search=asin), [tan](/glossary/?lan=vi&search=tan), [atan](/glossary/?lan=vi&search=atan), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,38 @@
## Smoothstep
Perform Hermite interpolation between two values
### Các phiên bản
```glsl
float smoothstep(float edge0, float edge1, float x)
vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x)
vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x)
vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x)
vec2 smoothstep(float edge0, float edge1, vec2 x)
vec3 smoothstep(float edge0, float edge1, vec3 x)
vec4 smoothstep(float edge0, float edge1, vec4 x)
```
### Các tham số
```edge0``` specifies the value of the lower edge of the Hermite function.
```edge1``` specifies the value of the upper edge of the Hermite function.
```x``` specifies the source value for interpolation.
### Mô tả
```smoothstep()``` performs smooth Hermite interpolation between ```0``` and ```1``` when ```edge0 < x < edge1```. This is useful in cases where a threshold function with a smooth transition is desired. ```smoothstep()``` is equivalent to:
```glsl
genType t; /* Or genDType t; */
t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
return t * t * (3.0 - 2.0 * t);
```
Results are undefined ```if edge0 ≥ edge1```.
<div class="simpleFunction" data="y = smoothstep(0.0,1.0,x); "></div>
<div class="codeAndCanvas" data="../05/smoothstep.frag"></div>
### Tham khảo thêm
[mix](/glossary/?lan=vi&search=mix), [step](/glossary/?lan=vi&search=step), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,23 @@
## Sqrt
Return the square root of the parameter
### Các phiên bản
```glsl
float sqrt(float x)
vec2 sqrt(vec2 x)
vec3 sqrt(vec3 x)
vec4 sqrt(vec4 x)
```
### Các tham số
```x``` specify the value of which to take the square root.
### Mô tả
```sqrt()``` returns the square root of ```x```.
<div class="simpleFunction" data="y = sqrt(x); "></div>
<div class="codeAndCanvas" data="../07/circle-making.frag"></div>
### Tham khảo thêm
[inversesqrt](/glossary/?lan=vi&search=inversesqrt), [pow](/glossary/?lan=vi&search=pow), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,31 @@
## Step
Generate a step function by comparing two values
### Các phiên bản
```glsl
float step(float edge, float x)
vec2 step(vec2 edge, vec2 x)
vec3 step(vec3 edge, vec3 x)
vec4 step(vec4 edge, vec4 x)
vec2 step(float edge, vec2 x)
vec3 step(float edge, vec3 x)
vec4 step(float edge, vec4 x)
```
### Các tham số
```edge``` specifies the location of the edge of the step function.
```x``` specify the value to be used to generate the step function.
### Mô tả
```step()``` generates a step function by comparing ```x``` to ```edge```.
For element ```i``` of the return value, ```0.0``` is returned ```if x[i] < edge[i]```, and ```1.0``` is returned otherwise.
<div class="simpleFunction" data="y = step(0.5,x); "></div>
<div class="codeAndCanvas" data="../05/step.frag"></div>
### Tham khảo thêm
[mix](/glossary/?lan=vi&search=mix), [smoothstep](/glossary/?lan=vi&search=smoothstep), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,20 @@
## Struct
Structure variable type
### Ví dụ
```glsl
struct matStruct {
vec4 ambientColor;
vec4 diffuseColor;
vec4 specularColor;
float specularExponent;
} newMaterial;
newMaterial = matStruct(vec4(0.1, 0.1, 0.1, 1.0),
vec4(1.0, 0.0, 0.0, 1.0),
vec4(0.7, 0.7, 0.7, 1.0),
50.0);
```
### Mô tả
```struct``` declare a custom data structures based on standard types. A constructor for the structure with the same name is created automatically. The declaration of a variable (in this case "newMaterial") is optional.

@ -0,0 +1,21 @@
## Tan
Return the tangent of the parameter
### Các phiên bản
```glsl
float tan(float angle)
vec2 tan(vec2 angle)
vec3 tan(vec3 angle)
vec4 tan(vec4 angle)
```
### Các tham số
```angle``` specify the quantity, in radians, of which to return the tangent.
### Mô tả
```tan()``` returns the trigonometric tangent of angle.
<div class="simpleFunction" data="y = tan(x); "></div>
### Tham khảo thêm
[cos](/glossary/?lan=vi&search=cos), [acos](/glossary/?lan=vi&search=acos), [sin](/glossary/?lan=vi&search=sin), [asin](/glossary/?lan=vi&search=asin), [atan](/glossary/?lan=vi&search=atan), [Các hàm số cơ bản (Hàm hình dạng - Shape function)](/05/?lan=vi)

@ -0,0 +1,25 @@
## Texture2D
Retrieves texels from a texture
### Các phiên bản
```glsl
vec4 texture2D(sampler2D sampler, vec2 coord)
vec4 texture2D(sampler2D sampler, vec2 coord, float bias)
```
### Các tham số
```sampler``` specifies the sampler to which the texture from which texels will be retrieved is bound.
```coord``` specifies the texture coordinates at which texture will be sampled.
```bias``` specifies an optional bias to be applied during level-of-detail computation.
### Mô tả
The texture2D function returns a texel, i.e. the (color) value of the texture for the given coordinates. The function has one input parameter of the type sampler2D and one input parameter of the type ```vec2``` : sampler, the uniform the texture is bound to, and coord, the 2-dimensional coordinates of the texel to look up.
There is an optional third input parameter of the type float: bias. After calculating the appropriate level of detail for a texture with mipmaps the bias is added before the actual texture lookup operation is executed.
Side note: On iOS devices texture lookup functionality is only available in the fragment shader.
### Tham khảo thêm
[textureCube](/glossary/?lan=vi&search=textureCube)

@ -0,0 +1,25 @@
## Texture2D
Retrieves texels from a texture
### Các phiên bản
```glsl
vec4 textureCube(samplerCube sampler, vec3 coord)
vec4 textureCube(samplerCube sampler, vec3 coord, float bias)
```
### Các tham số
```sampler``` specifies the sampler to which the texture from which texels will be retrieved is bound.
```coord``` specifies the texture coordinates at which texture will be sampled.
```bias``` specifies an optional bias to be applied during level-of-detail computation.
### Mô tả
The textureCube function returns a texel, i.e. the (color) value of the texture for the given coordinates. The function has one input parameter of the type samplerCube and one input parameter of the type vec3 : sampler, the uniform the texture is bound to, and coord, the 3-dimensional coordinates of the texel to look up.
There is an optional third input parameter of the type float: bias. After calculating the appropriate level of detail for a texture with mipmaps the bias is added before the actual texture lookup operation is executed.
Side note: On iOS devices texture lookup functionality is only available in the fragment shader.
### Tham khảo thêm
[texture2D](/glossary/?lan=vi&search=texture2D)

@ -0,0 +1,15 @@
## Uniform
Uniform variable qualifier.
### Ví dụ
```glsl
uniform vec4 direction;
```
### Mô tả
```uniform``` variables contain read-only data shared from WebGL/OpenGL environment to a vertex or fragment shader.
The value is per primitive, so is useful for variables which remain constant along a primitive, frame or scene.
### Tham khảo thêm
[attribute](/glossary/?lan=vi&search=attribute), [const](/glossary/?lan=vi&search=const), [varying](/glossary/?lan=vi&search=varying), [Chương 03: Uniform](/03/?lan=vi)

@ -0,0 +1,15 @@
## Varying
Varying variable qualifier.
### Ví dụ
```glsl
varying vec3 position;
```
### Mô tả
```varying``` variables contain data shared from a vertex shader to a fragment shader.
The variable must be written in the vertex shader and the read-only value in the fragment shader is then interpolated from the vertices which make up the fragment.
### Tham khảo thêm
[attribute](/glossary/?lan=vi&search=attribute), [const](/glossary/?lan=vi&search=const), [uniform](/glossary/?lan=vi&search=uniform), [Chương 03: Uniform](/03/?lan=vi)

@ -0,0 +1,21 @@
## Vec2
2 dimensional floating point vector
### Các phiên bản
```glsl
vec2 aVec2 = vec2(1.0, 1.0);
vec2 bVec2 = vec2(1.0);
vec2 cVec2 = vec2(aVec3);
vec2 dVec2 = vec2(aVec3.x, aVec3.y);
```
### Mô tả
```vec2``` is a floating point vector with two components. It can be initialized by:
- Providing a scalar value for each component.
- Providing one scalar value. This value is used for all components.
- Providing a vector of higher dimension. The respective values are used to initialize the components.
### Tham khảo thêm
[bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [ivec2](/glossary/?lan=vi&search=ivec2), [ivec3](/glossary/?lan=vi&search=ivec3), [ivec4](/glossary/?lan=vi&search=ivec4), [vec2](/glossary/?lan=vi&search=vec2), [vec3](/glossary/?lan=vi&search=vec3), [vec4](/glossary/?lan=vi&search=vec4), [mat2](/glossary/?lan=vi&search=mat2), [mat3](/glossary/?lan=vi&search=mat3), [mat4](/glossary/?lan=vi&search=mat4)

@ -0,0 +1,25 @@
## Vec3
3 dimensional floating point vector
### Các phiên bản
```glsl
vec3 aVec3 = vec3(1.0, 1.0, 1.0);
vec3 bVec3 = vec3(1.0);
vec3 cVec3 = vec3(aVec4);
vec3 dVec3 = vec3(aVec4.x, aVec4.y, aVec4.z);
vec3 eVec3 = vec3(aVec2, aFloat);
vec3 fVec3 = vec3(aVec2.x, aVec2.y, aFloat);
```
### Mô tả
```vec3``` is a floating point vector with three components. It can be initialized by:
- Providing a scalar value for each component.
- Providing one scalar value. This value is used for all components.
- Providing a vector of higher dimension. The respective values are used to initialize the components.
- Providing a combination of vectors and/or scalars. The respective values are used to initialize the vector. The arguments of the constructor must have at least as many components as the vector that is initialized.
### Tham khảo thêm
[bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [ivec2](/glossary/?lan=vi&search=ivec2), [ivec3](/glossary/?lan=vi&search=ivec3), [ivec4](/glossary/?lan=vi&search=ivec4), [vec2](/glossary/?lan=vi&search=vec2), [vec3](/glossary/?lan=vi&search=vec3), [vec4](/glossary/?lan=vi&search=vec4), [mat2](/glossary/?lan=vi&search=mat2), [mat3](/glossary/?lan=vi&search=mat3), [mat4](/glossary/?lan=vi&search=mat4)

@ -0,0 +1,21 @@
## Vec4
4 dimensional floating point vector
### Các phiên bản
```glsl
vec4 aVec4 = vec4(1.0, 1.0, 1.0, 1.0);
vec4 bVec4 = vec4(1.0);
vec4 cVec4 = vec4(aVec2, aFloat, aVec3);
vec4 dVec4 = vec4(aBvec2.x, aBvec2.y, aFloat, aBvec3.x);
```
### Mô tả
```vec4``` is a floating point vector with four components. It can be initialized by:
- Providing a scalar value for each component.
- Providing one scalar value. This value is used for all components.
- Providing a combination of vectors and scalars. The respective values are used to initialize the components. The arguments of the constructor must have at least as many components as the vector that is initialized.
### Tham khảo thêm
[bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float), [bvec2](/glossary/?lan=vi&search=bvec2), [bvec3](/glossary/?lan=vi&search=bvec3), [bvec4](/glossary/?lan=vi&search=bvec4), [ivec2](/glossary/?lan=vi&search=ivec2), [ivec3](/glossary/?lan=vi&search=ivec3), [ivec4](/glossary/?lan=vi&search=ivec4), [vec2](/glossary/?lan=vi&search=vec2), [vec3](/glossary/?lan=vi&search=vec3), [vec4](/glossary/?lan=vi&search=vec4), [mat2](/glossary/?lan=vi&search=mat2), [mat3](/glossary/?lan=vi&search=mat3), [mat4](/glossary/?lan=vi&search=mat4)

@ -0,0 +1,14 @@
## Void
### Các phiên bản
```glsl
void main(void);
int aFunction(void);
void bFunction(float);
```
### Mô tả
```void``` is used when a function has no parameters or when a function does not return a value.
### Tham khảo thêm
[void](/glossary/?lan=vi&search=void), [bool](/glossary/?lan=vi&search=bool), [int](/glossary/?lan=vi&search=int), [float](/glossary/?lan=vi&search=float)
Loading…
Cancel
Save