1

次のフラグメントシェーダーがあります。

const lowp float colors[8] = float[8]( // line 12
    0,0,0,1,
    1,0,0,1
);

しかし、コンパイルに失敗します:

ERROR: 0:12: 'array of float' : array type not supported here in glsl < 120 
ERROR: 0:12: 'array of float' : constructor not supported for type 
ERROR: 0:15: 'array of float' : no matching overloaded function found 
ERROR: 0:12: 'const lowp float' : cannot declare arrays of this type 
ERROR: 0:12: 'colors' : redefinition 

GLSL でルックアップ テーブルを定義するにはどうすればよいですか? 入力テクスチャには列挙型の値があり、その各値を異なる色にマップしたいと考えています。

4

2 に答える 2

2

1D テクスチャをルックアップ テーブルとして使用できます。

于 2010-06-23T15:27:31.987 に答える
1

仕様のセクション 4.1.9を読んでください。

「宣言時にシェーダー内から配列を初期化するメカニズムはありません。」

于 2010-06-23T15:15:58.940 に答える