Hi everyone! Yet, another cool OpenGL demo... I try to create a rainbow with the strips of sphere. Thanks to
@STxAxTIC for helping in sphere rendering..
Enjoy the program. ;)
'By Ashish
'26 Feb, 2020
'Thanks to STxAxTIC for helping in sphere rendering
allowGL = 1
r = 1
glInit = 1
c=c+0.01
s = 0.07
a = 0
a~&
= hsb
(map
(theta
,0,_pi,0,255),255,128,255)
a=a+1
FUNCTION map!
(value!
, minRange!
, maxRange!
, newMinRange!
, newMaxRange!
) map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
'method adapted form http://stackoverflow.com/questions/4106363/converting-rgb-to-hsb-colors
H = map(__H, 0, 255, 0, 360)
S = map(__S, 0, 255, 0, 1)
B = map(__B, 0, 255, 0, 1)
hsb~&
= _RGBA32(B
* 255, B
* 255, B
* 255, A
)
fmx = B - (B * S) + S
fmn = B + (B * S) - S
fmx = B + (B * S)
fmn = B - (B * S)
H = H - 360
H = H / 60
H
= H
- (2 * INT(((iSextant
+ 1) MOD 6) / 2))
fmd = (H * (fmx - fmn)) + fmn
fmd = fmn - (H * (fmx - fmn))