Question

I am trying to modify the hello_triangle example (/opt/vc/src/hello_pi/hello_triangle) on my Raspberry Pi to output to fb1 instead of fb0.

I have searched everything I can think of with no answers (it could be I don't know what to search for).

It seems like the line I need to modify is this line:

state->display = eglGetDisplay(EGL_DEFAULT_DISPLAY);

The docs state the parameter is of type NativeDisplayType and "Specifies the display to connect to. EGL_DEFAULT_DISPLAY indicates the default display." However, it does not give any information on how to list/find available displays.

EGL_DEFAULT_DISPLAY is defined as (NativeDisplayType)0 so I guessed that 0 referred to fb0, but using (NativeDisplayType)1 for fb1 caused eglGetDisplay to return EGL_NO_DISPLAY.

The original example outputs to fb0 as it should, no problems there.
I also know my display is working correctly as I can use fbi to display images on fb1 just fine.

Was it helpful?

Solution

Quick Answer: You can't.

For details see my post on the Raspberry Pi forums.

EGL on the RPi doesn't use the linux framebuffers at all, not fb1 nor fb0. The graphics hardware works at a higher level (dispmanx), the display is made up of multiple layers, when linux starts it creates one layer to cover the full screen for fb0. When you create a window with EGL you also create a new layer and tell the hardware to show it in front of the others.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top