A little bit better shader array construction example

This commit is contained in:
Yuri Roubinsky
2020-01-20 09:00:37 +03:00
parent 8d17784142
commit 3df0d90eef

View File

@@ -209,13 +209,13 @@ They can be initialized at the beginning like:
.. code-block:: glsl
float arr[3] = float[3] (1.0, 0.5, 0.0); // first constructor
float float_arr[3] = float[3] ( 1.0, 0.5, 0.0 ); // first constructor
float arr_v2[3] = float[] (1.0, 0.5, 0.0); // second constructor
int int_arr[3] = int[] ( 2, 1, 0 ); // second constructor
vec2 arr_v3[2] = { vec2(0.0, 0.0), vec2(1.0, 1.0) }; // third constructor
vec2 vec2_arr[3] = { vec2(1.0, 1.0), vec2(0.5, 0.5), vec2(0.0, 0.0) }; // third constructor
bool bvec_arr[] = { false, false, true, true }; // fourth constructor - size is defined automatically from the argument count
bool bool_arr[] = { true, true, false }; // fourth constructor - size is defined automatically from the element count
You can declare multiple arrays (even with different sizes) in one expression: