Hacking Doom code for transparent POV display

Doom (the original version), is not only one of the best game ever made, but it’s also a great example of C code. Thanks to id Software decision to release the code as open source in 1999, anybody can have a look and modify it. I had this project of changing the rendering of doom, to add a border effect to the walls, or cel shading. You can check the video at the end of this post to see why I wanted to do this to start with....

2016 September 2

Unit Tests in C with the constructor attribute

In one of my project, I used GNU constructor attribute to add some simple unit tests to any C file. I liked this approach, but I don’t see many open source projects using anything similar, so I though I’ll describe it here. Here is an example of a C file containing a function: ... // Test if a string ends with an other string. // If any of the string if NULL, return false....

2016 September 2

Keeping notes in unformatted text files

For years I have been looking for the best way to keep organized notes on my computer(s). I tried a lot of different approaches, from web based tools to emacs org mode and desktop wiki. Now I think I can say that I found the best way (for my personal case) to do it: I keep all my notes as unformatted text files, in a single flat directory. Here is how it works: I have a directory Notes in my computer home folder....

2016 July 25

Goxel 0.3 Released

I just released the version 0.3.0 of my open source voxel editor Goxel. This release brings: Import/Export support for the popular editor Magica Voxel. Render shadows. Better shapes support, specially when we use marching cube rendering. Multiple palettes. Better UI, with new tools icons. Here is a video of the laser tool:

2016 July 9

OpenCV Camera to OpenGL Projection

I am sure some people are hitting their heads trying to solve this simple problem when doing augmented reality with OpenCV and OpenGL: How to get the proper OpenGL projection matrix from the OpenCV camera calibration values? For the simple common case where the OpenCV camera matrix has the form: |fx 0 cx| |0 fy cy| |0 0 1| The corresponding OpenGL projection matrix can be computed like this:...

2016 March 23

Goxel 3D procedural rendering

In this post I introduce a new experimental feature I am adding to goxel: procedural voxel generation. For this I created a mini language specifically designed to describe drawing operations. Think of it as the logo language, but in 3D. Note: this is still experimental at this point, so anything in the language could change in the future. I will try to keep this page up to date as a reference documentation....

2016 March 10

Lambda expressions in C

C does not have built-in support for lambda expressions, but if you are using gcc, it is actually quite easy to implement them using a simple macro. This trick relies on two C extensions: nested functions and statement expressions. Both are available in gcc (but not in clang!) Here is a small program that could benefit from lambda expressions, written in conventional C: // A function taking a function pointer as argument....

2016 January 13

How I made my parallel self win the lottery

While I was in France recently I decided to make one of my parallel self a millionaire. It’s very easy and you too can do it if you want. How to do it? First you have to check how the national lottery of the country where you are works. In France, a lotto ticket costs 2 euro, you have to pick five different numbers from 1 to 49 (included), and one ’lucky’ number from 1 to 10 (included)....

2015 December 20

Goxel, an open source 3D voxel editor

Goxel is a new project I have been working on since last month. It’s an open source 3D editor to create voxel images (in the style of minecraft, or crossy road). It works on Linux and Windows. Features: 24 bits RGB colors. Unlimited scene size. Unlimited undo buffer. Layers. Smooth rendering mode. Export to obj and pyl.

2015 October 5

Voxel Snake 3D

I just released a small game on google play: Voxel Snake 3D. This is basically a snake game played on a 3D cube, using voxel rendering. Let me know what you think!

2015 July 28