Rendering to /dev/fb0 on Linux

Hi guys,

What I would like is - render the contents to linux framebuffer located at /dev/fb0. Do you have any clues on this?

I have explored many forums, and also the code in the official MESA repo (/src/egl/opengles1/eglfbdev.c), but so far, I am out of luck.

Is there something I am missing? The problem I am getting is - I constantly receive EGL_NO_DISPLAY. The code looks as follows (simplified for better understanding):

const char fbdev[] = “/dev/fb0”;
int fd = open(fbdev, O_RDWR);
const EGLNativeWindowType native_win = (EGLNativeWindowType) NULL;

/* make Mesa/EGL happy */
setenv(“EGL_PLATFORM”, “fbdev”, 0);

egl_dpy = eglGetDisplay((EGLNativeDisplayType)(uintptr_t)fd);
if (egl_dpy == EGL_NO_DISPLAY)
egl_fatal(“failed to get a display”);

So, my code always fails on the last IF check.

Any clue?