Review request for "platform independent interactive graphics" with VNC
Hi, I've been working on a Haskell based platform independent graphics rendering using VNC. I'd like it very much if you could take a look at it and give me feedback. Using it is straight forward - git clone git@github.com:ckkashyap/Chitra.git cd Chitra make ./Main 100 100 5900 Main starts off a vncserver listening on port 5900. A standard vncviewer can be used to connect to 'localhost' and you can see a 100 x 100 screen. Clicking on the screen will set the pixel on the click location. What I eventually want to do is somehow integrate this piece with GHCI in such a manner that one can use GHCI to draw things on the VNC buffer. Regards, Kashyap
One thing to notice: $ cabal install network-server is needed. Best regards, Krzysztof Skrzętnicki On Thu, Feb 3, 2011 at 12:15, C K Kashyap <ckkashyap@gmail.com> wrote:
Hi, I've been working on a Haskell based platform independent graphics rendering using VNC. I'd like it very much if you could take a look at it and give me feedback. Using it is straight forward -
git clone git@github.com:ckkashyap/Chitra.git cd Chitra make ./Main 100 100 5900
Main starts off a vncserver listening on port 5900. A standard vncviewer can be used to connect to 'localhost' and you can see a 100 x 100 screen. Clicking on the screen will set the pixel on the click location.
What I eventually want to do is somehow integrate this piece with GHCI in such a manner that one can use GHCI to draw things on the VNC buffer.
Regards, Kashyap
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Hi Kashyap, What a fun project! I was able to build and run on Windows (GHC 6.12.3 and TightVNC 1.4.4) with a few minor changes: Remove from Chitra\Canvas.hs import Network.Server import Network.Socket I think these are artifacts from a previous version and are not used. For whatever reason getAddrInfo with the parameters given in RFB\Server.hs returns some IPv6 address on my system. Changing the second parameter from Nothing to (Just "127.0.0.1") made things work for me. Attached is the Cabal file I used to build (it wasn't clear what license things are under so those fields are commented out). Ryan Yates On Thu, Feb 3, 2011 at 6:15 AM, C K Kashyap <ckkashyap@gmail.com> wrote:
Hi, I've been working on a Haskell based platform independent graphics rendering using VNC. I'd like it very much if you could take a look at it and give me feedback. Using it is straight forward -
git clone git@github.com:ckkashyap/Chitra.git cd Chitra make ./Main 100 100 5900
Main starts off a vncserver listening on port 5900. A standard vncviewer can be used to connect to 'localhost' and you can see a 100 x 100 screen. Clicking on the screen will set the pixel on the click location.
What I eventually want to do is somehow integrate this piece with GHCI in such a manner that one can use GHCI to draw things on the VNC buffer.
Regards, Kashyap
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Attached is the Cabal file I used to build (it wasn't clear what license things are under so those fields are commented out).
Thanks a ton Rayan ... I am glad you liked it.
I've checked in the cabal file - I am not familiar with it though ... how exactly can I use it to build the project? Also, do you have an idea how it can be incorporated into GHCI - As in, the program should do a forkIO and in one thread, handle network and on the other prompt an interactive ghci shell that'll let one modify the screen buffer in an expressive way in haskell! Regards, Kashyap
Am 03.02.2011 12:15, schrieb C K Kashyap:
Hi, I've been working on a Haskell based platform independent graphics rendering using VNC. I'd like it very much if you could take a look at it and give me feedback. Using it is straight forward -
git clone git@github.com:ckkashyap/Chitra.git
This step failed for me with: maeder@leibniz:/local/maeder> git clone git@github.com:ckkashyap/Chitra.git Initialized empty Git repository in /local/maeder/Chitra/.git/ Permission denied (publickey). fatal: The remote end hung up unexpectedly maeder@leibniz:/local/maeder> git --version git version 1.7.1 What permission is needed? Christian
maeder@leibniz:/local/maeder> git clone git@github.com: ckkashyap/Chitra.git Initialized empty Git repository in /local/maeder/Chitra/.git/ Permission denied (publickey). fatal: The remote end hung up unexpectedly maeder@leibniz:/local/maeder> git --version git version 1.7.1
What permission is needed? Christian
Oops, you can use git://github.com/ckkashyap/Chitra.git - sorry about that. You can also visit https://github.com/ckkashyap/Chitra Regards, Kashyap
Am 03.02.2011 17:20, schrieb C K Kashyap:
Oops, you can use git://github.com/ckkashyap/Chitra.git <http://github.com/ckkashyap/Chitra.git> - sorry about that. You can also visit https://github.com/ckkashyap/Chitra
Thanks, I cannot get it to run with my vncviewer (TightVNC Viewer version 1.3.9) How should I call vncviewer and your Main binary? Cheers Christian P.S. after getArgs in Main.hs use case args of [x, y, p] -> ... _ -> putStrLn "usage: Main xres yres port" instead of "!!"
Thanks, I cannot get it to run with my vncviewer (TightVNC Viewer version 1.3.9)
How should I call vncviewer and your Main binary?
./Main 200 200 5900 after this, the program should start listening to port 5900 You can check if things are fine by telneting to localhost:5900, you should see this - ck@ck-desktop:~/lab/Chitra$ telnet localhost 5900 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. RFB 003.003 After this, you can use vncviewer to connect to localhost (5900 is the default port for vnc)
P.S. after getArgs in Main.hs use case args of [x, y, p] -> ... _ -> putStrLn "usage: Main xres yres port"
instead of "!!"
Thanks Christian ... I've incorporated this. Regards, Kashyap
Am 03.02.2011 18:05, schrieb C K Kashyap:
ck@ck-desktop:~/lab/Chitra$ telnet localhost 5900 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. RFB 003.003
After this, you can use vncviewer to connect to localhost (5900 is the default port for vnc)
Right, a window seems to pop up very shortly before it fails for me as shown below: Cheers Christian maeder@leibniz:~> vncviewer localhost Connected to RFB server, using protocol version 3.3 No authentication needed Desktop name "Haskell Framebuffer" VNC server default format: 32 bits per pixel. Most significant byte first in each pixel. True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0 Warning: Cannot convert string "-*-helvetica-bold-r-*-*-16-*-*-*-*-*-*-*" to type FontStruct Using default colormap which is TrueColor. Pixel format: 32 bits per pixel. Least significant byte first in each pixel. True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0 ShmCleanup called Using shared memory PutImage Same machine: preferring raw encoding Unknown message type 120 from VNC server ShmCleanup called
Maybe these messages are also important? Client Said :: "RFB 003.003" Sharing enabled SET PIXEL FORMAT called bpp = 32 depth = 24 big endian = 0 trueColor = 1 RED MAX = 255 GREEN MAX = 255 blueMax = 255 red shift = 16 green shift = 8 blue shift = 0 SetEncodings Command 14 0 FrameBufferUpdateRequest x=0, y=0 width =1, height=1 FrameBufferUpdateRequest x=1, y=0 width =99, height=1 FrameBufferUpdateRequest x=0, y=1 width =100, height=99 Main: <socket: 7>: hPutBuf: resource vanished (Connection reset by peer) Am 03.02.2011 18:43, schrieb Christian Maeder:
Am 03.02.2011 18:05, schrieb C K Kashyap:
ck@ck-desktop:~/lab/Chitra$ telnet localhost 5900 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. RFB 003.003
After this, you can use vncviewer to connect to localhost (5900 is the default port for vnc)
Right, a window seems to pop up very shortly before it fails for me as shown below:
Cheers Christian
maeder@leibniz:~> vncviewer localhost Connected to RFB server, using protocol version 3.3 No authentication needed Desktop name "Haskell Framebuffer" VNC server default format: 32 bits per pixel. Most significant byte first in each pixel. True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0 Warning: Cannot convert string "-*-helvetica-bold-r-*-*-16-*-*-*-*-*-*-*" to type FontStruct Using default colormap which is TrueColor. Pixel format: 32 bits per pixel. Least significant byte first in each pixel. True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0 ShmCleanup called Using shared memory PutImage Same machine: preferring raw encoding Unknown message type 120 from VNC server ShmCleanup called
FrameBufferUpdateRequest x=0, y=0 width =1, height=1 FrameBufferUpdateRequest x=1, y=0 width =99, height=1 FrameBufferUpdateRequest x=0, y=1 width =100, height=99 Main: <socket: 7>: hPutBuf: resource vanished (Connection reset by peer)
I was not taking care of partial updates, I've taken care of it now. Btw, what vncviewer are you using? Regards, Kashyap
Am 04.02.2011 07:27, schrieb C K Kashyap:
FrameBufferUpdateRequest x=0, y=0 width =1, height=1 FrameBufferUpdateRequest x=1, y=0 width =99, height=1 FrameBufferUpdateRequest x=0, y=1 width =100, height=99 Main: <socket: 7>: hPutBuf: resource vanished (Connection reset by peer)
I was not taking care of partial updates, I've taken care of it now. Btw, what vncviewer are you using?
After pulling in your changes and recompilation, your application runs as expected. Thanks a lot! Christian maeder@leibniz:~> uname -a Linux [...] 2.6.34.7-0.7-desktop #1 SMP PREEMPT [...] i686 i686 i386 GNU/Linux maeder@leibniz:~> vncviewer -h TightVNC Viewer version 1.3.9 Usage: vncviewer [<OPTIONS>] [<HOST>][:<DISPLAY#>] vncviewer [<OPTIONS>] [<HOST>][::<PORT#>] vncviewer [<OPTIONS>] -listen [<DISPLAY#>] vncviewer -help <OPTIONS> are standard Xt options, or: -via <GATEWAY> -shared (set by default) -noshared -viewonly -fullscreen -noraiseonbeep -passwd <PASSWD-FILENAME> (standard VNC authentication) -encodings <ENCODING-LIST> (e.g. "tight copyrect") -bgr233 -owncmap -truecolour -depth <DEPTH> -compresslevel <COMPRESS-VALUE> (0..9: 0-fast, 9-best) -quality <JPEG-QUALITY-VALUE> (0..9: 0-low, 9-high) -nojpeg -nocursorshape -x11cursor -autopass Option names may be abbreviated, e.g. -bgr instead of -bgr233. See the manual page for more information.
After pulling in your changes and recompilation, your application runs as expected. Thanks a lot!
I look forward to some feedback on this. Also, I am thinking in the lines of changing the image representation in a "list" to a mutable array - would that be the right approach? Regards, Kashyap
Hi, I've refined this further ... earlier, each framebuffer update involved sending the whole screen back, now, only the incremental changes are sent. Drawing on very large images are quick now!! Real fun will be when I can do rendering of graphics by typing things at the ghci prompt!!! https://github.com/ckkashyap/Chitra Feedback welcome!!! Regards, Kashyap
I think you want: git clone git://github.com/ckkashyap/Chitra.git On Thu, Feb 3, 2011 at 10:50 AM, Christian Maeder <Christian.Maeder@dfki.de>wrote:
Am 03.02.2011 12:15, schrieb C K Kashyap:
Hi, I've been working on a Haskell based platform independent graphics rendering using VNC. I'd like it very much if you could take a look at it and give me feedback. Using it is straight forward -
git clone git@github.com:ckkashyap/Chitra.git
This step failed for me with:
maeder@leibniz:/local/maeder> git clone git@github.com: ckkashyap/Chitra.git Initialized empty Git repository in /local/maeder/Chitra/.git/ Permission denied (publickey). fatal: The remote end hung up unexpectedly maeder@leibniz:/local/maeder> git --version git version 1.7.1
What permission is needed? Christian
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
C K Kashyap -
Christian Maeder -
Krzysztof Skrzętnicki -
Ryan Yates