My favorites | Sign in
Project Hosting will be READ-ONLY Thursday at 3:00pm UTC for up to 3 hours for network maintenance.
v4p
Project Home Issues Source
Project Information
Members

Introduction

V4P - Vectors For Pocket - is a minimalistic software-only dependency-free scanline-rendering based 2D graphics engine. Its purpose is to render a 2D image out of a set of layered polygons.

The basis of the algorithm is introduced by Wikipedia here: http://en.wikipedia.org/wiki/Scanline_rendering. This algorithm has been merged with Bresenham and quicksort algorithms, plus bit-based layers management and poor-man integer only mathematics routines picked here and there.

V4P is extra light. It consists in a ridiculously short piece of C code. See by yourself:

grep -c ';' *.c
lowmath.c:72
quickheap.c:66
quicktable.c:28
sortable.c:64
v4p.c:519

V4P targets very light platforms without any form of hardware acceleration: neither FGU nor FPU. RAM usage is negligible since neither Z-buffer nor "S-buffer" (as depicted here: http://www.gamedev.net/reference/articles/article668.asp) are involved. Plus V4P has no dependency with any other technology. It even brings its own integer only maths routines.

It means you could easily embed V4P in almost any software or hardware. Just provide it with a "span" drawing function. A memset()-like function should work well in most cases. For you information, V4P has been initially developed on an antique PDA.

Backends

V4P sources includes few backends: SDL, XLib, and palmOS 4 API (!)

Those are simple backends. One might imagine much more clever ones, with complex color structures, anti-aliasing and such.

Extra libs

V4P sources also includes several extra pieces of C code for your pleasure:

  1. a "game engine", that is an "iterate & render" loop with constant frame rate.
  2. a "pixel font renderer" to output scores and debug messages.
  3. a SWIG interface file to build an extension module for your prefered language, says Python.
  4. a working LUA-powered game engine waiting for you to write a nice game leveraging on V4P and LUA abilities.
  5. a minimalist serialization library to quickly define scene out of strings.
  6. a prototype of a SVG path parsing library. It allows to draw assets with an SVG editor and import them in your code.

Things to be done

Here are few things which could be done next.

new backends

  1. frame buffer backend
  2. directFB backend
  3. etc.

targets

  1. Nintendo DS (homebrew)
  2. Android

V4P based libraries and frameworks

  1. transform V4P+LUA experiment into a browser plugin.
  2. use V4P as a basis for a full animated GUI stack

new features

anti-aliasing

A new span-drawing function may handle it.

curves

We need facilities to convert curves into vectors.

import/export

A real SVG parser would be handy.

deeper z range, transparent polygons

Only 16 layers for now. A balanced binary tree of spans may remote this limitation and allow polygons combining (transparency and such).

accurate math routines

Byte-length values are really inaccurate!

dirty rectangles

A library on top of V4P may avoid unchanged scene area rendering.

Powered by Google Project Hosting