Win32 - Drawing Pixels (C)

  Рет қаралды 27,521

Samuli Natri

Samuli Natri

Күн бұрын

Пікірлер: 31
@timmyfriday2718
@timmyfriday2718 3 жыл бұрын
Possibly the sexiest voice ever to feature in a programming tutorial video.
@timmyfriday2718
@timmyfriday2718 3 жыл бұрын
Ladies and Gentlemen, Paolo Conte will now perform his new hit single "The fundamentals of standardised bit-level pixel representation"
@beneze3286
@beneze3286 2 жыл бұрын
I’d buy the whole record!
@ozr2222
@ozr2222 3 ай бұрын
honestly every video deserves this voiceover.
@andrewburke8238
@andrewburke8238 2 жыл бұрын
I want to add how amazing it is that used so few libraries. Thank you for this.
@Byynx
@Byynx Ай бұрын
Masterly done !!! THANKS.😀
@andrewburke8238
@andrewburke8238 2 жыл бұрын
It works. I subscribed because it works. Thank you.
@iskandar149
@iskandar149 4 жыл бұрын
great, please continue
@paolograsso5085
@paolograsso5085 3 жыл бұрын
Could you print pixels' values directly from the GPU's memory (I mean without going back to cpu and back again to gpu for visualisation), for instance after they have been processed by CUDA threads? E.g. between the following data flows (a) and (b), is it possible to do the (b) optimal one? (a) CPU raw data (e.g. geometry + textures) -> CUDA processing pixels -> pixels data sent to cpu -> cpu gives displaying command to gpu -> display (b) CPU raw data (e.g. geometry + textures) -> CUDA processing pixels -> display without cpu intervention Any suggestions where to look for this info? Or maybe you want to make a video about it. ;-) Thanks in advance
@aslanbabakhanov9193
@aslanbabakhanov9193 3 жыл бұрын
You can follow this link (hope you have downloaded the cuda samples fist) docs.nvidia.com/cuda/cuda-samples/index.html#mandelbrot Good luck
@paolograsso5085
@paolograsso5085 3 жыл бұрын
@@aslanbabakhanov9193 Thank you for the reply :-)
@aleksvitek798
@aleksvitek798 5 ай бұрын
Followed the tutorial carefully, I didn't get any compiler or linker errors, but the window just stayed white, any help will be appreciated
@SamuliNatri
@SamuliNatri 5 ай бұрын
Try copying the code from here: samulinatri.com/blog/win32-drawing-pixels. It has been updated since the video upload, but does the same thing.
@aleksvitek798
@aleksvitek798 5 ай бұрын
@@SamuliNatri Thank you a lot for taking the time to respond, but unfortunately this is not working as well, in fact it is even worse, according to Microsoft Visual Studio Code. I am very new to all of this. The code in the video works, in a sense that it doesn't throw any errors, I also made sure to add include -lgdi32 , so gcc doesn't complain about an undefined reference to StretchDIBits, and also threw in -municode, since for gcc it's mandatory. But when I open my .exe file, it's all white, it just doesn't want to turn black. The new code you suggest, throws errors like: "out-of-order initializers are nonstandard in C++", "chained designators are nonstandard in C++" and "duplicate designator is not allowed". I have no idea what those mean, please help
@SamuliNatri
@SamuliNatri 5 ай бұрын
So.. have you tried to create main.c, paste the code from the site to it, and run "cl main.c"? I would assume that works. Personally I don't use gcc on Windows. The errors are C++ errors, I try to avoid C++. This is C, so name the file main.c for my code to work. I don't know why I have C++ in the title. I used to do C-style programming with C++, maybe that's why, but now I just do C.
@aleksvitek798
@aleksvitek798 5 ай бұрын
@@SamuliNatri Thanks, changing my source file's extension to .c worked, the program works great and the clear_screen function easily allows you to change background colours, too bad I don't know the C programming language and don't fully understand what's happening "under the hood" though. Just out of curiosity, why do you do C instead of C++, considering C++ is newer and allows you to do stuff, which C doesn't? I am a beginner, so I will appreciate it, if you would explain, thanks
@SamuliNatri
@SamuliNatri 5 ай бұрын
C++ is a bloated mess that adds a bunch of useless features to C and removes useful features like out-of-order designated initializers (they might have brought these back to some capacity by now; I don't really follow C++ stuff). In fact, the errors you got were related to this. The OOP paradigm is also useless to me. I don't respect the language, and I don't want to use it. It has some useful features, though, such as overloading (for functions and operators), but that's about it. Sure, C has its own quirks and baggage as it is an old language, but I would rather work around its limitations than use C++. Most software actually runs on top of C. At some point in the abstraction hierarchy, there's usually some C libs in there, and the platform the software is running on is probably mostly written in C. Even though a lot of money is made with bloated, slow systems, modern software is not doing well. There are probably nice opportunities available for the folks who harness the full potential of the system, as the JS framework garbage pile keeps stacking higher and higher. I do use other languages for webby things, like Go. It's a nice compromise between usage and performance. Not as crazy as Rust (unnecessarily complicated, slow to compile, etc.), but performant enough. You get things done. Much better than JS for backend in my opinion. I guess I just had to add a little web rant here :)
@ixsterne
@ixsterne 2 ай бұрын
First hearing, I thought you were the river shen guy!
@joaquimjesus6134
@joaquimjesus6134 2 жыл бұрын
i need to understand: - how can i calculate the stretch? - and alphablend?
@Nanagos
@Nanagos Жыл бұрын
This doesn't work if the window gets resized. There is no VirtualRealloc and VirtualFree doesn't work either, so I just get memory leaks.
@plasmapig1356
@plasmapig1356 7 ай бұрын
Good tutorial!
@dobcs3236
@dobcs3236 Жыл бұрын
Is there a good reference you recommend for me to learn Win API ? I don't understand MSDN documention.
@thecomputer1424
@thecomputer1424 5 ай бұрын
I cannot understand them either.
@walkervr5691
@walkervr5691 3 жыл бұрын
d u d e im challanging my self to make a game engine from complete nothing and this is fricking awesome i will recomend this if any of my programer friends ever need help with graphics subed
@lilyscarlet2584
@lilyscarlet2584 2 жыл бұрын
look up casey muratori he made a complete game from scratch and archived the stream showing every step. molly rocket is the channel.
@oskardeeream1846
@oskardeeream1846 2 жыл бұрын
why use virtualAlloc in this case instead of malloc or somthing else
@lilyscarlet2584
@lilyscarlet2584 2 жыл бұрын
because malloc ends up indirectly calling VirtualAlloc as its just a cross platform function in the runtime library. since you are writing native code anyway might as well call the windows native memory allocator directly and get rid of that extra cruft.
@ajinkyax
@ajinkyax 3 жыл бұрын
Subscribes ❤️ thanks for your teaching style, I'm noob but I learnt alot. I'm using this in C++
@tails_the_god
@tails_the_god 3 жыл бұрын
Hmm I'm having a strange issue with using stretchdibits gdi function in vb6 it won't show anything in the picbox why? Does it have something to do with 64 bits? Also it shows a messed up image sometimes when resized too...
@TheRojo387
@TheRojo387 Жыл бұрын
The colour value looks little-endian.
Minesweeper with C and Direct3D 11
10:08
Samuli Natri
Рет қаралды 406
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 986 М.
大家都拉出了什么#小丑 #shorts
00:35
好人小丑
Рет қаралды 99 МЛН
Как подписать? 😂 #shorts
00:10
Денис Кукояка
Рет қаралды 6 МЛН
EP0003 - Win32 Basics II - Making a video game from scratch in C
1:04:29
Texture Mapping & Polygon Rasterizing Tutorial (1/2) [C++20]
22:46
Should you learn C++?? | Prime Reacts
20:29
ThePrimeTime
Рет қаралды 365 М.
Cross Platform Graphical User Interfaces in C++
44:49
javidx9
Рет қаралды 867 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Harder Drive: Hard drives we didn't want or need
36:47
suckerpinch
Рет қаралды 1,7 МЛН
The Art of Code - Dylan Beattie
1:00:49
NDC Conferences
Рет қаралды 4,7 МЛН
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 986 М.