Author Topic: Drawing rainbow colour cycles  (Read 1479 times)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10656
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Drawing rainbow colour cycles
« 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...

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3335
  • Integrated Brain
    • View Profile
Re: Drawing rainbow colour cycles
« Reply #1 on: 2013-Mar-23 »
This it's usefully for some drawing or modify image tool... THX

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4122
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: Drawing rainbow colour cycles
« Reply #2 on: 2013-Mar-23 »
That's a really nice effect. Cheers Gernot  :)
I came. I saw. I played.