GLBasic forum

Codesnippets => 2D-snippets => Topic started by: Kitty Hello on 2013-Mar-23

Title: Drawing rainbow colour cycles
Post by: Kitty Hello on 2013-Mar-23
Code (glbasic) Select

DIM pix%[256]
FOR i=0 TO 255
LOCAL r,g,b
r = 0.5 + SIN( i    /255 * 360.)/2.0
g = 0.5 + SIN((i+85)/255 * 360.)/2.0
b = 0.5 + SIN((i+170)/255 * 360.)/2.0
pix[i] = RGB(r*255, g*255, b*255) + 0xff000000
NEXT
MEM2SPRITE(pix%[], 1, 256,1)
STRETCHSPRITE 1, 0,150, 256,32


Totally non-optimized code. But you can use the texture later, which is OK.
I use it to track the colour bugs in the RaspberryPi setup...
Title: Re: Drawing rainbow colour cycles
Post by: mentalthink on 2013-Mar-23
This it's usefully for some drawing or modify image tool... THX
Title: Re: Drawing rainbow colour cycles
Post by: Ian Price on 2013-Mar-23
That's a really nice effect. Cheers Gernot  :)