How graphics really works?

Caution: A very big block of text

Overview

The question of How graphics works? has plagued me ever since I wanted to figure out How graphics library works?. Some might give me the answer and I thank you but the problem I am going to describe will make you rethink because it has caused me a lot of pain.

The Entire Question

It should be pretty obvious that each GPU comes with firmware which is a sort of the Operating System of the GPU. The GPU and the CPU and ultimately the OS, communicate through a common piece of memory. My guess of how this communication plays out is:

  • Either the value for each pixel is written to the memory and the GPU displays it.
  • Or certain values are placed into the memory which each represents some kind of function in the GPU.
    These are all speculations from my part while the working principle could different entirely.
    We now have the OS. The OS, obviously, puts a device driver that does the task of writing to the memory and communicate with the GPU. That should abstract a lot of the underlying complexity. Let us assume that our OS is Ubuntu running the Gnome window manager. The OS itself doesn’t really need the graphics other than for a simple terminal but for users a GUI is indispensable.

I don’t know where the window manager is in the abstraction soil but I believe it communicates directly with the GPU device driver so it is pretty low-level. Now, say you wrote a game engine and are using the OpenGL library.

How does that library work?

The question may sound simple but the answer? I haven’t found it yet. Websites say that it is just a specification defined by the GPU manufacturer but that doesn’t answer anything.

You obviously need a window for your game engine so you call the functions from the OpenGL library to create that window BUT how is the window created? Does your game engine communicate with the Gnome Window manager or the driver? But based on the details from the website Your program directly communicates with the GPU. But other than the first possibility, other answers doesn’t make sense.

Breakdown of the answers: If the game engine communicated with the driver than how does the driver know what kind of window to create because the window that pops up does look the same as when you open Firefox or File Manager so it can’t be that the driver knows what kind of window does Gnome make. You also notice that your window is movable, re-sizable, tileable, which the primitive driver doesn’t know how to do. So it can’t be that your program communicates with the driver.

The last answer is also not possible as the OS wouldn’t allow it. Then the first answer is correct?

Contradiction

According to ChatGPT, the window manager uses the same OpenGL and Vulcan libraries. The way this works is that the window manager will define the functions that these libraries expect to exist and then use them afterwards but then what about your game engine? You didn’t define the functions so is the library you are using communicating with the window manager? Then there are two kinds of the same library?

See the problems?

How rendering of text is done?

Everyone has certainly changed the system fonts at some point but how does that work as well? Just look at a bootloader which uses the BIOS to print something. The bootloader gives a number, the ASCII value, to the BIOS interrupt handler but the text gets printed. That tells you that the BIOS must have told the GPU or whatever how to display that specific letter in that format pixel by pixel because the component that displays the text certainly doesn’t know how to print every kind of letter that exists. I would believe if you said just the ASCII representations but the Chinese, Japanese, Hindi? That’s not possible. Thus, the only probable answer is that you have to tell, whatever the component is, how to display what you want to display pixel by pixel.

That also means that the GPU needs to know how to display which is possible; Just pass a structure for each possible letter and the GPU should handle the rest.

What I learnt

Don’t ever ask LLM for doubts.

New contributor

Programmer Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật