Drawing pixel to window
|
Author |
Message |
chrimo
Member
  
Posts: 94
Group: Registered
Joined: May 2007
Status:
Offline
Reputation: 0
|
Drawing pixel to window
Hello,
what is the easiest way to set pixel inside a window ?
I'd like to open a window and set pixels:
version="0.0001a"
window = fltk:Fl_Double_Window(100,64,"displaycc");
window:tooltip("pbLua displaycc by Chrimo and friends "..version);
window:color(55);
window:align(fltk.FL_ALIGN_CENTER);
window:position(10,10);
-- fltk.fl_draw("???",x,y)
function quit_callback(object)
if fltk.fl_ask("Are you sure to quit now ?") >= 1 then
window:hide()
end
end
window:callback(quit_callback)
window:show();
Fl:run();
Nothing happens... ;-(
Is fl_draw the right function to set pixels ??? I'd like to draw something like trigonometric functions or some kind of mathematic function plotter...
I'm using murgaLua 0.5.5 at OSX (PPC)
Thanks for some hints or ideas to make it better
Bye
Christian
This post was last modified: 08-12-2007 06:44 AM by chrimo.
|
|
08-12-2007 06:43 AM |
|
 |
iGame3D
Moderator
  
Posts: 231
Group: Moderators
Joined: Apr 2007
Status:
Offline
Reputation: 0
|
RE: Drawing pixel to window
This post was last modified: 08-12-2007 08:58 AM by iGame3D.
|
|
08-12-2007 08:38 AM |
|
 |
chrimo
Member
  
Posts: 94
Group: Registered
Joined: May 2007
Status:
Offline
Reputation: 0
|
RE: Drawing pixel to window
Hi iGame3D,
I'm so sorry :-(
Sometimes I mix pbLua and murgaLua, cannot find the tree in the forrest,
smoking inexpensive shit, setting white pixels on white screen....
Thanks for wake me up
Bye
Christian
|
|
08-12-2007 09:13 AM |
|
 |
chrimo
Member
  
Posts: 94
Group: Registered
Joined: May 2007
Status:
Offline
Reputation: 0
|
RE: Drawing pixel to window
Hi,
yes I'm smoking again...
but where are the pixels ?
version="0.001";
w = fltk:Fl_Double_Window(500,500,"Pixeltest mLua 0.5.5 OSX PPC");
w:tooltip("Pixeltest "..version);
w:color(55);
w:align(fltk.FL_ALIGN_CENTER);
w:position(10,10);
b=fltk:Fl_Button(200,450,100,40,"Show")
b:color(31);
function show()
for x=0,500 do
y=x;
print("X:"..x.." Y:"..y);
fltk.fl_color(79);
fltk.fl_point(x,y);
fltk.fl_rectf(x,y,10,10);
end
end
function show_callback(object)
show();
w:show();
end
function quit_callback(object)
if fltk.fl_ask("Are you sure to quit now ?") >= 1 then
window:hide()
end
end
b:callback(show_callback)
w:callback(quit_callback)
w:show();
Fl:run();
Thanks for any idea
Bye
Christian
|
|
08-12-2007 10:38 AM |
|
 |
iGame3D
Moderator
  
Posts: 231
Group: Moderators
Joined: Apr 2007
Status:
Offline
Reputation: 0
|
RE: Drawing pixel to window
Took me a minute or two, but the trick is in here
function show_callback(object)
w:make_current() -- says 'whats this?' in my demo--but it is THE MAGIC!
show();
--w:show(); -- not sure if this is needed commenting it doesn't hurt anything
end
Kindly pass the hookah'pon'the left hand side.
|
|
08-12-2007 10:52 AM |
|
 |
chrimo
Member
  
Posts: 94
Group: Registered
Joined: May 2007
Status:
Offline
Reputation: 0
|
RE: Drawing pixel to window
iGame3D,
I had a similar effect with subwindows at OSX and murgaLua 0.4 ;-(
Win32 XP works, OSX not!

Christian
Took me a minute or two, but the trick is in here
function show_callback(object)
w:make_current() -- says 'whats this?' in my demo--but it is THE MAGIC!
show();
--w:show(); -- not sure if this is needed commenting it doesn't hurt anything
end
Kindly pass the hookah'pon'the left hand side.
|
|
08-12-2007 11:00 AM |
|
 |
iGame3D
Moderator
  
Posts: 231
Group: Moderators
Joined: Apr 2007
Status:
Offline
Reputation: 0
|
RE: Drawing pixel to window
yep it was your thread where I got that w:make_current() function from.
Just didn't know what it does exactly, I assume point fltk to the correct window.
|
|
08-12-2007 01:16 PM |
|
 |
JohnMurga
Administrator
      
Posts: 381
Group: Administrators
Joined: Apr 2007
Status:
Offline
Reputation: 2
|
RE: Drawing pixel to window
iGame3D,
I had a similar effect with subwindows at OSX and murgaLua 0.4 ;-(
Win32 XP works, OSX not!
Known bug on Mac FLTK apparently, I think it's fixed in the latest snapshot (which will be used in the next murgaLua).
Cheers
JohnM
|
|
08-12-2007 10:15 PM |
|
 |
chrimo
Member
  
Posts: 94
Group: Registered
Joined: May 2007
Status:
Offline
Reputation: 0
|
RE: Drawing pixel to window
Hi,
does it mean, it is a general problem with fl_point(x,y) at any OS or just OSX ?
Bye
Christian
iGame3D,
I had a similar effect with subwindows at OSX and murgaLua 0.4 ;-(
Win32 XP works, OSX not!
Known bug on Mac FLTK apparently, I think it's fixed in the latest snapshot (which will be used in the next murgaLua).
Cheers
JohnM
|
|
08-13-2007 12:33 AM |
|
 |
chrimo
Member
  
Posts: 94
Group: Registered
Joined: May 2007
Status:
Offline
Reputation: 0
|
RE: Drawing pixel to window
Forget all I said before ;-(
This works fine at OSX Intel:
version="0.001";
w = fltk:Fl_Double_Window(500,500,"Display Pixel murgaLua 0.5.5 OSX PPC");
w:tooltip("Pixeltest "..version);
w:color(55);
w:align(fltk.FL_ALIGN_CENTER);
w:position(10,10);
b=fltk:Fl_Button(200,450,100,40,"Display")
b:color(31);
function show()
for x=0,500 do
y=x;
print("X:"..x.." Y:"..y);
fltk.fl_color(0);
fltk.fl_point(x,y);
--fltk.fl_rectf(x,y,10,10);
end
end
function show_callback(object)
w:make_current();
show();
end
function quit_callback(object)
if fltk.fl_ask("Are you sure to quit now ?") >= 1 then
window:hide()
end
end
b:callback(show_callback)
w:callback(quit_callback)
w:show();
Fl:run();
Cheers
Christian
|
|
08-13-2007 02:07 AM |
|
 |
|