Low-Level Graphics Coding in C on Linux

Published: 24 February 2023
on channel: Tsoding Daily
33,151
755

References:
Source Code: https://github.com/tsoding/olive.c
Demos: https://tsoding.github.io/olive.c/
UV mapping: https://en.wikipedia.org/wiki/UV_mapping

Timestamps:
00:00:00 - Intro
00:01:03 - Recap
00:01:40 - Plan for today
00:02:32 - SMS
00:02:48 - How exactly texture transformation works
00:03:05 - Difference between olivec_sprite_blend and olivec_sprite_copy
00:03:59 - Plans on a flexible mechanism of defining the format of the pixels
00:04:24 - How SDL defines pixel formats
00:05:30 - Destroying my entire working place just to find the graphics table
00:06:25 - Visual explanation of Rectangular Texture Transformation
00:11:23 - Non-Visual explanation of Rectangular Texture Transformation
00:12:38 - Text Editors Superiority
00:13:12 - I never read a single book about C Kappa
00:13:35 - What is ACM
00:14:39 - Why does he stream in white T-shirts
00:15:41 - I suck at Competetive Programming
00:15:54 - Back to the topic of the stream
00:16:11 - Triangular Interpolation Recap
00:17:34 - Realizing that I'm doing stupid thing again and switching to a Text Editor
00:18:45 - Introducing Texture Coordinates
00:19:50 - We can actually map Sprites on Triangles that way!
00:20:57 - Mapping Textures to Triangles is the Topic of Today's Stream (half of an hour intro lol)
00:21:17 - Putting back my drawing table
00:21:39 - Creating a new demo
00:23:43 - Converting PNG to C
00:24:37 - Back to demo
00:25:16 - New variation of olivec_triangle function for UV coordinates
00:27:09 - Limitations of the Canvas
00:28:40 - How can we store 2 floats in a single unsigned integer?
00:29:10 - Trick for packing normalized floats (0..1) in unsigned integers
00:30:52 - Using the same trick for UV coordinates
00:32:52 - C sucks
00:33:07 - C++ sucks too
00:34:20 - Yes, Rust also sucks (don't @ me)
00:34:37 - Replenishing stamina after epic rant
00:35:01 - Even more flexible pixel formats
00:37:54 - Introducing olivec_triangle3uv()
00:38:31 - Introducing Uv structure
00:39:30 - Why is it dangerous for me to speak English too loud
00:40:02 - Checking the size of Uv
00:41:34 - Subs
00:41:52 - Introducing olivec_uv()
00:43:40 - Implementing olivec_triangle3uv()
00:48:51 - Realizing that the canvas of UV coordinates was a dumb idea lol
00:50:41 - "But we may need that in the future" Kappa
00:52:56 - "All of my streams are exploration"
00:54:02 - First attempt
00:54:55 - Investigation begins!
00:55:45 - Subs
00:56:23 - This was not an overflow...
00:56:55 - Make an excuse to ask ChatGPT offscreen
00:57:15 - Developing a new hypothesis on the cause of the bug
00:58:38 - We missed a division
01:00:05 - Second attempt
01:00:53 - Trying random things
01:02:08 - Giving up on integers and trying floats lol
01:04:36 - ACTUALLY WORKED! POGGERS
01:05:08 - Arbitrary rotation of square sprites
01:06:01 - Can SDL rotate sprites?
01:06:42 - How much CPU does this all utilize?
01:07:32 - Fixing busy looping of the SDL demos
01:08:43 - Implementing the rotating square sprite
01:12:18 - Hallucinating triangles
01:13:56 - It didn't work
01:14:18 - Got an artistic inspiration!
01:15:56 - It worked!
01:16:18 - And it even rotates!
01:16:39 - Putting the texture onto the rotating square
01:18:40 - Hard proof that you must program only in Rust
01:19:14 - New Twitch emote was just born
01:20:20 - ISN"TTHATPAWG?!11
01:21:17 - Saving the glitch as a PNG
01:22:20 - Rediscovering the diagonal of a square like an Ancient Greek
01:24:33 - stb_image_write.h
01:27:11 - Adding new emote
01:29:55 - Fixing the UV coordinates
01:32:09 - It worked! Let's make it rotate!
01:32:41 - And it's slow af!
01:33:23 - The next step is to do that in 3D
01:35:06 - Maybe eventually we will reimplement the whole OpenGL
01:35:54 - Memory safety concerns
01:37:33 - Recap of what we are doing
01:39:06 - QnA
01:39:18 - QnA: Have you looked into coding microcontrollers?
01:39:40 - QnA: What keyboard do you use?
01:40:39 - QnA: What programming language are you using?
01:41:41 - QnA: Is there USB-C keyboard?
01:42:28 - QnA: Any plans for AoC 2022?
01:42:58 - QnA: Did you try Python?
01:43:23 - QnA: Chat is making fun of me :(
01:43:43 - QnA: Can you do OS related stuff in Python?
01:45:11 - QnA: Python is a good language!
01:45:25 - QnA: Have you head about Julia?
01:45:41 - QnA: Is JavaScript even JavaScript?
01:46:02 - QnA: Is Java interpreted or compiled language?
01:46:19 - QnA: How do you write Clean Code?
01:49:20 - QnA: How to be successful Software Developer
01:51:19 - Trying to raid somebody
01:53:20 - Giving up on raiding and signing off
01:53:35 - Smooch


Watch video Low-Level Graphics Coding in C on Linux online without registration, duration hours minute second in high quality. This video was added by user Tsoding Daily 24 February 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 33,151 once and liked it 755 people.