3D Raster & Render with dynamic light in JavaScript vanilla [video][Spanish]

Last 12th of May had place the JSDayES conference in Madrid, Spain. I was there, giving a flash-talk about how to build a 3D Raster and Render engine with dynamich lights in JavaScript vanilla on canvas 2D. Here is the video 😀

Disclaimer: It’s in spanish

Auditorio – PRDeving from THESYS on Vimeo.

How to create Node.js modules in C++

As you should know, Node.js is a layer over V8, enterely written in C, Node.js gives you a simple API to V8 functions and lets you call them from Javascript with ease, but, what happen if you need more efficiency?
Well, as you are working with an abstraction layer, you, theorically can create a module in C with a public interface and grab it from that layer, in a way you could interact with the module itself, right?

Yes, you can, this is known as node bindings.

Continue reading “How to create Node.js modules in C++”

Javascript by reference: understanding javascript

When someone ask me to introduce him into the whole programming thing i always recommend to start with C, it’s not just because it’s the cleanest and straightest language to work with -it definitely is-, no, it’s because learning C will teach the developer how things really work and will turn on your “programmer” mind-set.

Understanding how C works makes you capable of understanding how other c-based languages (like JS, or python) works under the hood and hack or trick them with knowledge and ease.

Continue reading “Javascript by reference: understanding javascript”

High performance with canvas prerendering

Canvas API is slow by nature, don’t try to argue this, it is…
When using HTMLcanvas, we have to know how the whole thing works, first of all, the canvas 2D context itself is an Int8Array with length (side^2) * 4 and an API to modify this array, this API is an abstraction layer that allows you to easily draw shapes, paths, etc without leading with pixel modification or rasterizing.

Each time you tells this API to draw a rectangle, it calculates the new state of all the pixels involved, this could be easy, but if you draw a shape like an triangle or a irregular one, the API will triangulate it, calculate the pixels state and rasterize it, and trust me, this take’s a lot of time and hard working.

Continue reading “High performance with canvas prerendering”

Multi-Platform JavaScript Modules

A multi-platform module/library is a piece of code that works shameless in browser, server -usually nodeJS- and embedded systems.
Haven’t you noticed that JQuery works when you import the library from “script” tags in a website and when you “require” it in nodeJS? this is because JQuery controls the global scope and, depending on it, initialises the suit in different manners.

JQuery is the paradigm of multi-platform libraries, it runs in modern and old browsers, from phones to smartwatches, in Webkit, blink or Node, but, how do it do it?

Continue reading “Multi-Platform JavaScript Modules”

Design a site like this with WordPress.com
Get started