Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add links to resources about drawing on the screen #436

Open
nebrelbug opened this issue Jun 7, 2018 · 14 comments
Open

Add links to resources about drawing on the screen #436

nebrelbug opened this issue Jun 7, 2018 · 14 comments

Comments

@nebrelbug
Copy link

I'm following through the tutorials and have started modifying and adding my own features. One thing that I can't find at all on the web, though, is how to display graphics on the screen. Do you write to a specific memory location, or use an I/O port? Are there OpenGL libraries that work on baremetal or that we could make work? I'd love to see some links to good resources on that topic.

@nebrelbug
Copy link
Author

By drawing on the screen, I mean like individual pixels and shapes, not VGA.

@phil-opp
Copy link
Owner

phil-opp commented Jun 7, 2018

The VGA text buffer is relatively special by working on characters instead of pixels. A normal framebuffer operates on individual pixels and this mode is supported by VGA too.

Personally I only used the text buffer, so I can't give you good links. But the VGA Hardware page of the OSDev wiki looks useful to learn about the different VGA modes. Also, you could look at how the Redox project does it.

For the blog, I plan to eventually switch to using a framebuffer instead of text mode eventually, because the text mode is not supported for UEFI booting. See #349 (comment).

@nebrelbug
Copy link
Author

@phil-opp Thanks! Do operating systems like Apple, Windows, etc. use a VGA framebuffer or do they do something different?

@IsaacWoods
Copy link
Contributor

@nebrelbug real OSs tend to have specialised support for the graphics chipset or discrete graphics card, but it’s difficult and a huge time investment to develop drivers for them

@nebrelbug
Copy link
Author

Cool! Well, I'll work on figuring them out and maybe someday I'll write a tutorial and make a pull request :)

@phil-opp
Copy link
Owner

@nebrelbug Cool, good luck! A tutorial on this topic would be great!

@nebrelbug
Copy link
Author

@phil-opp just from the limited research I've done, it looks like it'd be way easier to do with a UEFI kernel set up first, since VESA and VBE (I think?) only work with 16-bit code? I'm going to see if I can get a UEFI kernel running.

@phil-opp
Copy link
Owner

Cool! Maybe #349 (comment) and #349 (comment) help.

@dodikk
Copy link

dodikk commented Jul 4, 2018

For the blog, I plan to eventually switch to using a framebuffer instead of text mode eventually, because the text mode is not supported for UEFI booting.

Actually, a memory mapped VGA text buffer is so much beginner-friendly. Meaning, there is no need explaining the Bresenheim's algorithm (one for drawing the line and another variation for the arc) and other CG (Computer Graphics) entry level stuff.

@phil-opp , any chance you would not deprecate its description completely?

@phil-opp
Copy link
Owner

phil-opp commented Jul 5, 2018

The plan is to use a bitmap font, so we wouldn't need to do any rasterization. That said, there aren't any concrete plans yet, so if it turns out to be too complicated I will think of a different solution (maybe keep the text buffer post and insert an additional framebuffer post).

@nebrelbug
Copy link
Author

@phil-opp any updates on using a framebuffer?

@phil-opp
Copy link
Owner

@nebrelbug I'm looking into it right now. I was already able to configure the vga hardware to use a 640x480 pixel buffer and output some pixels to the screen. Now I'm working on making this a cargo feature of the bootloader.

@phil-opp
Copy link
Owner

@nebrelbug I added initial support for a small 320x200 VGA framebuffer to the bootloader in rust-osdev/bootloader#35.

@C-Loftus
Copy link

C-Loftus commented Nov 5, 2021

Have there been any updates to this? I was curious about adding graphics to my fork and I wasn't sure if the bootimage crate in the tutorial would support this and if not, how I would go about adding it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants