您的位置:首页 > 运维架构

OpenGL ES Shading Language : array

2012-11-16 20:06 260 查看
For matrix construction, the language is very flexible. These basic rules

describe how matrices can be constructed:

• If only one scalar argument is provided to a matrix constructor, that

value is placed in the diagonal of the matrix. For example mat4(1.0)

will create a 4 × 4 identity matrix.

• A matrix can be constructed out of multiple vector arguments, for

example a mat2 can be constructed from two vec2s.

• A matrix can be constructed out of multiple scalar arguments, one for

each value in the matrix, consumed from left to right.

There are two important things to note about the use of arrays in the

OpenGL ES Shading Language. The first is that many OpenGL ES implementations

will not allow an array to be indexed with a variable with an

unknown value at compile time. That is, OpenGL ES only mandates that

array indexing be supported by constant integral expressions (there is an

exception to this, which is the indexing of uniform variables in vertex shaders

that is discussed in Chapter 8).

The other note about arrays is that there is no syntax in the OpenGL ES

Shading Language to initialize an array at creation time. The elements of the

array need to be initialized one-by-one and also arrays cannot be const qualified

because there is no syntax for initializing such an array.

The comparison operators (==, !=, <, etc.) can only be performed on scalar

values.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: