Vertex Buffers and Drawing a Triangle in OpenGL

  Рет қаралды 364,269

The Cherno

The Cherno

6 жыл бұрын

Patreon ► / thecherno
Twitter ► / thecherno
Instagram ► / thecherno
Discord ► thecherno.com/discord
Series Playlist ► thecherno.com/opengl
OpenGL Documentation ► docs.gl
Thank you to the following Patreon supporters:
- Lukáš Jech
- Daniel Weaver
- Samuel Egger
- Dominic Pace
- Kevin Gregory Agwaze
- Sébastien Bervoets
- Tobias Humig
Gear I use:
-----------------
BEST laptop for programming! ► geni.us/pakTES
My FAVOURITE keyboard for programming! ► geni.us/zNhB
FAVOURITE monitors for programming! ► geni.us/Ig6KBq
MAIN Camera ► geni.us/t6xyDRO
MAIN Lens ► geni.us/xGoDWT
Second Camera ► geni.us/CYUQ
Microphone ► geni.us/wqO6g7K

Пікірлер: 377
@brod515
@brod515 6 жыл бұрын
I've Used Photoshop and that analogy of how binding compares to Photoshop layers is Brilliant.
@zorbix3652
@zorbix3652 3 жыл бұрын
hi
@brod515
@brod515 3 жыл бұрын
@@zorbix3652 hi
@Vector99
@Vector99 3 жыл бұрын
@@brod515 ayy you replied after 2 years. How are you with opengl and graphics?
@zelda_smile
@zelda_smile 3 жыл бұрын
@@Vector99 its been 2 weeks, we need to know
@alfonsld7684
@alfonsld7684 3 жыл бұрын
Come on man, tell us!
@rapidreaders7741
@rapidreaders7741 3 жыл бұрын
Me anxiously keeping my eyes peeled for the cactus on his table, hoping he doesn't accidentally stab himself, only to nearly get a heart attack at 5:30
@carlosdalomba
@carlosdalomba 2 жыл бұрын
LOL
@ibrahimhabibeh6904
@ibrahimhabibeh6904 2 жыл бұрын
Wow I see Cherno still looking at our comments 3 years after posting ❤️
@widrolo
@widrolo 2 жыл бұрын
@@ibrahimhabibeh6904 oh my god i didnt even notice that
@raf.nogueira
@raf.nogueira 6 жыл бұрын
OMG, I tried to learn modern OpenGL for so many months, and only now I finally understand the basic pipeline, Thank you so much Cherno!
@RomanWaves
@RomanWaves Ай бұрын
i dont get anything actually ...so there buffers who interpret a stream of bytes ? is there any other course, which kind of starts a bit earlier ? i mean, i understand on a very basic level what happens with graphics ... but cherno lays out the code as if it is a logical progression, whereas i cant follow - anyone on the same page ?
@StarContract
@StarContract 6 жыл бұрын
Top quality channel. The best around for cpp.
@slap_my_hand
@slap_my_hand 6 жыл бұрын
5:50 I never knew that you can select text like that in visual studio
@alexkiecker4175
@alexkiecker4175 6 жыл бұрын
Shift + Alt + Arrow keys do the same thing.
@borekworek69
@borekworek69 5 жыл бұрын
@@alexkiecker4175 or alt + mouse click
@feschber
@feschber 5 жыл бұрын
@@borekworek69 it also isn't just visual studio it works almost anywhere
@VivekYadav-ds8oz
@VivekYadav-ds8oz 5 жыл бұрын
Can someone please tell how does Cherno does that thing where he selects a certain code then just uses some keyboard combination to shift the whole block of code up or down. This feels very useful when you want to put some code outside a scope INTO the scope.
@osere6432
@osere6432 4 жыл бұрын
@@VivekYadav-ds8oz alt + up/down with the line selected or cursor on the line
@amiright7784
@amiright7784 4 жыл бұрын
I shall ask my uni for a refund and become the ultimate patreon.
@zorbix3652
@zorbix3652 3 жыл бұрын
good 4 u
@felixchien1664
@felixchien1664 3 жыл бұрын
right you are my good sir
@rukna3775
@rukna3775 3 жыл бұрын
but uni gives u a degree, youtube doesnt. no offense, I am also a supporter of fuck school and learn online cult but still, in real world interactions between people, having a degree makes ur daily interactions a lot easier.
@robosatchlol1099
@robosatchlol1099 5 жыл бұрын
I just found your channel and must say amazing job and thank you so much! I'm currently preparing for an entry exam for a game engineering degree and your videos are helping big time! You earned yourself a new subscriber :)
@p9malino267
@p9malino267 6 жыл бұрын
I've been having difficulty with looking for decent tutorials for opengl but then you came along and made learning opengl for me so much easier! Your tutorials explain things so well and are great for beginners. Thank you for making them!
@chrisreuter5843
@chrisreuter5843 4 жыл бұрын
Man you're an awesome teacher. I found your channel about 3 days ago, and it's already in my top 5 favorite KZbin channels ^^b Thanks so much for putting in your precious time and effort in teaching us! XD
@ewanarends5512
@ewanarends5512 6 жыл бұрын
I've been searching for good openGL tutorials for months, although i use a java binding, this really helps me out, thanks for creating those amazing tutorials! keep it up
@sarahshahzad
@sarahshahzad 4 жыл бұрын
I love these series so much! I started programming in 2013 and OpenGL was alien to me when I started in 2014. This is the first time I actually understand stuff without searching for everything on 10 other tabs. Thank you! (That charisma though)
@samdavepollard
@samdavepollard 3 ай бұрын
really appreciate the detail you go into; so many opengl tutorials out there which throw a bunch of code at you with superficial explanation many thanks
@suhassreenivas1878
@suhassreenivas1878 6 жыл бұрын
great quality content... and man ... those explanations are golden (from prev video : I finally understood where the openlgl implementation is and what graphics drivers contain) !
@sajibsrs
@sajibsrs 5 жыл бұрын
I like your extended version of explanations. Thank you
@Brick10Man
@Brick10Man 6 жыл бұрын
Your videos are great! Very clear explanations of core ideas in OpenGL. Very helpful.
@Lordp00m
@Lordp00m 5 жыл бұрын
Excellent tutorial! Learned a ton of new stuff already!
@samarthtandale9121
@samarthtandale9121 Жыл бұрын
Great video ! Gave a lot of conceptual clarity !
@JasonEwton
@JasonEwton 6 жыл бұрын
Dude. You're easily the best resource for modern OpenGL and im only on episode 4. Mad mad mad respect for what you're doing. Can't wait for the game engine bit (polite request to make it 3D)
@elnazzamani5110
@elnazzamani5110 3 жыл бұрын
You explain neatly. I like how you specify details. I wish I found you last semester which I failed Computer Graphics
@RudolfCickoMusic
@RudolfCickoMusic 6 жыл бұрын
Congratulations for that very educational and clear videos. I learn very much with you. Thank you !!
@CriticalFlinch
@CriticalFlinch 10 ай бұрын
Wow your explanation of vertex buffers and their relationship with drawing was great, been trying to understand how it call comes together for a few says
@jpsilver3510
@jpsilver3510 6 жыл бұрын
DUUUDEEE!!! I F*ckin love your tutorials!!! Where have you been all my life xD
@rahulta2000
@rahulta2000 3 жыл бұрын
Awesome video. Learned a ton of stuff from this that even many paid tutorials don't explain well.
@wyntermc2126
@wyntermc2126 4 ай бұрын
Excellent videos, really helpful.
@KayVerbruggen
@KayVerbruggen 6 жыл бұрын
Damn, I did not expect you to upload this consistent. If you can keep this up, you might be the first youtuber I'm gonna donate some money to!
@AllanJeremy
@AllanJeremy 6 жыл бұрын
agreed, he's awesome
@alexkiecker4175
@alexkiecker4175 6 жыл бұрын
Is he going to pop your donation cherry?
@mhammedhassnouni4755
@mhammedhassnouni4755 6 жыл бұрын
Ce jeune est un génie !!
@user-hl7lr8ld2i
@user-hl7lr8ld2i 3 жыл бұрын
did you donate?
@SamWillBenchYa
@SamWillBenchYa 3 жыл бұрын
@@mhammedhassnouni4755 lol
@Moriadin
@Moriadin 11 ай бұрын
Superb videos! Thank you!
@MS-bl9ch
@MS-bl9ch 3 жыл бұрын
The way you explain right from scratch simply awesome 😎 man 👍
@nickgennady
@nickgennady Жыл бұрын
Wow I know this video is old but it’s so helpful. That documentation site helps me so much. I’m targeting OpenGL 3.3 and OpenGL ES 2 . Now I can check what I’m using is supposed.
@amankharb2401
@amankharb2401 6 жыл бұрын
Keep up the good work man!!
@D1mas21
@D1mas21 4 жыл бұрын
Another nice one! Thank you)
@thenerdyouknowabout
@thenerdyouknowabout 6 жыл бұрын
Dear god this is perfect. Youre absolute credit to the community.
@cnsujeer
@cnsujeer 3 жыл бұрын
freaking amazing content and explanation!
@Ocmersh
@Ocmersh 4 жыл бұрын
Made a lot more sense coming from you, than my graphics professor. Thanks!
@lCanShowYouTheWorld
@lCanShowYouTheWorld 5 жыл бұрын
If you get "Exception thrown at 0x00000000 in Engine.exe: 0xC0000005: Access violation executing location 0x00000000. " Try to put your "glewInit();" after "glfwMakeContextCurrent(window);"
@Temeliak
@Temeliak 2 жыл бұрын
Thanks!
@maddoo23
@maddoo23 Жыл бұрын
Wow, thanks. It solved my other problem. When I ran the code at 17:16, it gave me the error "exited with code -1073741819.". Can you please tell me why it works that way?
@jasonwhitworth117
@jasonwhitworth117 6 жыл бұрын
Wow dude. This is the best explanation I've ever heard!
@zen-ph8yj
@zen-ph8yj Жыл бұрын
Your series help me a lot thanks.
@JNelson_
@JNelson_ 5 жыл бұрын
You explain things so well. :)
@Killerkraft975
@Killerkraft975 Жыл бұрын
Currently behind in my graphics module at university and trying to understand what the example code is and this is a life changer 😂 thank you
@clodgozon3968
@clodgozon3968 4 жыл бұрын
Back then, I wasn't able to follow your tutorials since my head wasn't "organized" at that time, and I have too poor logical thinking skill to understand you. Now that I do have decent skills, it looks like your tutorials are pretty easy to follow. Thanks Cherno!
@guso1330
@guso1330 6 жыл бұрын
Great work man, just gotta say that! Can't wait to see that new game engine series as well, but is it going to be an extension of sparky or just a completely new engine?
@LetsHackification
@LetsHackification 3 жыл бұрын
So basically opengl is working just like the cpu: working with the current value of the accumulator. I'm in my first semester in computer science and at the same time I'm learning open gl with your videos and it's really fun. You explain it so well I understand literally everything and English is not even my first language :D
@CipriValdezate
@CipriValdezate 3 жыл бұрын
You are an excellent teacher, far far better than the professors of my uni.
@diato2993
@diato2993 2 жыл бұрын
thank you very much !!
@johnsknows3135
@johnsknows3135 Жыл бұрын
cheers bro!!
@glenneric1
@glenneric1 2 жыл бұрын
Great stuff!
@prezadent1
@prezadent1 6 жыл бұрын
The following 2 lines placed after the line with glBufferData will use the default shader on most Nvidia and maybe most AMD GPUs. You should get a white triangle on black background. glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0); glEnableVertexAttribArray(0);
@rutexgreat3619
@rutexgreat3619 Жыл бұрын
Very professional and simple...
@Argletrough
@Argletrough 3 жыл бұрын
docs.gl is mostly the official documentation with a search function, although the version availability indication could be handy... Linux users will be pleased to hear that OpenGL-Refpages (the source for both) exports to manpages, installed in the 3G section. (The package is opengl-man-pages on Arch).
@guineapigmart882
@guineapigmart882 3 жыл бұрын
I must say that the outro is the same top notch quality as the video it self.
@adulpankaj2729
@adulpankaj2729 6 жыл бұрын
Good Video. Very informative
@marcovalentinoalvarado3290
@marcovalentinoalvarado3290 4 жыл бұрын
This channel is dramatically underrated.
@shivanshuraj7175
@shivanshuraj7175 6 жыл бұрын
So good video !!
@Fernando-du5uj
@Fernando-du5uj 6 ай бұрын
That notion about opengl being state machine was great. It makes so much sense now. Thanks a lot, mate.
@ccdd3104
@ccdd3104 2 жыл бұрын
good video thanks Cherno
@wesleyferreira3350
@wesleyferreira3350 4 жыл бұрын
You rock dude!
@jessefinnegan1719
@jessefinnegan1719 7 ай бұрын
Has The Cherno ever said what theme that he uses? I really like the look of it and would love to use it in VS. Great videos btw.
@mhammedhassnouni4755
@mhammedhassnouni4755 6 жыл бұрын
Vos vidéos sont juste parfaites, du beau travail.
@MieysoFelix
@MieysoFelix Жыл бұрын
For a moment, let's appreciate the work that Yan put in that series. FOR US!
@Marnie_C
@Marnie_C 3 жыл бұрын
That analogy to photoshop helped explain the binding concept leagues better than my college teacher ever could
@yojalin1877
@yojalin1877 2 жыл бұрын
Thank you so much Cherno!I come from China,and I am your fans.
@erawanthewise8227
@erawanthewise8227 2 жыл бұрын
This is fucking good! 🔥🔥
@ninadsachania3652
@ninadsachania3652 6 жыл бұрын
You deserve way more subs, man! Consistent and quality uploads.
@alexkiecker4175
@alexkiecker4175 6 жыл бұрын
"Consistent". Tell that to all the sparky engine fans
@joseplano4789
@joseplano4789 4 жыл бұрын
GREAT channel!! ...It would be nice if you do a serie of integrating assimp library for models and specially with animation, blending between animation, how to load differents animation for 1 modelt etc...
@anuragparcha4483
@anuragparcha4483 2 жыл бұрын
Thanks for this series, loving it so far. I had a doubt, why didn't you initialize "positions" array as a standard array type? As far as I have gathered it has no overhead but provides extra functions. Am I wrong?
@soumyamohapatra7621
@soumyamohapatra7621 6 жыл бұрын
That's a hell lot of work
@user-tz5bz4cz9q
@user-tz5bz4cz9q 2 жыл бұрын
Thank The Cherno! Cool video!
@tanchienhao
@tanchienhao 2 жыл бұрын
BIG fan of this series btw :) thank you so much for making these free for everyone as a fantastic educational resource! at 10:43 cherno said he is not a fan of doing sizeof(positions). why? what's the best practice for the size parameter?
@chastitywhiterose
@chastitywhiterose Жыл бұрын
Imagine that the array was allocated on the heap instead of the stack, then you would be required to do it the way Cherno does it.
@chastitywhiterose
@chastitywhiterose Жыл бұрын
Or the array was allocated to be a very large array and you didn’t want to send megabytes worth of data to the gpu when you only needed 6 floats to draw the triangle.
@tanchienhao
@tanchienhao Жыл бұрын
@@chastitywhiterose I see! Thanks!!
@postulysses
@postulysses 5 ай бұрын
Ευχαριστούμε!
@jeroenkoffeman9402
@jeroenkoffeman9402 4 жыл бұрын
This is awesome
@anicsr
@anicsr 6 жыл бұрын
amazing, tysm
@hichamwarryor3547
@hichamwarryor3547 3 жыл бұрын
Thanks so much 🌹 I hope some one make tutorials for development Android with c++ 😍
@Barakooda3D
@Barakooda3D 5 жыл бұрын
thanks a lot !
@amkodonner8757
@amkodonner8757 5 жыл бұрын
best tutorial ever :D
@skaffen
@skaffen 3 ай бұрын
Your series are incredibly useful to understand OpenGL. OpenGL is a weird way of conceiving 3D when you go from scratch 3d engine like me.
@_Mrunalwankhede
@_Mrunalwankhede 2 жыл бұрын
I didn't understand any code he did or copied in the previous two videos, but I trusted the process, and I think now I will finally learn what the code is actually doing
@cptray-steam
@cptray-steam 2 жыл бұрын
Awesome!
@garbohydrates193
@garbohydrates193 5 жыл бұрын
Why didn't you create a swapchain for the front and back buffers?
@yuansizhu6271
@yuansizhu6271 4 жыл бұрын
My teammate tried to teach me OpenGL, but what he said is a mess... So I come watching your vedios and this is brilliant!
@salmanahmad1
@salmanahmad1 6 жыл бұрын
This guy is just magic
@deblish
@deblish 5 жыл бұрын
10:11 alt+shift trick was mind blown
@cameroncollins4341
@cameroncollins4341 5 жыл бұрын
same here
@WelcomeToSex101
@WelcomeToSex101 6 жыл бұрын
Nice video!
@JohnSmith-bs5mg
@JohnSmith-bs5mg 6 жыл бұрын
Yay! Thanks a lot! I hope that drawing complex polygons will come before shaders. Cause almost everybody do such tutorials: draw a triangle and describe whole graphics rendering pipeline with that freaking triangle. Vertex shaders, rasterization, fragment shaders, etc - and still triangles.
@kieranvs
@kieranvs 6 жыл бұрын
You do everything with triangles! More complex polygons are actually just several triangles next to each other. I'm not sure if your comment was a joke haha, if so I apologise
@JohnSmith-bs5mg
@JohnSmith-bs5mg 6 жыл бұрын
Not joking. I don't remember correctly, but there is function that does groups of vertices, which do not have repeated vertices. Like (1,0),(0,1),(0,0),(1,0),(0,1),(1,1) is the default array that describes square of two triangles. But you pack them like (0,0),(0,1),(1,0),(1,1) in the array using that function. I really what to see how Cherno would apply shaders, textures and stuff to something more complex than square, maybe a hexagon? Something that can be used in real 3D model. Drawing complex figures is hard.
@vaualbus
@vaualbus 6 жыл бұрын
You have to have a shader anyways. And complex geometry can be done in geometry shaders. We need matrix and shaders than you can draw complex stuff.
@kieranvs
@kieranvs 6 жыл бұрын
I think you're talking about a triangle strip. That's just a way to push loads of triangles to the gpu without the repeated vertices. The gpu can only draw triangles. It's triangles all the way down, haha. If you want a hexagon, you can draw that using 4 triangles. Any n-polygon can be drawn using n-2 triangles
@RandomGuyyy
@RandomGuyyy 6 жыл бұрын
That's the thing about modern OpenGL. Everything is based on programmable shaders and there are a whole load of function calls just to do a "Hello, World".
@hamtarodeluxe6852
@hamtarodeluxe6852 6 жыл бұрын
Very helpfull !
@KrySquiky
@KrySquiky 4 жыл бұрын
It is so well explained, thank you so much ! Your work is going to be useful for so much people.
@ElektrykFlaaj
@ElektrykFlaaj 3 жыл бұрын
imagine how many games on Stream exist only thanks to The Cherno
@tezza48
@tezza48 6 жыл бұрын
i'm watching this having learned DX11 doing my dissertation, i deliberately ignored it when you posted it as i'd basically just finished the DX and was knackered! I knew it was a faster start but It's somewhat depressing to see how fast you can get GL running compared to D3D.
@Albert-px4jo
@Albert-px4jo 4 жыл бұрын
If the tessellation shader and compute shader can also be covered, that will be nice
@JaccovanSchaik
@JaccovanSchaik 6 жыл бұрын
OK, two questions: 1. How many buffers would a program typically allocate? Dozens, thousands, millions? 2. You still haven't told GL you're giving it floats, or that there are two coordinates per vertex. Is this still to come? Loving the series!
@JaccovanSchaik
@JaccovanSchaik 6 жыл бұрын
No., that's very helpful, thank you. So the limit is the total amount of memory used, rather than the number of buffers?
@jamesmnguyen
@jamesmnguyen 6 жыл бұрын
Jacco van Schaik Yes, very rarely do you reach the numerical limit of vertex buffers.
@JakobRobert00
@JakobRobert00 6 жыл бұрын
You can also just pass an array directly to the glVertexAttribPointer function. Is there a significant performance boost in using VBOs over normal arrays?
@DE012471
@DE012471 3 ай бұрын
I can't learn for my test if the cherno has an opengl series I need to watch.
@ingframin
@ingframin 5 жыл бұрын
Are you also planning a Vulkan series?
@musicalspace6885
@musicalspace6885 4 жыл бұрын
Why when I created project like he did, I can't build and compile when I open that project later. Thanks.
@sundayscrafter1779
@sundayscrafter1779 5 жыл бұрын
Hi there, does it also work in SharpGL since it’s supposed to be an OpenGL equivalent in C#?
@jixs4v
@jixs4v 3 жыл бұрын
just put in some more effort and use c++
@sergant445
@sergant445 Ай бұрын
thanks
@zecuse
@zecuse 6 жыл бұрын
Great series. Came over after catching up on the C++ series. Not sure I'll get an answer until I catch up with this series but I've got a problem not related to this video but with Visual Studio. Whenever I try to hover over glfwCreateWindow (anywhere in code), VS hangs up and doesn't respond to anything I do. I can still close the application with the taskbar but task manager shows VS using about 30% of my CPU.
@insideouteyes5572
@insideouteyes5572 3 жыл бұрын
Quality tutorials
@sarvarabdulloev6885
@sarvarabdulloev6885 3 жыл бұрын
why do I get a segmentation fault on glGenBuffers(1, &buffer)?
@tricky778
@tricky778 3 жыл бұрын
do legacy opengl functions build buffers and uniforms that we can use in our shaders so someone can paste some legacy opengl that already does some of the right thing and we can just move on with useful functionality done and finished?
@michaplucinski142
@michaplucinski142 Жыл бұрын
I have worked with SFML a bit and now tried this, because I couldn't find good source to understand vertexes, their buffers and all of that This series makes it easier, but it also feels so complicated at moments, that I am gonna get a headache from that
@srijanshashwat1965
@srijanshashwat1965 4 жыл бұрын
How to display Bitmap image using texture over shaders?
@fraelitecagnin7628
@fraelitecagnin7628 2 жыл бұрын
17:16 wow, I'm at a good point then🤣
Vertex Attributes and Layouts in OpenGL
18:54
The Cherno
Рет қаралды 226 М.
I Rewrote This Entire Main File // Code Review
16:08
The Cherno
Рет қаралды 88 М.
когда одна дома // EVA mash
00:51
EVA mash
Рет қаралды 11 МЛН
How To Choose Ramen Date Night 🍜
00:58
Jojo Sim
Рет қаралды 52 МЛН
Vertex Buffer Objects and Vertex Array Objects
8:35
GetIntoGameDev
Рет қаралды 22 М.
Introduction to shaders: Learn the basics!
34:50
Barney Codes
Рет қаралды 262 М.
Minecraft Clone in C++ // Code Review
40:29
The Cherno
Рет қаралды 313 М.
Using Modern OpenGL in C++
18:21
The Cherno
Рет қаралды 411 М.
An introduction to Shader Art Coding
22:40
kishimisu
Рет қаралды 889 М.
EVERYTHING takes longer than it seems
22:17
The Cherno
Рет қаралды 31 М.
You might not need useEffect() ...
21:45
Academind
Рет қаралды 135 М.
I REMADE My First Game 12 YEARS LATER!
37:50
The Cherno
Рет қаралды 31 М.