Git Product home page Git Product logo

Comments (2)

matusnovak avatar matusnovak commented on May 25, 2024

hi @gitbf

I am not the author of the double buffer mechanism, that credit goes to here: https://github.com/eyelash/tutorials/blob/master/drm-gbm.c

But I understand your problem, I had the same issue when I was working on a similar project. I have two solutions:

  • Option A, render everything into an OpenGL framebuffer (or renderbuffer). You can still use double buffering for the final output, but your GUI will be rendered into separate framebuffer/renderbuffer. You will essentially have a single off-screen buffer. Even at full HD resolution, the extra framebuffer should only occupy 6.2MB of GPU memory. You can then have two choices to copy the framebuffer to the screen (to the backbuffer):
    • Via glBlitFramebuffer, but that's only available if you replace EGL_OPENGL_ES2_BIT with EGL_OPENGL_ES3_BIT (glBlitFramebuffer is only available in OpenGL ES 3), but I have not tested it personally.
    • Via a shader program. Simply load the framebuffer attachment (the RGB texture) into a shader program, and render it onto a full-screen quad polygon. I can walk you through it.
  • Option B, don't use double buffering at all. You can force single buffering by adding EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER, to the configAttribs on line 142 in triangle_rpi4.c and not using gbmSwapBuffers at all. But I can not guarantee it will work. I was only able to get this (single buffer mode) working on Raspberry Pi 3.

I recommend the framebuffer option.

edit: Should have been: "replace EGL_OPENGL_ES2_BIT with EGL_OPENGL_ES3_BIT", not the other way around.

from rpi-opengl-without-x.

gitbf avatar gitbf commented on May 25, 2024

Thanks, I'll give it a try.

from rpi-opengl-without-x.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.