Was always using 32bit depth, disregarding the actual depth of the FBConfig. This was causing a X error on Mesa sofware renderers.