I want to get a GLFW window’s pixel format. I’m using ubuntu so win32 functions are out of the picture. I’ve stumbled upon this question but there are only win32 answers and there is an answer that uses HDC
and PIXELFORMATDESCRIPTOR
which I don’t have access to (Since I will not be using the function permanently I rather not install a new library for this.)
I want to get the format in the form of YUV420P
or RGB24
.
2
Answers
That is outside the scope of GLFW as can be read here:
Hint:
Don’t rely on (if you’ve created the window with the videomode of the specified monitor and didn’t tinkered with framebuffers):
because in glfwCreateWindow we read the following:
Conceptually the closest thing to a pixelformat in X11 is a so called Visual (X11 core) or FBConfig (through GLX extension).
First you need the native window handle. You can retrieve this from GLFW using
A window’s visual can be queried using
XGetWindowAttributes
The FBConfig can be queried using
glXQueryDrawable