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.
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.
相关文章推荐
- OpenGL ES2.0 Programming Guide - chapter 5:OpenGL ES Shading Language
- OpenGL ES Shading Language 2.0 参考笔记
- OpenGL ES Shading Language中应尽量避免使用循环
- OpenGL® Shading Language, Second Edition
- OpenGL 4.0 Shading Language Cookbook-中文版问世了
- OpenGL Shading Language
- ShaderGen v3.0 duplicates and extends OpenGL API fixed function behavior using OpenGL Shading Language and easy GUI
- GLSL(OpenGL Shading Language) NOTES
- OpenGL Shading language学习总结
- OpenGL Shading Language 汇总
- VRC 3D chat uses IRC, the OpenGL API and OpenGL Shading Language
- OpenGL 4.0 Shading Language Cookbook - 一本关于着色语言的新书
- OpenGL ES Wrapper on Windows Mobile
- An OpenGL ES renderer based on the GLSurfaceView rendering framework.
- OpenGL ES infomation
- OpenGL-ES 中的 mipmapping …
- 一个大牛的系列文章:An intro to modern OpenGL. Chapter 4: Rendering a Dynamic 3D Scene with Phong Shading
- Training—Building an OpenGL ES Environment
- OPENGL|ES第七天 Adding Detail with Textures
- call to OpenGL ES API with no current context 错误及解决方案