Handmade Hero»Forums»Code
17 posts
Hi, I'm bewwys I'm a student at the 42 codingschool . I'm glad to be here. I'm a noob so please take care of me :)
XWindow System Game Rendering System
Edited by bewwys on
Hello everyone,
I'm currently learning X11 protocol and the xlib implementation of it and I love the concept of server/client app. If I'm understand correctly, with the X11 protocol I can actually create a crazy game rendering system which run in a remote client app and then displaying the actual content of the rendered game in a window frame managed by the server ? If I'm right it means I can run the witcher in a simple laptop (figure of speech).

But I have one more question. I was wondering if all the server did is to dispatch the actual rendered buffer to the video driver so it can be show up on the screen ?

Thank you everyone :)
Mārtiņš Možeiko
2559 posts / 2 projects
XWindow System Game Rendering System
It's actually not so simple in context of games.

If you want to use hardware accelerated API such as OpenGL, then you don't want to use client/server model for rendering. This is known as indirect rendering and typically is much slower than alternative. What you typically want is direct rendering. This means that client is sending GL calls directly to driver bypass server. In this case server does not see what is being rendered at all.

Modern display servers, such as wayland, actually does not do any rendering (accelerated or not) - they require client to do all the rendering work and then only flips framebuffer for displaying it.
17 posts
Hi, I'm bewwys I'm a student at the 42 codingschool . I'm glad to be here. I'm a noob so please take care of me :)
XWindow System Game Rendering System
Hmmm my first thought was that I can do all the rendering in a remote client (some crazy machine) and then send over the network the actual rendered buffer to the server (which is my laptop) in the purpose of displaying the buffer.

But how can I bypass the server so the remote client can sends directly the rendered buffer to the driver (in my machine)?



I see that cairo may take care of that but I'm not sure.

Thank you
Mārtiņš Možeiko
2559 posts / 2 projects
XWindow System Game Rendering System
Edited by Mārtiņš Možeiko on
Why would you want that? X11 was designed for use case when client is the one that has "weaker" resources. And server is one with all the power (mainframe).

What you want is opposite - remote machine is server. Which can run and render everything with its GPU. Your laptop is client that sends its inputs to server and you get back the image/video. Pretty much VNC or RDP protocol.
17 posts
Hi, I'm bewwys I'm a student at the 42 codingschool . I'm glad to be here. I'm a noob so please take care of me :)
XWindow System Game Rendering System
Edited by bewwys on
Hmm, I was misleading by an example in the book call "The x window system" where the author talks about a program that can execute on a school's main computer that can display information on inexpensive personal computer. In extend of that example I was thinking that the client could do all the rendering and then just displaying it on a server display machine.

Obviously I'd like to that as an experimentation nothing else.