glsl vector plus scalar

前端 未结 1 939
执念已碎
执念已碎 2020-12-11 22:04

I searched a lot but could not find if the following statements are legal in a #version 330 vertex shader:

#define note_the_following_whitespace         


        
相关标签:
1条回答
  • 2020-12-11 22:16

    http://www.opengl.org/registry/doc/GLSLangSpec.3.30.6.pdf

    From 5.9

    The arithmetic binary operators add (+), subtract (-), multiply (*), and divide (/) operate on integer and floating-point scalars, vectors, and matrices.

    (...)

    One operand is a scalar, and the other is a vector or matrix. In this case, the scalar operation is applied independently to each component of the vector or matrix, resulting in the same size vector or matrix.

    So if it doesn't compile on ATI, it just means its driver is incorrect in that regard.

    0 讨论(0)
提交回复
热议问题