MIX(3G)
๐ NAME ๐
okay so bestie, welcome to mix โ she linearly interpolates between two values. that's it. that's the whole gig. โจ
she lives in section 3G of the manual, so if you ever need to cite her, it's MIX(3G). ๐
๐ธ DECLARATION ๐ธ
here's every single flavor she comes in, no skips, no cuts, all nine of them:
genType mix(genType x, genType y, genType a);
genType mix(genType x, genType y, float a);
genDType mix(genDType x, genDType y, genDType a);
genDType mix(genDType x, genDType y, double a);
genType mix(genType x, genType y, genBType a);
genDType mix(genDType x, genDType y, genBType a);
genIType mix(genIType x, genIType y, genBType a);
genUType mix(genUType x, genUType y, genBType a);
genBType mix(genBType x, genBType y, genBType a);
like yes she has range ๐
๐ซถ PARAMETERS ๐ซถ
xโ the start of the range you're interpolating inside. where the journey begins, lowkey.yโ the end of that range. the destination, the finale, the other end of the vibe. ๐aโ the value you use to interpolate betweenxandy. she's the weight, she's the deciding factor, she's giving main character energy ngl.
โจ DESCRIPTION โจ
so mix does a linear interpolation between x and y, using a to weight between them. the return value is computed as:
$x \times (1 - a) + y \times a$
periodt. that's the math, that's the formula, don't come for me. ๐งฎ๐
now here's the fun part โ the variants of mix where a is genBType select which vector each returned component comes from:
- if a component of
ais false, the corresponding component ofxis returned. - if a component of
ais true, the corresponding component ofyis returned.
and the tea โ: components of x and y that are not selected are allowed to be invalid floating-point values, and they will have no effect on the results. so like, they're just there, existing, unbothered, not influencing anything. iconic honestly. ๐โจ
๐ VERSION SUPPORT ๐
here's the whole glow-up timeline, every OpenGL Shading Language version, all spelled out (the original ships this as a table and i am NOT about to make you squint at box-drawing characters, so here it is as a list ๐):
mix(genType)โ slaying since 1.10. โ in1.10,1.20,1.30,1.40,1.50,3.30,4.00,4.10,4.20,4.30,4.40, and4.50. she was there from day one, no cap.mix(genDType)โ not invited until later.-in1.10,1.20,1.30,1.40,1.50,3.30, and4.00... wait, scratch that, she arrives at4.00โ โ in4.00,4.10,4.20,4.30,4.40, and4.50, and-in everything before4.00(1.10,1.20,1.30,1.40,1.50,3.30). ๐ฆmix(genIType),mix(genUType),mix(genBType)โ the late bloomers fr fr.-in1.10,1.20,1.30,1.40,1.50,3.30,4.00,4.10,4.20,4.30, and4.40. then โ in4.50only. they waited SO long and then showed up flawless. ๐
๐ SEE ALSO ๐
go say hi to her besties:
min()max()
๐ 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 (again, she said it twice, and honestly? respect) ๐
Copyright ยฉ 2011-2014 Khronos Group
and that's the whole page, bestie ๐ซถ this one came from [FIXME: source] and she's dated 01/03/2018, filed under MIX(3G) โ go forth and interpolate responsibly, mwah ๐โจ๐
๐ฆ 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