Skip to main content
GameDev.net gamedev.net
🔒 Locked

How to direct a simple graphics application to a framebuffer of our choice

Started by sudipta Apr 8, 2015 at 9:42 AM 2 replies 3.5k views
Original Post
sudipta
sudipta

Hi,

I am a beginner and i was going through the legacy tutorials provided in http://nehe.gamedev.net/ .

I want to direct one of the simple application lets say Lesson 3 of Adding Color i.e.

http://nehe.gamedev.net/tutorial/lessons_01__05/22004/ to a framebuffer of my choice i.e. /dev/fb1.

1. Where in the code i have to modify so as to achieve this?

2. While running the application, how can i verify that it is using /dev/fb1 for display?

Any help in this regard is highly appreciable.

Thanks in Advance,

Sudipta

swiftcoder
swiftcoder

if you are ok with software rendering, it should be fairly straightforward to configure MESA to software-render OpenGL content into /dev/fbX. Please note that this is system configuration, not something you can code in your application.

If you want hardware-acceleration (i.e. to use the actual GPU), then you need one of a variety of experimental drivers which support "OpenGL without X". I don't believe any of these approaches are stable or supported at this time, but you can search around for the 'Wayland' project, or MESA's fbdev/DRI drivers.

A more relevant response, perhaps, is to ask why you want to do this? Apart from a few scenarios involving headless server setups, I'm struggling to come up with a need to render OpenGL directly into the linux framebuffer...

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]
sudipta
sudipta

Hi Swiftcoder,

Thanks for your reply. I am trying with graphics overlay on video streaming in which my video will appear on /dev/fb0(background) and the graphics will be overlayed on top of it i.e. /dev/fb1(foreground).But,i am stuck how to direct the graphics(application about which i asked above) to /dev/fb1.

Sudipta

sudipta
sudipta

I got it right.

There is a file named fsl_egl.c in which i could set the framebuffer to /dev/fb1 instead of default(as /dev/fb0).

In common/src/fsl_egl.c

#elif (defined EGL_API_FB)
eglNativeDisplayType = fbGetDisplayByIndex(0); //Pass the argument as required to show the framebuffer..
Change it to "1" to have it right on fb1.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.