News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
feedback please
Author Message
jpjacobs
Member
***


Posts: 113
Group: Registered
Joined: Jul 2007
Status: Offline
Reputation: 0
Post: #1
RE: feedback please

Well, I've been investigating a bit on the red colorchannel thing, and it seems that fltk itself (tested in C++) has no problems with 255,0,0 , but murgaLua does... so it seems something has gone wrong :color() method. (it's not in the fl_rgb_color(r,g,b) function, I tested with :color(0xff000000)).
I'll try to find the culprit in the sources.

Edit: After looking around in the code, I guess the error would be in the lua_call2_Fl_Widget__color function near line 18584 in bind-fltk.cxx. My C++ foo is a bit low, so I can't actually spot the error. (I've got a hunch its something with the elaborate casting being done there...).

In the meantime, I've come up with a script which also demonstrates the problem:

Code:
-- proggie to gradually change a window of color between 3 colors listed below
colors = {{255,0,0},{0,255,0},{0,0,255}}
w=fltk:Fl_Double_Window(300,300,"ColorCube")
w:color(fltk.fl_rgb_color(unpack(colors[1])))

function mix(x,colors) -- in radians, 0 = c1, 2pi/3 = c2 4pi/3=c3
    local function sel(x,rot)
        local res= math.max(0,math.sin(x*3/2+rot))
        return res
    end
    local r,g,b,r1,r2
    r1=2*math.pi/3;r2=r1*2
    r=math.floor(colors[1][1]*sel(x,0)+colors[2][1]*sel(x,r1)+colors[3][1]*sel(x,r2))
    g=math.floor(colors[1][2]*sel(x,0)+colors[2][2]*sel(x,r1)+colors[3][2]*sel(x,r2))
    b=math.floor(colors[1][3]*sel(x,0)+colors[2][3]*sel(x,r1)+colors[3][3]*sel(x,r2))
    return fltk.fl_rgb_color(r,g,b)
end

function run_anim_cb()
    pos=math.fmod(pos+math.pi/100,2*math.pi)
    w:make_current()
    local cur_col = mix(pos,colors)
    w:color(cur_col)
    print(string.format("set color 0x%08x , got color 0x%08x .",cur_col,w:color()))
    w:redraw()
    Fl:wait()
    murgaLua.sleep(50)
end

w:callback(run_anim_cb);
w:show()

pos=0
while (Fl:event_key() ~= fltk.FL_Escape)  do
    Fl:check()
    w:do_callback()
end


This should give a nice colorchanging window, but it get's stuck when it starts printing out 2 different numbers.

PS: this problem is still present in the 0.7 snapshot.

greetings, JP

This post was last modified: 11-29-2010 10:31 PM by jpjacobs.

11-29-2010 10:08 PM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
feedback please - mikshaw - 06-29-2009, 11:51 AM
RE: feedback please - mikshaw - 06-30-2009, 01:13 AM
RE: feedback please - jpjacobs - 06-30-2009, 06:01 AM
RE: feedback please - mikshaw - 06-30-2009, 12:28 PM
RE: feedback please - jpjacobs - 07-01-2009, 04:21 AM
RE: feedback please - MrBill - 07-02-2009, 03:34 AM
RE: feedback please - mikshaw - 07-02-2009, 12:33 PM
RE: feedback please - jpjacobs - 11-29-2010 10:08 PM
RE: feedback please - mikshaw - 11-30-2010, 01:55 PM
RE: feedback please - JohnMurga - 12-06-2010, 07:05 AM
RE: feedback please - mikshaw - 12-06-2010, 08:08 AM
RE: feedback please - jpjacobs - 12-06-2010, 10:05 AM
RE: feedback please - mikshaw - 12-07-2010, 01:37 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: