Debugging Your OpenGL Code // Tips & Tricks!

  Рет қаралды 6,758

OGLDEV

OGLDEV

Күн бұрын

In this video I describe several methods that you can use in order to debug your OpenGL code, on the application side as well as on the shader side.
If you are not familiar with STB image you can check out my texture mapping tutorial at: • Basic Texture Mapping ...
Get the stb_image_write.h from my git repo below or from the original location: github.com/nothings/stb/blob/...
Online resource on debugging: learnopengl.com/In-Practice/D...
Make sure to watch all the previous tutorials in the "OpenGL For Beginners" playlist at • OpenGL for Beginners
Please visit ogldev.org to see more of my tutorials on modern OpenGL.
Link to source: github.com/emeiri/ogldev/
OpenGL 4.6 specification: www.khronos.org/registry/Open...
Feel free to comment below.
Timecodes
0:00 Intro
0:34 Method #1: glGetError()
3:49 Method #2: Debug Context
9:09 Method #3: External Tools
12:25 Method #4: Geometry first, pixel second
15:11 Method #5: Use the framebuffer for step by step debugging
16:57 Method #6: Read the framebuffer values
19:12 Conclusion
Email: ogldev1@gmail.com
Facebook: / ogldev-188319114585587
GIthub: github.com/emeiri/ogldev.git
Twitter: @ogldev
One time donations (Paypal): ogldev.org/donate.html
Patreon: / ogldev
My gear (Amazon affiliate links):
Camera - Canon EOS M50: amzn.to/3duVIOh
Camera mic - Rode Videomic: amzn.to/3dsGVDs
Desktop mic - Rode NT-USB-Mini: amzn.to/3giMoif
Credits:
Video by cottonbro from Pexels
Video by Artem Podrez from Pexels
Video by Atakan Ozkan from Pexels
Video by Mikhail Nilov from Pexels
Image by Clker-Free-Vector-Images from Pixabay
Image by Gustavo Rezende from Pixabay
Image by Schmidsi from Pixabay
Sounds effect by Patricia Celso (youtube)
Sound effects by CLEREMTV (youtube)
Music: "Behold the Sun" by Topher Mohr and Alex Elena (youtube audio library)
Enjoy,
Etay Meiri
#opengl #ogldev #opengtutorials

Пікірлер: 49
@onogrirwin
@onogrirwin 8 ай бұрын
holy shit this works so much better than the ole "Stare at the monitor until random quantum fluctuations results in the solution manifesting itself to you" method.
@OGLDEV
@OGLDEV 8 ай бұрын
The quantom fluctuations based debugging tutorial is planned for the future ;-)
@FrankGennari
@FrankGennari 2 жыл бұрын
This tutorial was very useful, thanks! I've been working with OpenGL for years now and some of these techniques are ones I wasn't aware of or haven't thought of.
@OGLDEV
@OGLDEV 2 жыл бұрын
You're welcome!
@serheiartuh8308
@serheiartuh8308 2 жыл бұрын
I’ve been working with OpenGL for years. Debugging this black box is always a rocky road. Thank you for this tutorial, I found out a lot of new.
@OGLDEV
@OGLDEV 2 жыл бұрын
Great, thanks :-)
@kumu2024
@kumu2024 Жыл бұрын
I don't remember exactly how I found you. I had a BIG problem as I am learning OpenGL (modern). But your video and the comment down saved me and I could after some days find all issues I had. So, thank you very much.. If I could find this video earlier for sure I could resolve my issues also earlier. Thank you very much.
@OGLDEV
@OGLDEV Жыл бұрын
Glad it helped!
@user-ub7zn9ls2f
@user-ub7zn9ls2f Жыл бұрын
You saved a tonns of hours for me, thx
@OGLDEV
@OGLDEV Жыл бұрын
Glad to hear :-)
@TaliPerry1
@TaliPerry1 2 жыл бұрын
Well done! Great video!
@OGLDEV
@OGLDEV 2 жыл бұрын
Thanks!
@lucpena
@lucpena 2 жыл бұрын
Thank you for this video!
@OGLDEV
@OGLDEV 2 жыл бұрын
Glad you like it :-)
@battosaijenkins946
@battosaijenkins946 2 жыл бұрын
Very useful thank you sir! 👍
@OGLDEV
@OGLDEV 2 жыл бұрын
Thanks for watching!
@PaulEmsley
@PaulEmsley 2 жыл бұрын
This is great! I wish I'd seen it 2 years ago :-)
@OGLDEV
@OGLDEV 2 жыл бұрын
Me too! I wish I started earlier ;-)
@Agent_Ax
@Agent_Ax 2 жыл бұрын
Thanks, this would be useful!
@OGLDEV
@OGLDEV 2 жыл бұрын
Glad you think so!
@VictorGordan
@VictorGordan 2 жыл бұрын
Very nice thumbnail!
@OGLDEV
@OGLDEV 2 жыл бұрын
Thanks bro!
@gokalpates1567
@gokalpates1567 2 жыл бұрын
Thanks for ur video. I really recomend renderdoc to people who encounter problems. It is awesome.
@OGLDEV
@OGLDEV 2 жыл бұрын
Thanks for the tip!
@kumu2024
@kumu2024 Жыл бұрын
Gökalp, cok tesekkur abim. You saved me really. Thanks
@gokalpates1567
@gokalpates1567 Жыл бұрын
@@kumu2024 You are welcome :)
@user-mu8kp6mm4q
@user-mu8kp6mm4q 2 жыл бұрын
wonderful couse
@OGLDEV
@OGLDEV 2 жыл бұрын
Thanks!
@PaCCKal
@PaCCKal Жыл бұрын
My compiler can't resolve glDebugMessageCallback() and glDebugMessageControl(). Do I need some additional package?
@OGLDEV
@OGLDEV Жыл бұрын
These functions were introduced in OpenGL 4.3. What OS are you using? Did you setup GLEW correctly?
@MrFacciolone
@MrFacciolone Жыл бұрын
I could not install APITRACE, it seems the package used to exist but not anymore, on install I get "unable to locate package" and even looking apitrace up in the ubuntu repository gives no result. I tried first to install it by cloning the git repository and following instructions, it installed without problem and the apitrace command works, but the command for gui qapitrace isn't available anyway. Same as with apitrace, the bash suggest installing the apitrace-gui package that no longer exists. I looked into it in docs and found out that Qt version 5.2.1+ is required, but I struggle to find a way to install it.
@MrFacciolone
@MrFacciolone Жыл бұрын
After some more digging I find out a way to install QT5, supposedly the problem was due to ubuntu 21.04+ missing qt5 packages.. after that I could finally reinstall apitrace with the gui: Now it works! :) Extremely useful tool I am amazed, makes it a lot more easy to understand what's going on
@OGLDEV
@OGLDEV Жыл бұрын
That's great to hear. I was just about to suggest that cmake must have found that you are missing a package that prevents it from installing the gui. It's unfortunate that it is no longer being maintained but I still find it very useful for development. Hopefully I'll be able to find some time to learn the tools by NVIDIA/AMD/Intel.
@MrFacciolone
@MrFacciolone Жыл бұрын
@@OGLDEV Yeah but it's straightforward so it requires no learning curve, and you can dissect a trace with just a couple commands from the bash. Overall I see no reason to switch until apitrace seriously starts lagging behind maintenance-wise. As always, great tutorial. Expecially the youtube version, it's the best OpenGL series of tutorials out there, it allows to build a very well coded general purpose framework, and this helps greatly in following the tutorial because it's not just self-serving excercises, the code used for this tutorial is already very well suited to run big scale applications with just a few changes. And it goes without saying, the most useful alternative tutorials I found are walltexts of code with interspersed explications, while yours has working demos, code explanations and video. Thanks for the series
@OGLDEV
@OGLDEV Жыл бұрын
@@MrFacciolone You're welcome :-)
@glowiever
@glowiever 2 жыл бұрын
renderdoc won't work unless with gl context 3.2. my opengl app is using gles 2.0 :( I'll check apitrace
@OGLDEV
@OGLDEV 2 жыл бұрын
According to the website apitrace supports GLES 1.0-3.0. Hopefully it will work.
@MrMariozzz78
@MrMariozzz78 10 күн бұрын
can i use freeglut with opengl 2.0 o more with glsl language? o it work just with glfw?
@OGLDEV
@OGLDEV 6 күн бұрын
Sure, FreeGLUT supports all versions of OpenGL.
@MrMariozzz78
@MrMariozzz78 6 күн бұрын
@@OGLDEV i need Glew o glad too or glut is enough?
@OGLDEV
@OGLDEV 6 күн бұрын
You need either GLEW or GLAD to load the functions pointers. I'm using GLEW. People who follow learnopengl.com usually go with GLAD because this is what the website is using.
@MrMariozzz78
@MrMariozzz78 6 күн бұрын
@@OGLDEV ok thank ,but i don't know how istall glad on codeblock it generata many version of opengl on website
@OGLDEV
@OGLDEV 6 күн бұрын
Hopefully you can find an answer on learnopengl.com or on one of the forums. I've never tried to use GLAD myself. Was always happy using GLEW so I never tried an alternative.
@prezadent1
@prezadent1 2 жыл бұрын
Glut hasn't been widely used in several years. Neither has header guards.
@OGLDEV
@OGLDEV 2 жыл бұрын
Thanks for the feedback. The windowing library is not that important. My tutorials should work in both FreeGLUT and GLFW. Regarding header guards - I actually still find myself using them on older code every now and then when I need a quick-n-dirty error check. I want the people who are watching the videos to have all the options available and make their own choice, though debug output is definitely the way to go.
@kermalis
@kermalis 2 жыл бұрын
Wow I've been using the DebugMessageCallback without "DebugOutputSynchronous" for months, thanks for that lol
@OGLDEV
@OGLDEV 2 жыл бұрын
You're welcome :-)
Sprite Batching In OpenGL // Uniform Buffer Objects
14:22
An introduction to Shader Art Coding
22:40
kishimisu
Рет қаралды 888 М.
Who enjoyed seeing the solar eclipse
00:13
Zach King
Рет қаралды 137 МЛН
Barriga de grávida aconchegante? 🤔💡
00:10
Polar em português
Рет қаралды 45 МЛН
Кәріс тіріма өзі ?  | Synyptas 3 | 8 серия
24:47
kak budto
Рет қаралды 1,6 МЛН
Зу-зу Күлпәш. Агроном. (5-бөлім)
55:20
ASTANATV Movie
Рет қаралды 512 М.
you need to stop using print debugging (do THIS instead)
7:07
Low Level Learning
Рет қаралды 395 М.
Don't use VSCode
35:31
PyCon South Africa
Рет қаралды 204 М.
When Your Game Is Bad But Your Optimisation Is Genius
8:52
Vercidium
Рет қаралды 1,3 МЛН
A Basic Guide to Debugging OpenGL
11:30
VoxelRifts
Рет қаралды 3,3 М.
How To Render CIRCLES (OpenGL/Vulkan/DirectX/Metal)
39:56
The Cherno
Рет қаралды 94 М.
GRASS RENDERING in OpenGL // Code Review
47:23
The Cherno
Рет қаралды 112 М.
Computer Graphics Tutorial - PBR (Physically Based Rendering)
13:40
Victor Gordan
Рет қаралды 29 М.
Debugging HLSL & GLSL shaders in VS Code
4:04
SHADERed
Рет қаралды 13 М.
Who enjoyed seeing the solar eclipse
00:13
Zach King
Рет қаралды 137 МЛН