LoginSignup
2
0

More than 5 years have passed since last update.

GLSL ES 3.0で型変換はどうやればいいのか?

Posted at

む、ところで、GLSLにはキャスト(型変換)に相当する演算子が見当たらない。uintをfloatに変えるにはどうしたらいいのか。。

リファレンス・ガイドを見ると、floatBitsToUint,uintBitsToFloatというのがある。しかしこれはビット配列を同じなまま、型変換をするというものである。

むむう。どうしたらよいのか。。と思ったら簡単だった。。コンストラクタを使えばよいのだった。。

float floatval = 1.0;

uint a = uint(floatval);//コンストラクタで型変換

これで小一時間悩んでしまった。。

以上

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0