Setting up OpenGL and Creating a Window in C++

  Рет қаралды 835,105

The Cherno

The Cherno

Күн бұрын

Пікірлер: 895
@Redheadtama1
@Redheadtama1 3 жыл бұрын
Note for anyone following this tutorial in Visual Studio 2022, after making the configuration changes to the include and lib directories, if you still have compiler errors and red squigglies, make sure the active platform is x86 (at the top of the main window, to the left of the "Local Windows Debugger" button, click the dropdown to switch from x64 to x86. Now if you reopen the configuration properties window, you should see the Platform dropdown says "Active(Win32)" and your changes should take effect.
@nixlittle5468
@nixlittle5468 2 жыл бұрын
holly cow ! you come straight out of heaven ! I've been litteraly sitting here for 2 hours freaking out and then you show up and just solve the issue with one click
@4tehath
@4tehath 2 жыл бұрын
@@nixlittle5468 samesies man thank god i saw this comment. what an angel!
@carlsims1506
@carlsims1506 2 жыл бұрын
You absolute gem! Thank you!
@TheArrowedKnee
@TheArrowedKnee 2 жыл бұрын
It still worked fine for me with x64
@lockks
@lockks 2 жыл бұрын
ty bro
@ProgrammerSheep
@ProgrammerSheep 5 жыл бұрын
Never have I been so excited to draw a triangle.
@pradeepalhan
@pradeepalhan 4 жыл бұрын
likewise !!
@xrafter
@xrafter 4 жыл бұрын
@@pradeepalhan Wha is opengl
@xrafter
@xrafter 4 жыл бұрын
@A42426 Ashley GILL What is the libraries? Is this something you can compile
@dreamingwarlord
@dreamingwarlord 4 жыл бұрын
​@@xrafter Open Graphics Library, pretty low level.
@asukalangleysoryu6695
@asukalangleysoryu6695 4 жыл бұрын
@@xrafter Uhh maybe this video isn't for you...
@Mariuho1999
@Mariuho1999 5 жыл бұрын
How i downloaded GLFW 3 times: Cherno: "So we need to download GLFW" me: *hits that download button* Cherno: "We could down... blah blah blah... But we're gonna download binaries" me: "Oh" *hits 64 bit binaries for windows download* Cherno: *So we are going to download 32bit binaries, we don't need 64 bit" ... Yeah
@potpindakaas3003
@potpindakaas3003 5 жыл бұрын
I had exactly the the same situation haha
@coder2k
@coder2k 5 жыл бұрын
same :D
@mrifat13
@mrifat13 4 жыл бұрын
ahahahah i just imagine that while looking at the web 🤣
@gunger7670
@gunger7670 4 жыл бұрын
I though I was the only one doing this lol
@xeliani.7809
@xeliani.7809 4 жыл бұрын
64 bit would of worked fine tho but rip :P
@Poneglyph
@Poneglyph 5 жыл бұрын
I can't believe this guy got me to do anything in opengl without using someone else's build entirely. Getting openGL running is the single biggest obstacle holding back people from learning computer graphics basics.
@温旭阳
@温旭阳 2 жыл бұрын
yeah, the setting up is not easy for beginners
@xaesthetics1769
@xaesthetics1769 4 жыл бұрын
Him: "Idk why those libraries are linked.."*deletes* Compiler: (INSERT 100 ERRORS..)
@Drqonic
@Drqonic 4 жыл бұрын
I personally never delete the dependencies my linker gives me by default. They're there for a reason, no touching.
@checkbordspy4608
@checkbordspy4608 3 жыл бұрын
@@Drqonic i touched the dependencies in the linker....never, never again
@Drqonic
@Drqonic 3 жыл бұрын
@@checkbordspy4608 exactly xD
@mattr2238
@mattr2238 3 жыл бұрын
objdump -x is very useful in troubleshooting dependencies. I debug with objdump -d and gdb.
@generichuman_
@generichuman_ 3 жыл бұрын
But he did it on purpose to show us...lol
@junehanabi1756
@junehanabi1756 4 жыл бұрын
The thing Cherno gets right compared to other tutorials is that he focuses on teaching the basics first. While that sounds like many other tutorials it's actually not. There's 2 common and IMHO bad teaching methods others do. 1) Teach by example (Give you a block of code spanning several lines, explain some of it, but leave you to figure out the rest to understand the basics.) 2) Teach by building a complex program (Give you a much longer program, explain what each line does without really helping you understand much of it and progressively span several files and thousands of lines teaching you the basics) Both of those are ubiquitously common online and many teachers swear it's the best way to learn. But they're both garbage IMHO, you need to start small and play around with one concept at a time with the most minimal lines of code possible. You want focus on the once concept so you don't want any other distractions with too much other stuff going on including other concepts you also haven't fully understood. Cherno focuses on helping you understand the concept being taught and encourages you to play around with just that one concept to really learn it. I really wish more teachers did this and not try to throw too much in and have too much going on that you just can't figure anything out, become stressed and overwhelmed, feel abandoned, and ultimately quit. With Cherno's method you actually feel like you understand something and feel like you're having fun.
@NavyaVedachala
@NavyaVedachala 3 жыл бұрын
Exactly! As an absolute beginner, I'm constantly feeling overwhelmed by the gap between what's taught in tutorials and the exercises that are recommended (with no follow-up discussion of solutions)
@MrPatak007
@MrPatak007 3 жыл бұрын
Source: just trust me dude.
@wireghost897
@wireghost897 2 жыл бұрын
I will note this down.
@ReplicateReality
@ReplicateReality 2 жыл бұрын
Im glad this video was recommended in a comment on another video, sounds good
@ReplicateReality
@ReplicateReality 2 жыл бұрын
@@MrPatak007 what?
@electromorphous
@electromorphous 3 жыл бұрын
For those using 2019 or newer versions of visual studio make sure that in the properties window you have Win32 set to active instead of x64 which is default
@kacperpajak3
@kacperpajak3 2 жыл бұрын
ur my hero
@t3st3d
@t3st3d 2 жыл бұрын
thats why its not working
@shavais33
@shavais33 2 жыл бұрын
win32? In the project properties? Even if you've downloaded the x64 glfw binary? What if you're trying to create an x64 library/app? If you build glfw from source does it work with x64? I was thinking this morning about why it is that C++ is such an enormous pain to use compared with, say, C#, for example. I don't think it's actually the need to deal with pointers or memory management, or the incredible verbosity that's required to satisfy the type checker, or anything really to do with the language itself. That kind of thing can be a bit troublesome, sure. But I don't think any of that is actually what causes the vast majority of the hair tearing and time loss. I think the thing that causes the vast majority of the hair tearing and time loss with C++ is all about the build environment. It's related to the 500 or so spurious errors you get, associated with the giant mountain of dependencies you have, if one tiny little thing isn't exactly right. With C++, the actual thing which is causing your problem is referenced by a needle in a haystack. And the needle is probably pointing in the wrong direction. Why does that happen with C++ and not with, say, C#, for example? I think the key difference is the need to compile header files. In C#, and in Python, PHP, Ruby, Lua, etc., the manifest of what is in a library is built into the library itself and is known to the compiler (or jitter or interpreter, etc.) at compile time without needing to depend on the success of the compilation of a header. In C++, if something goes wrong with the compilation of one header, all of the headers that depend on that won't compile either, and so the compiler has no idea what's in any of the whole tree of libraries that depend directly or indirectly on that library. I think that by itself is The Thing that causes by far and away the most headaches with C++. What if we came up with a new type of library which doesn't require a header to use? What if our C++ libraries imbedded a complete manifest that is explorable by a tool similar to the C# assembly browser? If we could manage that, then if one or two calls were mismatched in some way, we'd only get errors about those one or two calls, instead of getting a cascade of errors about every call made by any part of the mountain of dependencies to anything in that library or any of the libraries in the whole tree of libraries that depend directly or indirectly on that library! I bet that notion By Itself, with No Other Changes, has the potential to reduce the hair tearing and time loss associated with using C++ by something like 90%. "But what about all the header-only libraries!?" We like them because with them at least we don't get link time errors. And they force full disclosure and don't require us to look in two places in order to know how a given function works / exactly what it does. But think about all the horde of compile time errors you get out of STL when something goes wrong in the header compilation process. Is that really better than getting one link time error? If libraries had complete manifests that were readily explorable, the linking process could be merged with the compilation process. If you had the source code for a library, the compiler/linker could potentially direct you to the line of code that caused what is today a link time error. And in header-less C++, you would never need to look in two places to know how a function works / exactly what it does. Headers have the advantage of showing you a brief manifest that you can use to navigate to the implementation code. But if an IDE could give you a way to see that browse that manifest, and use it to navigate to the implementation code for a given class or member, and even open little sub windows into it the way VS does with "Quick Actions", without needing to manually create or maintain the header itself, wouldn't that be better? Header-less C++. Difficult to come up with, maybe, but I bet it would be worth it in spades.
@signedlongint69
@signedlongint69 2 жыл бұрын
@@shavais33 It seems your essay is about you hating C++… you do realise it is meant to be a low-level language, don’t you?
@shavais33
@shavais33 2 жыл бұрын
​@@signedlongint69 It's not about hating C++ at all! I like C++ in general, in fact I choose to use it in my own projects. I was just proposing the supposition that header files from external libraries that have to be compiled into your project are more trouble than they're worth and that there is a better solution. I think maybe I need to experiment with C++20's "modules" feature.
@MiningMadness0029
@MiningMadness0029 7 жыл бұрын
Just a side note for those on Windows, you don't actually have to go through the process of linking all those libraries at 15:38, you can just type in "%(AdditionalDependencies)" to include all the default libraries for you. No need to Google the errors and link them manually. :)
@antibab5023
@antibab5023 6 жыл бұрын
Thank You!
@sutoreikyatto
@sutoreikyatto 5 жыл бұрын
didn't work for me
@vertigo6982
@vertigo6982 5 жыл бұрын
"%(AdditionalLike)"
@YTHandle660
@YTHandle660 5 жыл бұрын
Thank you worked very well. Saved me lots of time!
@nickrooker6368
@nickrooker6368 5 жыл бұрын
Doesn't work
@snowfrog8866
@snowfrog8866 7 жыл бұрын
Your videos have such a remarkable production quality. You really seem to have an innate sense of how to teach things in a simple and effective way. Thank you so much for your great work!
@_Boni_
@_Boni_ 5 жыл бұрын
Speaks too fast.
@satishgoda
@satishgoda 4 жыл бұрын
It has been 13 years since I wrote my last OpenGL program. Thanks to you I am back in the game with modern opengl programming.
@whatsup7341
@whatsup7341 4 жыл бұрын
Thanks Cherno, most C++ tutorials I have found with libraries make me feel like I'm just sort of hacking together something that works, but you have cleared a lot of that fog. Thanks.
@loryon
@loryon 7 жыл бұрын
Why does so many people sucks at explaining the basics ? Cherno is just perfect !
@Kim-e4g4w
@Kim-e4g4w 7 жыл бұрын
Perhaps because they them self forgot how it was they had to learn it. In my home country we have a saying: "The cow has forgotten that they once them self was a calf" Just a thought :P
@LoxagosSnake
@LoxagosSnake 6 жыл бұрын
Because this guy is an industry professional (EA Games) and most others are not. Even a great developer making a tutorial that hasn't been exposed to the formalities and practices of professional software engineering won't have had as much practice. Programming really is a matter of exposure.
@cpuwrite
@cpuwrite 6 жыл бұрын
RPMedia, I have written computer programs, manuals and fiction, and edited novels for publishing houses, so I've got a little bit of experience in this arena. One of the things you have to be careful with when checking out a novel is that the author isn't too close to the story. Remember: more than anyone who reads the story, the writer lives in its world. Some things may seem so obvious that they're not worth mentioning. That's one of the places where an editor comes in. The same holds true for a tutorial. Sometimes, some tips and tricks are so ingrained into the tutor that they just go without saying. Here is where a reviewer earns his or her (paltry) pay. What Cherno does that makes him so good is to take you right through the process, from a first-person point of view. He's also obviously been doing this for a while, so he knows what he's doing, but, more importantly, since he takes you through the actual process, the problems he has are going to be the problems he has. Also, Cherno just plain has a knack for it. Some do.
@jakubpruher979
@jakubpruher979 5 жыл бұрын
Generally spaeaking, people suck at explaining things because they just regurgitate what they have been told and have never internalized the knowledge by meditating on the subject. I see this all the time and it's driving me fucking crazy!
@bonbonpony
@bonbonpony 5 жыл бұрын
So what exactly did he explain in this video, besides the things every C++ programmer should know already BEFORE getting into OpenGL programming? (or any APIs whatsoever) He didn't explain a single line of the code he used, he just copy-pasted the code from the documentation, added a bunch of other function calls he didn't explain either, and that's pretty much it :P Yeah, I agree with the rest of people in this comment thread: some people just *suck at explaining* :q What's worse, many people suck at noticing it, and they all cheer to the fact that they actually learnt nothing actually useful :P
@PoppySeed84
@PoppySeed84 2 жыл бұрын
dude u are a gifted person. its a real inspiration. ur probly a 1 in a million (at least) person. not only being extremely knowledgeable and talented in software development, but being able to help people build their skills. its honestly amazing.
@supersquare
@supersquare 5 жыл бұрын
Yeah, you know I just hit that damn notification bell. You're one of the best teachers I've ever seen. Thank you so incredibly much for providing all of these amazing resources!
@SPL1NTER_SE
@SPL1NTER_SE 7 жыл бұрын
All of your videos are insanely good and I'm so excited about this tutorial series. I've bought several recommended C++ and game programming books, but they don't come close to TheCherno's videos in terms of quality. I'm finally going to really learn how to make something using OpenGL. Everything else I've read or watched on the matter has been outdated legacy crap or broken links or just obvious bad practice. Seriously, I have not been this excited about any KZbin content (or probably anything else, for that matter) for ages. Thank you so much for doing this (FOR FREE) and keep up the excellent work!
@Tiogar60
@Tiogar60 4 жыл бұрын
just gotta say, thank you so much for doing all theese tutorials :) I found your channel just a few months ago and i have learned more about C++ than i would ever have otherwise.
@DaftHacker
@DaftHacker 7 жыл бұрын
I actually really liked how you linked everything from scratch just to see what the basic requirements were to get it running.
@rose_no
@rose_no 4 жыл бұрын
So much anticipation for a single triangle.
@jellohunter7981
@jellohunter7981 4 жыл бұрын
@Comlud Cries in a 1000 lines of code
@xrafter
@xrafter 4 жыл бұрын
@@jellohunter7981 What is vulkan
@sagnost
@sagnost 4 жыл бұрын
@@xrafter another graphics api
@xrafter
@xrafter 4 жыл бұрын
@@sagnost I know this one month i learned a lot
@Wolf_and_Fox
@Wolf_and_Fox 5 жыл бұрын
This is the absolutely best openGL tutorial video!
@postulysses
@postulysses Жыл бұрын
Ευχαριστούμε!
@MrBatraaf
@MrBatraaf 4 жыл бұрын
Nice job man! I had to pause the video a couple of times to keep up, but the reward was an intense feeling of happiness when I saw a simple white triangle appear on screen. I will definitely be checking out all your other tutorials. Take care.
@blocksofwater4758
@blocksofwater4758 4 жыл бұрын
did you get a "glfw.lib cannot open" and if you did , how did you fix it?
@MrBatraaf
@MrBatraaf 4 жыл бұрын
@@blocksofwater4758 No, but when you get library errors like that there are basically only a few possibilities: - the .lib file that you downloaded is corrupt or still zipped or stored in a place where the compiler cannot "see" it. - the compiler is not pointed to the correct files in the project settings In one of the next tutorials I made the mistake of linking both the dynamic and static libraries, and then the project would not work until I placed rhe .dll file in the project folder. Btw, Cherno also has an excellent tutorial on the use of libraries in general. I would recommend you practice by creating a simple library of your own; maybe a simple calculator or some string manipulation functions. In my experience, the trickiest part of programming is not the programming itself, but setting up the toolchain and the compiler. More than once I got so frustrated that I left the whole thing for a while. The subject is a little boring, but it's worth spending some extra time and effort. What also helps is to compile some simple programs from the command line, rather than using the IDE. That will give you a better understanding of what is happening under the hood.
@lastdivantruther
@lastdivantruther Жыл бұрын
this is the first time i understand a subject on coding this clearly. you explanations are simple yet they cover a lot. thank you for making this video, i really appreciate it!
@Evildea
@Evildea 4 жыл бұрын
I came to learn OpenGL but I'm so happy you showed us how to fix linking issues. I've done C++ courses and they've never showed us how to debug a linking issue and you made it so clear with the simple Google search.
@slavago_1
@slavago_1 5 жыл бұрын
Thanks God I have found a person who explained how to "install" OpenGL stuff, how to configure it and it works on my computer! Thank you!
@fountainwindmill
@fountainwindmill 7 жыл бұрын
Really excited for this series! I have come moderately far with LWJGL (Java with OpenGL), but I'd rather use C++ because it's faster if you know what you're doing. I'm glad I have found you because most tutorials on KZbin are outdated and/or don't explain things very well.
@10goni
@10goni 7 жыл бұрын
Vena text tutorials are the way to go though.
@fountainwindmill
@fountainwindmill 7 жыл бұрын
CAPSLOCK yeah, I know. It's just that my attention span has decreased significantly because of all the modern tech. I own the OpenGL red book though, so if I ever get stuck or something I can read about it.
@berkeleymorrison
@berkeleymorrison Жыл бұрын
its so fun learning opengl with harry styles
@catorials444
@catorials444 4 жыл бұрын
I have, no doubt infinite respect for this guy.
@johnnyenglish3503
@johnnyenglish3503 2 жыл бұрын
15:19 this is the most helpful thing ive learnt in programming thank you so much
@M-ksim_YT
@M-ksim_YT 17 күн бұрын
You are the only one who I was able to create an OpenGL window without any problems and errors.
@deeplearner2634
@deeplearner2634 5 жыл бұрын
after coding the triangle, the build works but when I run it, no triangle... what could be the problem?
@DanielArnett
@DanielArnett 5 жыл бұрын
Make sure you copied the numbers at 18:55 properly.
@LosfrogerX
@LosfrogerX 4 жыл бұрын
I had to cast the numbers to GLfloat like this: glVertex2f(GLfloat(-0.5),GLfloat(-0.5));
@xeliani.7809
@xeliani.7809 4 жыл бұрын
@@LosfrogerX All you need is : glVertex2f(.5f, .5f); the .5f instead of casting
@zhyyn2054
@zhyyn2054 4 жыл бұрын
Had the same issue turns out I had written glEnd; instead of glEnd();
@MrBmxerFTW
@MrBmxerFTW 7 жыл бұрын
I'd just like to thank you for making the process of setting up opengl so simple, while simultaneously learning extremely important aspects of c++ development.
@623-x7b
@623-x7b 5 жыл бұрын
g++ k.cpp -Iincludepath -Llibpath -lglfw3 -lopengl32 -lgdi32 you put your paths after -I and -L as shown above. I for include and L for library. Note that even though it's called libglfw3.a gcc you only need to type -lglfw3 into gcc. This is for the windows 64bit version of glfw. I was stuck on this so hope this helps.
@CreepyMemes
@CreepyMemes Жыл бұрын
-l:libglfw3.a also works
@theblinkingbrownie4654
@theblinkingbrownie4654 4 жыл бұрын
20:25 lmao the subtitle guy gave the patreon of scishow.
@altermetax
@altermetax 7 жыл бұрын
On Linux you don't actually have to compile. Almost every Linux distribution allows to install glfw for development use with a command as simple as apt install glfw-dev or pacman -S glfw. Don't know about Mac though.
@farestp5441
@farestp5441 7 жыл бұрын
altermetax thanks bro
@epocfeal
@epocfeal 6 жыл бұрын
thanks!
@TheGrimravager
@TheGrimravager 6 жыл бұрын
lel, good point. I tried that first with just apt-get install glfw didn't work so was like fuck it got cmake and then used make to compile glfw, that was fucking cool to watch :D
@LemonChieff
@LemonChieff 6 жыл бұрын
On mac just use: `brew install glfw` If you don't have brew google is your friend also WTF are you doing?
@G33KN3rd
@G33KN3rd 5 жыл бұрын
for ubuntu, it's "apt-get install libglfw3 libglfw3-dev"
@davidpike766
@davidpike766 6 жыл бұрын
Your clarity is your strength, thank you for the videos Cherno
@kinochdotcom
@kinochdotcom 3 жыл бұрын
I had avoided this series because most tutes spend 15 mins trying to tell me what the difference in a char and an int is or an hour long talk on CALLBACKs. I should have known you would get straight to the point. Look forward to finishing this series and get up to date on what all is happening now with OpenGL. Thanks for all you do and I wish you success in your endeavors.
@calumjohndiprose1809
@calumjohndiprose1809 6 жыл бұрын
This is looking like it's going to be a great series! can't wait to get stuck in
@nickbryan894
@nickbryan894 Жыл бұрын
Dude thank you so much ive been trying to get this running for 3 days and your video had me up and running in 30 minutes
@thebigpaff
@thebigpaff 6 жыл бұрын
TheCherno should have 1m subs, not 100k, good job, keep it up
@jackwo95
@jackwo95 5 ай бұрын
Awesome tutorial, straight to the point. You explain everything so clearly, you are saving my life!
@SantiRodriguezRuiz
@SantiRodriguezRuiz Жыл бұрын
I'm following this video series but using Linux, which makes it a bit challenging. But I found that ChatGPT has been very useful to find out how to link the libraries and generally make the triangle appear. I just prompted "how do I draw a triangle with glfw in opengl in C++ under linux" and it gave me what to write (which is the same Yan is describing in the video), and which parameters to use on the compiler.
@denilsongabriel1890
@denilsongabriel1890 4 жыл бұрын
mas allá de hacer un triangulo.. aprendí muchas cosas que daba por sentado. Gracias TheCherno!
@chastitywhiterose
@chastitywhiterose 3 жыл бұрын
I followed this step by step with Visual Studio 2019 and got it working! This is the most success I've ever had with Visual Studio. It's so big and hard to navigate.
@shambhav9534
@shambhav9534 3 жыл бұрын
4:55 "Non trivial" Those are the scariest words one can hear while trying to install something and make a tech related thing work.
@shambhav9534
@shambhav9534 3 жыл бұрын
Well, I just used SDL instead of using 10 small libraries, which is way easier and way easier to set up.
@tolgask2812
@tolgask2812 3 жыл бұрын
I kinda like the keyboard sound in the video. I've never realize it in dev videos. It gives a quite satisfaction.
@sirrhynus4280
@sirrhynus4280 7 жыл бұрын
For everyone who is serious about learning OpenGL: UDPDATE YOUR DRIVERS!!! DO IT!!
@strange7089
@strange7089 7 жыл бұрын
and how to do that ???
@sirrhynus4280
@sirrhynus4280 7 жыл бұрын
Go to the site of your graphics card provider and download their latest driver/updater for your gpu.
@TheVopi
@TheVopi 7 жыл бұрын
Strange ! Probably Intel I imagine.
@StarForgers
@StarForgers 6 жыл бұрын
@@TheVopi Intel does cpu only to my knowledge.
@Supafly6420
@Supafly6420 6 жыл бұрын
@@StarForgers Intel have their own graphics drivers for their onboard graphics that are mostly built in to the motherboards. Intel Graphics
@hodotsofficial
@hodotsofficial 3 жыл бұрын
18:54 it doesn't render triangle to me
@bkovacs6
@bkovacs6 7 жыл бұрын
Intelligence displays itself by able to explain clearly and simply like Cherno does.
@kevinpacheco8169
@kevinpacheco8169 6 жыл бұрын
For those using Eclipse CDT C/C++ IDE on Mac OS X To add include folder to Eclipse 1.) Right Click on your project -> Properties 2.) Navigate to C/C++ General -> Paths and Symbol 3.) At the top change configuration -> [All Configurations] 4.) Under the Languages click on GNU C++ 5.) On the right click on Add i.) Click on workspace if you added the include folder into your project (which you should) ii.) Click on File System if the include folder is located outside the project directory 6.) Click ok 7.) Apply Add static library after CMake and make Part 1 adding the Library 1.) Right Click on your project -> Properties 2.) Navigate to C/C++ General -> Paths and Symbol 3.) At the top change configuration -> [All Configurations] 4.) Click on Libraries 5.) Click on Add 6.) Type in the name of the library WITHOUT 'lib' as a prefix AND '.a' as a suffix. Example if the lib is called 'libglfw3.a' type glfw3. Part 2 linking the library's location 1.) Right Click on your project -> Properties 2.) Navigate to C/C++ General -> Paths and Symbol 3.) At the top change configuration -> [All Configurations] 4.) Click on Library Paths 5.) On the right click on Add i.) Click on workspace if you added libglfw3.a into your project (which you should) ii.) Click on File System if the location of libglfw3.a is located outside the project directory 6.) Click ok 7.) Apply Add OS X frameworks 1.) Right Click on your project -> Properties 2.) Navigate to C/C++ Build -> Settings 3.) At the top change configuration -> [All Configurations] 4.) Navigate to MacOS X C++ Linker -> Miscellaneous 5.) In the Linker Flags text field add -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo 6.) Apply
@davep7176
@davep7176 2 жыл бұрын
I've haven't had to do this for many years (since I have been working in Unity and Unreal game engines mostly) and I forgot how annoying it was. I used to do these links all the time without even thinking but I never really even understood exactly what it was all doing. All the extra info you provide along the way in this video was very helpful to me. Thanks.
@alexjulius69
@alexjulius69 2 жыл бұрын
I've been always typing code myself off the screen of a tutorial, you're right, this is the best way to learn.
@tranxuanuc9509
@tranxuanuc9509 4 жыл бұрын
This video is so great. Thanks for this series!!
@spicytuna08
@spicytuna08 6 жыл бұрын
Everything compiles and links but I am f getting: Unhandled exception at 0x00FA7F50 in OpenGL VS.exe: 0xC0000005: Access violation reading location 0x00000280. does anyone know why?
@DAToft
@DAToft 4 жыл бұрын
Thank you, thank you, thank you! You are a godsend! I'm trying to get GLFW to work with VS Code, but the tutorials out there right now are few, far between, and often outdated. I was able to use this video to transfer the linking over into VS Code, and after 2 days of struggling with this, it's finally working! Thank you so much
@kajalsanklecha267
@kajalsanklecha267 4 жыл бұрын
Can you elaborate on how you got it working, please?
@gc-0377
@gc-0377 3 жыл бұрын
I love you Cherno, Now I'm taking a Computer Graphics in the Univesity and this saved my life, thnks bro you are awesome
@arthshah94
@arthshah94 5 жыл бұрын
Keep up the good work man. Thanks for explaining the concepts from Scratch.
@callmejobson
@callmejobson 8 ай бұрын
I just want to say THANK YOU!!! YOU make learning this so easy!! I only wish I would have found you sooner!!
@jamesm7414
@jamesm7414 3 жыл бұрын
Very impressed that I did this tutorial and it all works first go!
@dimitar45802
@dimitar45802 2 жыл бұрын
Really good video! You are the best teacher! I have Webgl in university but was curious to try Opengl, also, these were my first lines of c++ code, thank you!
@spytec3408
@spytec3408 5 жыл бұрын
10:20 so should I use the vs 2017 lib in the more updated GLFW, or keep using the 2015 lib?
@moviemaker1220
@moviemaker1220 7 жыл бұрын
I have copied exactly what is done in this video, but my window does not open when I run the application, any thoughts on why?
@IndellableHatesHandles
@IndellableHatesHandles 4 жыл бұрын
As someone who wants to capitalize off his new free time during the pandemic, this series is amazing.
@Seiseary
@Seiseary 4 жыл бұрын
yeah
@Sonic-9201
@Sonic-9201 2 ай бұрын
If you have issues with when your red squiggly lines go away and you still can't compile like he does at 13:45, keep watching the video. When he begins checking for errors, you will be able to resolve these issues. I would run it and it would give me compile errors, but that was because how I have VS 2022 set up, it builds when I run the code.
@rajasparanjpe3791
@rajasparanjpe3791 5 жыл бұрын
I like how he is organized with his videos and playlists.
@asura-2467
@asura-2467 2 жыл бұрын
-_- Everything went over my head. I think things might get clearer as i go down on playlist. Thanks for the video ,Sir!
@numaanjaved
@numaanjaved 4 жыл бұрын
its really good to create something from scratch, i learned from it, and i need to do it every time i create something, until and unless i master it .. good stuff
@frogstair
@frogstair 5 жыл бұрын
So glad I found this channel!
@pch1511
@pch1511 7 жыл бұрын
Can't wait for the rest of this tutorial!
@abdullahhaidar3658
@abdullahhaidar3658 5 жыл бұрын
Thank you dude so much , this the first time I tried something that worked for the first time without any trouble
@vectoralphaSec
@vectoralphaSec 2 жыл бұрын
Thank you Cherno for making this tutorial i look forward to learning OpenGL. Although i honestly would have preferred if you just made a tutorial for linux users on how to install and set up GLFW because i spend several hours trying to figure out how it even works or how to build and install it. Thankfully i used ChatGPT to help me and solve the problems and got the window and triangle to render on screen. Anyway looking forward to the rest of the series. Hopefully nothing else breaks along the way. lol
@adityatiwari3646
@adityatiwari3646 18 күн бұрын
Damm mann thiss man 😭⭐ Legitt thanksss a lottttt ⭐
@h.hristov
@h.hristov 7 жыл бұрын
Followed along, got a triangle on my screen. Thanks Cherno! Really excited for this series
@coldkip
@coldkip 6 жыл бұрын
For installing on linux sudo apt-get install cmake xorg-dev libglu1-mesa-dev cd glfw-3.2.1 cmake -G "Unix Makefiles" make sudo make install
@ericrogers3637
@ericrogers3637 6 жыл бұрын
If you are using ubuntu To install glfw3: sudo apt-get install libglfw3* you might also need to install these lib "mesa-utils" " freeglut3-dev" To compile: g++ *.cpp -lglfw -lGL -o run To run: ./run
@Влад24
@Влад24 5 жыл бұрын
That is why i love linux
@Redmile2006
@Redmile2006 5 жыл бұрын
I'm confused about something. Everything works, but when you said we had to link against the opengl library at 15:08, we added that library called opengl32.lib, so where is that file coming from? It wasn't part of the GLFW library that we downloaded and it's not in our dependencies folder. Does it come with Windows?
@obadacharif1744
@obadacharif1744 5 жыл бұрын
I've the same problem, it didn't work for me !
@ahbarahad3203
@ahbarahad3203 4 жыл бұрын
its a standard library that comes with windows i think just like shell32.lib and User32.lib
@drewbruggman
@drewbruggman 5 жыл бұрын
At around 9:18 you said you’d provide a link to a video about static libraries or whatever. Just thought you could use a notification. Just finding out about your series. Love your work dude!
@EmilianoC76
@EmilianoC76 6 жыл бұрын
Have you tried setting OpenGL for Visual Studio Code?
@kmcasi2037
@kmcasi2037 3 жыл бұрын
Finally, after 6 hours of searching on forums and different websites with out resoults... I found this video and is still working and with VS '19 :)
@sutoreikyatto
@sutoreikyatto 5 жыл бұрын
mines keep on saying that it cant find my glfw/ glfw3.h
@darcymckenzie
@darcymckenzie 5 жыл бұрын
did you find a solution for this because im pulling my hair out at this error now
@loophi3589
@loophi3589 4 жыл бұрын
@ornella banze Use absolute dir path
@Achouakos
@Achouakos 4 жыл бұрын
@Lightning_A i've tried alot of suggestions, and this one also, but it still not working! :/
@anushkasubedi2883
@anushkasubedi2883 4 жыл бұрын
@@Achouakos Were you able to solve it?
@lordender_kitty_official
@lordender_kitty_official 8 ай бұрын
this helped clear up a lot of confusion for me. im looking to make minecraft shaders and, like plugins, there's almost nothing simple to start learning it. except shaders are way harder than plugins.
@akashsinghdahiya5862
@akashsinghdahiya5862 3 жыл бұрын
Good Work particularly resolving the errors related to dependencies👍🏼.
@mikicerise6250
@mikicerise6250 2 жыл бұрын
I'm on Linux and using clang++ and Make, so far removed from the Visual Studio configuration environment on Windows, but you totally demystified linker errors for me with your "welp, let's look for the missing library" approach... I got it up and running in a few minutes as soon as I saw you breeze through those linker errors by just asking, "what library has this function?". Thank you for all you do, Cherno! :)
@IndellableHatesHandles
@IndellableHatesHandles 4 жыл бұрын
I just compiled GLFW from source. Awesome!
@stevensmith9584
@stevensmith9584 Жыл бұрын
I get this warning: LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library. Any ideas how to resolve this? Anyone???
@adrielbradley6677
@adrielbradley6677 Жыл бұрын
I got the same thing. Did you ever figure it out?
@manojpradhan943
@manojpradhan943 9 ай бұрын
@@adrielbradley6677 any update ?
@pradeepalhan
@pradeepalhan 4 жыл бұрын
I am setting up in xcode@mac ... although my code compiled, I did not get a triangle. Why we did not specify the color for the triangle ? or the border etc. one explanation that I could think of is that this is traditional openGL as explained. But bottom line I get a black screen.
@dot32
@dot32 3 жыл бұрын
same! no triangle for me either! i think it may be related to macos not supporting legacy openGL? But i really don't know :(
@ciankiwi7753
@ciankiwi7753 4 жыл бұрын
when i saw the video length i thought this guy was gonna drag on forever about meaningless stuff, but no! i learnt alot from all the explanations and it was paced very well!
@jacobhaig2372
@jacobhaig2372 7 жыл бұрын
The only videos I'm excited for! Notification squad FTW
@noiredelune174
@noiredelune174 4 жыл бұрын
I'm really impressed... and so glad your'e doing these videos!! You make things so clear and fun! Respect! \m/
@suryakarmakar4240
@suryakarmakar4240 3 жыл бұрын
Is there any better alternative than glfw? Also writing window management libs on our own for each platform have any performance benefits?
@navidzaboli2710
@navidzaboli2710 7 жыл бұрын
You should make a tutorial about OpenGL Particle Systems :) They're so fun and satisfying to watch, and there's not really any good tutorials about it on KZbin :) P.S Big fan, love your videos.
@gamesniper98
@gamesniper98 3 жыл бұрын
If linking doesn't work and visual studio isn't recognizing your header files (AKA: you're still getting squiggly lines) try adding "yourProjectName\" before decencies. To make sure it works under properties click on edit and then paste that long directory under evaluated values into your file explorer.
@esiv5622
@esiv5622 2 жыл бұрын
Didn't realize I put dependencies into a second folder by the same name as the project one. Thank you for pointing this out!
@TheGrimravager
@TheGrimravager 6 жыл бұрын
4:59 you just hate linux :p not a single problem, the guide they provided was very clear and easy to understand^^
@vivekpanchagnula815
@vivekpanchagnula815 4 жыл бұрын
most distros have it in their package manager tho
@shreyjain51
@shreyjain51 4 жыл бұрын
Hey I am not able to make triangle. The code doesnt show any error, but shows just a black window.
@Bereseker
@Bereseker 3 ай бұрын
19:43 And! Read the documentation.
@storianostorianov3955
@storianostorianov3955 3 жыл бұрын
Awesome video. Greatly and calmy explained complex concepts. Thanks!
@Jkauppa
@Jkauppa 2 жыл бұрын
how complex the explanation, the hard the thing you are trying to teach, simple is really simple
@Jkauppa
@Jkauppa 2 жыл бұрын
as said, opengl itself is trash, if you need an ui-api on top
@Jkauppa
@Jkauppa 2 жыл бұрын
yea, why are you letting yourself into a trash job
@Jkauppa
@Jkauppa 2 жыл бұрын
opengl is bloatware
@Jkauppa
@Jkauppa 2 жыл бұрын
x64 is the default
@Jkauppa
@Jkauppa 2 жыл бұрын
you used 1min to talk about 32bit, meh
@mayanmaster92
@mayanmaster92 4 жыл бұрын
So I'm getting an error. Went through the steps twice and I still get the same error. At 13:46 my program crashes with this notification: Unable to start program 'C:\Users injosh\source epos\OpenGL\Debug\OpenGL.exe'. I don't know why it's looking for .exe btw. I don't recall making one
@TheXenaFilms
@TheXenaFilms 5 жыл бұрын
On mac : 2 Ways **************** To build the GLFW library from source, only a few steps are required: Download and extract the GLFW source code. Open the Terminal. cd to the extracted directory. Type in cmake . hit return. A Makefile will be created for you. Type in make, hit return. After the compilation process, type in sudo make install. The libraries will be copied to /usr/local/lib/, the header files to /usr/local/include/. Note: You'll need a compiler suite installed to build software, this would usually be the XCode Command Line Tools package. For this, install and launch XCode from the Store or download the tools from the developer site. **************** Now if you're comfortable at the command line: brew install glfw when compiling with openGL and glfw, use "g++ main.cpp -lglfw" for the most minimalistic build if you don't have brew google is your best friend
@h.hristov
@h.hristov 7 жыл бұрын
What's this linker warning, tho: LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
@Raymoclaus
@Raymoclaus 7 жыл бұрын
I fixed this by getting the 32-bit glfw and making sure I was on Win32 in the configuration properties and also using x86 next to the Local Windows Debugger button. On top of that, double check that when you were making changes in the configuration properties you were using "All configurations" like the video said. Even though my computer can run 64 bit applications, I think my installation of Microsoft VS might have been in 32 bit. By searching google the warning tells me that this happens when libraries are being linked by conflicting runtime libraries and that you shouldn't mix Debug and Release mode. I won't say I completely understand it myself but maybe that helps you.
@143HawkBlack
@143HawkBlack 7 жыл бұрын
For anyone in the future who wants to know how to suppress this error (and maybe fix it as how Raymoclaus explains), goto the Solution properties > Linker > Command Line and in the Additional arguments type what the warning states: /NODEFAULTLIB:msvcrt and the linker will ignore the small inconsistency.
@mathematoligiser-iserist2007
@mathematoligiser-iserist2007 6 жыл бұрын
When I tried to compile it said: 1>LINK : fatal error LNK1104: cannot open file 'glfw3.libkernel32.lib' Any help?
@coolian258
@coolian258 6 жыл бұрын
you forgot a ;
@valizeth4073
@valizeth4073 6 жыл бұрын
#pragma warning (disable: 4098)
@adam3416
@adam3416 6 жыл бұрын
has the video you were talking about at 13:29 actually been made yet?
Using Modern OpenGL in C++
18:21
The Cherno
Рет қаралды 438 М.
Why Didn't He Get the Job? Let's Find Out! // Code Review
27:25
The Cherno
Рет қаралды 155 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 114 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 2,4 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 28 МЛН
Introduction to shaders: Learn the basics!
34:50
Barney Codes
Рет қаралды 369 М.
Creating a Window using C++ and Win32 | Tutorial
23:10
Aerideus
Рет қаралды 96 М.
Dealing with Errors in OpenGL
23:42
The Cherno
Рет қаралды 119 М.
Stack vs Heap Memory in C++
19:31
The Cherno
Рет қаралды 583 М.
Writing a Shader in OpenGL
28:21
The Cherno
Рет қаралды 321 М.
WHY did this C++ code FAIL?
38:10
The Cherno
Рет қаралды 297 М.
Using Libraries in C++ (Static Linking)
18:43
The Cherno
Рет қаралды 450 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 114 МЛН