eendeego / node-openvg-canvas

Canvas implementation on top of node-openvg
179 stars 25 forks source link

Framebuffer support? #15

Open bluecamel opened 10 years ago

bluecamel commented 10 years ago

I'm trying to use this with a touch screen TFT (from Adafruit: https://www.adafruit.com/products/1601), which uses framebuffer.

I've got everything installed following the README, but running the examples does nothing. Well, it does print out:

Loading typeface file: /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
Press return to exit.

But nothing is displayed on the screen. Any advice for getting that to work?

Thanks!

eendeego commented 10 years ago

This module relies on the Raspberry Pi's OpenVG implementation, which, in turn only works with the native hardware accelerated frame buffer.

In order to get this library to work with that frame buffer, I think you need to render off screen (actually, you'll be rendering to the HDMI/composite screen) and then copy the rendered image bits to the other (software) framebuffer. You'll have to implement this in C to be fast enough.

I also have a screen similar to that one, and these were my actual plans to put it to work. Can you post some results (images) if you get that to work ?

bluecamel commented 10 years ago

I'd love to help, but unfortunately, that's quite beyond my knowledge :/

piranna commented 9 years ago

Could this work in a generic framebuffer device like VESA one? I'm thinking to use this for drawing on a Linux terminal on NodeOS.

itzaks commented 9 years ago

This would be great, @luismreis if you could give me some more instructions on how to start working on this I might give it a shot. Or are there any further updates on this area?

itzaks commented 9 years ago

Could this be used for this purpose? https://github.com/AndrewFromMelbourne/raspi2fb

EDIT: Found this library that solves it for me https://github.com/vesteraas/node-pitft

piranna commented 9 years ago

I've managed with others to make node-canvas to use FbDev, and although unacelerated it works. There are plans to add support for EGL, too.

eendeego commented 9 years ago

I've implemented that with this project: https://github.com/luismreis/node-fbcp.

Basically, you extend node-openvg-canvas'es swapBuffers to call copyBuffers:

var Canvas = require('openvg-canvas');
var fbcp = require('fbcp');
//...
var originalSwapBuffers = Canvas.vgSwapBuffers;
Canvas.vgSwapBuffers = function fbcpSwapBuffers() {
  originalSwapBuffers();
  fbcp.copyBuffers();
};

It's super fast, transparent, and gets used by the supplied requestAnimationFrame.