Skip to content

How to create a window on Linux? #661

Answered by domchen
Zetelias asked this question in Q&A
Discussion options

You must be logged in to vote

On Linux, we typically use offscreen rendering instead of opening a window, since there are many different window systems across distributions. As a result, the default implementation of tgfx::EGLWindow does not support opening a Linux window yet. However, you can implement this yourself. The key is to find a minimal example of opening a Linux window and setting up EGL for rendering. Then, wrap EGLDisplay, EGLSurface, and EGLContext with tgfx::EGLDevice::MakeFrom(). Here is a basic example for opening an X11 window with EGL. It may not be perfect, but it should give you a good starting point:

#include <X11/Xlib.h>
#include <EGL/egl.h>
#include "tgfx/gpu/opengl/egl/EGLDevice.h"

int main()…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Zetelias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants