SIGN(3G)
π SIGN(3G) β like, the sign-extraction girlies' moment β¨
okay bestie, welcome to the sign page, section 3G of the manual (yes the manual name is literally [FIXME: manual], we love a placeholder icon π). This is the GLSL function that tells you which way a number is leaning. Let's get into it π
πΈ NAME πΈ
sign β pull the sign out of the parameter, fr fr
β¨ DECLARATION β¨
here's the whole lineup, copy-paste ready, no cap:
genType sign(genType x);
genIType sign(genIType x);
genDType sign(genDType x);
three overloads, three vibes, one function name. iconic.
π«Ά PARAMETERS π«Ά
xβ the value you're extracting the sign from. that's it, that's the whole job. give her a number, she tells you which way it points π«
π DESCRIPTION π
so here's the tea, and it's genuinely simple:
sign returns -1.0 if x is less than 0.0, 0.0 if x is equal to 0.0, and +1.0 if x is greater than 0.0.
negative, zero, positive. three moods. she's not complicated and honestly? we respect that. periodt. π
π VERSION SUPPORT π
okay so this is the "when did GLSL start supporting me" part. The function name is on the left, and the OpenGL Shading Language Versions run across: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50. A β means it's there, a - means she has NOT arrived yet, do not @ her π
β sign (genType)
1.10β-1.20β-1.30β β1.40β β1.50β β3.30β β4.00β β4.10β β4.20β β4.30β β4.40β β4.50β β
β sign (genIType)
1.10β-1.20β-1.30β-1.40β-1.50β β3.30β β4.00β β4.10β β4.20β β4.30β β4.40β β4.50β β
β sign (genDType)
1.10β-1.20β-1.30β-1.40β-1.50β-3.30β-4.00β β4.10β β4.20β β4.30β β4.40β β4.50β β
so genType showed up first in 1.30 like an early adopter π¦, genIType rolled in at 1.50 π§, and genDType was fashionably late to the party at 4.00 π
(double precision girlies, you know how it is).
π SEE ALSO π
abs()
(yes, her bestie. go read that one next, they're a package deal π«Ά)
π COPYRIGHT π
Copyright Β© 2011-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.
Copyright Β© 2011-2014 Khronos Group
ngl the legal girlies did their thing twice here β that's two whole COPYRIGHT sections, both present and accounted for, no details skipped, we keep it π―
and that's the page bestie!! source situation is [FIXME: source], the date on this one is 01/03/2018, and the whole thing signs off as SIGN(3G) β same as it opened. bye babe, go extract some signs responsibly πβ¨π
π¦ where this page comes from
- ubuntu jammy: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- ubuntu noble: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms