Friday, March 29, 2013

madparts 1.0: first public release

I'm proud to present the first public release of madparts, the fully free software functional programmable electronics footprint editor.

Find all the details and downloads on the homepage at

Friday, March 22, 2013

Baking sourdough bread, Joost style

I've been baking bread for quite a few years and have also been experimenting with sourdough for a similar time period.
As of lately I've come to a more standardized approach, and I thought it interesting to share it.


I keep a bit more then 100g of started in a closed glass bowl in the refrigerator. This is a started that I made myself from just a collection of flours, making it what is called a "wild" starter. Making starters is a whole topic in itself, so I won't go into it more in detail here. I might write a blog post about it in the future.


I use an old-school Kenwood mixer for kneading Of course you can also do it by hand, but it's sticky business ;)

First remove the bowl from the mixer and put the sourdough starter in it.

Put the bowl on a scale and reset the scale to 0.


Time to add flour. We're going to add 600g in total. For this bread I used 50g buckwheat, 100g rye and 450g organic whole wheat flour.

Flour added to bowl.

Next lets add a teaspoon of salt. You can go completely salt-less if you like but I prefer just a tad of salt to enhance the taste.

Next add about 20g of vegetable oil. I used olive oil here.

Time to add water. I use a bit more then 400g (== 400ml) water. The amount of water needed is somewhat dependent on the flours you use, but it's typically roughly 2/3 the weight of the flour. 

Water of about 28 degrees Celsius (82 Fahrenheit) is perfect but cold water also works just fine. For kicks I rinse the glass bowl with the water to already somewhat clean it and get some more starter in the water while at it.

As you can see I got a little more water then planned but that ok (600g flour + 470g water = 1.070 kg). It's actually a good idea to have a bit more when using buckwheat like I am here.





Now we want to store the dough for about half a day for a rise period. Cover it up with a cloth while rising and place it at a warm spot in the house. I put it near the heating system in our house.

After the rise period it is grown in volume.


Now it is time for a cool period. Store the sourdough (still covered with cloth) in the refrigerator for at least 12 hours. I usually just leave it overnight.

The next morning it'll be further grown in volume.

Mix again

Mix the dough a second time, mostly to remove all the air from it.

Store starter

Store a bit more then 100g of the dough in your glass bowl back in the refrigerator. This will be the starter for your next bread. If you want to store it for longer then 2 weeks, put it in a plastic bag in the freezer.

In mold

Put the dough in a mold. I use a silicone cake mold. It is a sturdy one with extra ribs on the side which I recommend. A metal mold also works but you may want to oil/grease it. Do NOT use Teflon coated metal molds. The sourdough is quite strong and it can actually peel of the Teflon coating, which is toxic!

Room temperature

This step can be skipped but gives a nicer risen bread. Cover the form with your cloth and let it stay like that for a few hours to reach room temperature.

After this period the dough has slightly risen again.


Put in a cold oven and set the oven to 60 degrees Celsius (140 Fahrenheit). I use top and bottom heating and no convection.

Let it at this temperature for 15 minutes.

Then switch to 100 degrees Celsius (212 Fahrenheit). Stay at that for another 15 minutes and then switch to 175 degrees Celsius (347 Fahrenheit).
Keep that final temperature for 30 more minutes, or a little more if you like your bread crusty.


Take the bread out of the oven, and let it cool down on a riser to allow airflow all around it.




A great tip for cleaning all the utensils covered with dough: do not use warm water, use cold water! Warm water makes dough more sticky. Cold water not so much.

Friday, March 1, 2013

using fragment shaders to draw shapes

Using openGL fragment shaders is an elegant way to draw shapes.
In this case it works by simply drawing a GL_QUAD (A simple unit square), but applying the shader on it to only selectively give certain coordinates in it color.

An openGL shader comes in two parts, a vertex shader and a fragment shader.

This is the vertex shader:

#version 120

// (c) 2013 Joost Yervante Damad
// License: GPL

// scale unit square to our rect size
// and move to it's origin

// input: (provided by calling program)
uniform vec2 size;  // size in x and y direction
uniform vec2 move;  // location

// output: (towards fragment shader)
varying vec2 pos2;    // adjusted position
varying vec2 size2;   // size in x and y direction

void main() {
  gl_FrontColor = gl_Color;
  vec4 vert = gl_Vertex;
  vert.x = vert.x * size.x;
  vert.y = vert.y * size.y;
  vec4 vert2 = vert;
  vert2.x += move.x;
  vert2.y += move.y;
  gl_Position = gl_ModelViewProjectionMatrix * vert2;
  pos2 = vec2(vert);
  size2 = size;

The role of the vertex shader is mainly to move to quad to the wanted coordinates and scale it to the size wanted. After that it is projected on our model.

And this is the fragment shader:

#version 120

// (c) 2013 Joost Yervante Damad
// License: GPL
// input provided by vertex shader
varying vec2 pos2;    // position
varying vec2 size2;   // size in x and y direction

void main() {
  // r: mininum size of straight side
  float q = sqrt(2.0)-1.0;
  float rx = size2.x * q;
  float ry = size2.y * q;
  float r = min(rx, ry);

  float shortest_size = min(size2.x, size2.y);
  float corner_size = (shortest_size - r) / 2;

  // a: minimum value where we want to cut off a corner
  float ax = (size2.x / 2) - corner_size;
  float ay = (size2.y / 2) - corner_size;

  // if we are in a corner zone:
  if (abs(pos2.x) > ax && abs(pos2.y) > ay) {
    // abs position within corner
    float x = abs(pos2.x) - ax;
    float y = abs(pos2.y) - ay;
    # are we inside the triangle ?
    if (x + y < corner_size) {
      gl_FragColor = gl_Color;
  // else we're in a normal square zone:
  } else {
    glFragColor = gl_Color;

The fragment shader is where it is decided for individual coordinates if they should be drawn or not.
The example here draws a nice rectangle with octagon style cut-off corners.