node-openvg-canvas icon indicating copy to clipboard operation
node-openvg-canvas copied to clipboard

Framebuffer support?

Open bluecamel opened this issue 11 years ago • 7 comments
trafficstars

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!

bluecamel avatar Feb 20 '14 05:02 bluecamel

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 ?

eendeego avatar Feb 20 '14 11:02 eendeego

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

bluecamel avatar Feb 26 '14 02:02 bluecamel

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.

piranna avatar Feb 07 '15 11:02 piranna

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 avatar Jul 23 '15 01:07 itzaks

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

itzaks avatar Jul 23 '15 01:07 itzaks

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.

piranna avatar Jul 23 '15 06:07 piranna

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.

eendeego avatar Jul 23 '15 08:07 eendeego