fill() RGB problem

41 views
Skip to first unread message

João Mesquita

unread,
Nov 20, 2013, 5:23:20 AM11/20/13
to nodebox-f...@googlegroups.com
Hi,

I'm having trouble using some RGB values with the fill function. This is the code I'm using:

from nodebox.graphics import *

def draw(canvas):
    
    #black
    fill(0,0,0)
    ellipse(50,50,50,50)

    #blue
    fill(0,0,255)
    ellipse(100,50,50,50)
    
    #yellow
    fill(255,255,0)
    ellipse(150,50,50,50)
    
    #red
    fill(255,0,0)
    ellipse(200,50,50,50)
    
    #green
    fill(0,255,0)
    ellipse(250,50,50,50)
    
    #purple -> renders white
    fill(148,55,255)
    ellipse(50,100,50,50)
    
    #orange -> renders yellow
    fill(255,147,0)
    ellipse(100,100,50,50)
    
    #pink -> renders white
    fill(148,55,255,1)
    ellipse(150,100,50,50)

canvas.fps = 30
canvas.size = 320,240
canvas.run(draw)

The last 3 fills render different colours than the one set by RGB. Do I have set the colorspace explicitly?

I'm running it on Mavericks (OSX 10.9)

Thanks.

Art Simon

unread,
Nov 20, 2013, 4:01:37 PM11/20/13
to nodebox-f...@googlegroups.com
I get confused by this myself. In nodebox, RGB values are decimals between 0 and 1. Unlike processing which uses ints in the range 0 - 255.


--
You received this message because you are subscribed to the Google Groups "NodeBox for OpenGL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodebox-for-ope...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Art Simon
sim...@gmail.com

Frederik De Bleser

unread,
Nov 21, 2013, 3:43:53 AM11/21/13
to nodebox-f...@googlegroups.com
If you prefer your colors from 0-255, you can set the color range using the base parameter:

    fill(148, 55, 255, base=255)

See http://www.cityinabottle.org/nodebox/#color for more info.

Best,

Frederik
Reply all
Reply to author
Forward
0 new messages