Handmade Hero » Forums » Code » XWindow System Game Rendering System
bewwys
11 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 :)

#16092 XWindow System Game Rendering System
3 weeks, 4 days ago Edited by bewwys on Aug. 25, 2018, 4:19 p.m.

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 :)
mmozeiko
Mārtiņš Možeiko
1789 posts / 1 project
#16093 XWindow System Game Rendering System
3 weeks, 4 days ago

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.
bewwys
11 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 :)

#16094 XWindow System Game Rendering System
3 weeks, 4 days ago

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
mmozeiko
Mārtiņš Možeiko
1789 posts / 1 project
#16095 XWindow System Game Rendering System
3 weeks, 4 days ago Edited by Mārtiņš Možeiko on Aug. 25, 2018, 11:24 p.m.

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.
bewwys
11 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 :)

#16096 XWindow System Game Rendering System
3 weeks, 4 days ago Edited by bewwys on Aug. 25, 2018, 11:42 p.m.

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.