Up and running with OpenGL On Ubuntu // OpenGL Tutorial #0

Поделиться
HTML-код
  • Опубликовано: 12 янв 2025

Комментарии • 73

  • @OGLDEV
    @OGLDEV  Год назад +6

    Clone the repo:
    git clone --recurse-submodules github.com/emeiri/ogldev.git
    If you have a directory which was cloned without '--recurse-submodules' you can always get the submodules using:
    git submodule update
    Jan-27, 2023 - I updated the version of GLEW in the install script to 2.2. This matches Ubuntu 22.04 and Linux Mint 21.1.

  • @tculig
    @tculig 3 года назад +11

    Duuuuude! I learned programming with your tutorials years ago! Some of the best stuff out there. Glad to see you on RUclips, looking forward to new content. :)

    • @OGLDEV
      @OGLDEV  3 года назад +2

      Thanks!

  • @SonarSystemsCoUk
    @SonarSystemsCoUk 3 года назад +3

    Nice setup video for Ubuntu, definitely need for Linux content for the community, hopefully we can all provide more.
    Keep it up mate.

    • @OGLDEV
      @OGLDEV  3 года назад

      Thanks, will do!

  • @toksic424
    @toksic424 2 года назад +2

    Just finished the series. Glad I found this channel! Keep up the great work!

    • @OGLDEV
      @OGLDEV  2 года назад

      Thanks, will do!

  • @fab_81
    @fab_81 2 года назад +1

    Thanks for these tutorials, approached C/C++ 2+ years ago, and always wanted to learn graphical programming, especially for emulators and such!

    • @OGLDEV
      @OGLDEV  2 года назад +1

      Thanks and good luck!

    • @fab_81
      @fab_81 2 года назад

      @@OGLDEV I have a question about these APIs, since now vulkan is being updated, is there a possibility in the future that openGL will be deprecated entirely and not included in GPU drivers anymore? Despite Vulkan being a higher level API, i think that openGL it's still better to approach first, but if this step becomes "useless" because of how the market goes, it makes me feel afraid that i've learned something very useful but that it's considered obsolete and i can't use it elsewhere anymore. What's your opinion about this?

    • @OGLDEV
      @OGLDEV  2 года назад +1

      OpenGL is going to live for many years, much longer than most people think. There are two main reasons for it . First, there is so much existing code and systems that depend on OpenGL (not to mention apps that are still running with the deprecated fixed function pipeline) that no one would dare removing OpenGL support from the drivers. Unless they want to lose customers... Second, Vulkan is so much more complex and demands much more effort and experience from the developer that it presents a barrier for many people. If you are not able to get better performance with Vulkan or if you are able to reach your performance target with OpenGL then why make the effort with Vulkan?
      So we may not see great improvements with OpenGL as Khronos is probably focusing most of their effort on Vulkan but we won't see OpenGL going away any time soon. Anyway, I think the most important thing when you learn 3D graphics (doesn't matter whether it is OpenGL or DirectX) is the math, the algorithms and the whole understand of how the pipeline works and how a frame is actually created. This knowledge will continue to serve you in any API. Just my two cents...

    • @fab_81
      @fab_81 2 года назад

      @@OGLDEV Thank you for the clarification and the quick response, it has been very useful

  • @Tinycode779
    @Tinycode779 2 года назад +1

    Thanku soo much for uploading such content for free.🙏🙏

    • @OGLDEV
      @OGLDEV  2 года назад +1

      My pleasure :-)

  • @laurentbedief2199
    @laurentbedief2199 3 года назад +1

    Merci pour tous ces tutos !!!

    • @OGLDEV
      @OGLDEV  3 года назад

      De rien!

  • @fab_81
    @fab_81 2 года назад +1

    Hi, i've been following your tutorials, so far so good! but a few tips for the future tutorials:
    -Instead of using ogldev library, which makes things more complicated to compile, use the glm libraries, those are available as packages via apt/pacman as well on Linux and will be easier to include them.
    -For the matrixes, it's much easier to handle them with glm::mat functions, glm::scale/glm::rotate/glm::translate, and their implementation in the library it's well disposed
    -Update the tutorials to use GLFW/SDL2, freeGLUT despite being optimal at handling window context, it's pretty outdated.

    • @OGLDEV
      @OGLDEV  2 года назад +3

      Thanks for the feedback. I highly recommend people who are starting to develop 3D graphics using OpenGL not to use GLM. Not that there's anything wrong with the library itself. The point is that I believe that you have to understand all the math down to the smallest detail (John Carmack calls it "Know it cold") and the best thing for you would be to develop this functionality yourself. At the end of the day most implementations would be very similar because there are not really that many ways to develop a matrix class, for example. It's important to make sure that you understand everything and you are in control of everything. If down the road you want to use GLM because you find it easier to get your project quickly up and running that's perfectly fine, but at least make sure you understand everything that is going on under the hood. I simply find it easier to switch from the math theory to the very short math classes that I developed that implement just what I need (e.g. GLM supports both RH and LH coordinate systems and I don't need that). So you should use my code just as a reference and develop your own version with the naming and API that make more sense to you. Switching to GLM later shouldn't be a problem. BTW, not sure I understand what compile problem you encountered because my math classes are part of the code base. Maybe it's another library?
      BTW2 - I am thinking about a GLM tutorial at some point because obviously people are interested in it. It's in the todo list which keeps getting longer. I'm only able to produce a video once every 2-3 weeks so I haven't found the time for it yet.
      Regarding FreeGLUT - on tutorial 31 (picking) I switched to GLFW. When I started the channel it was easier for me to use the codebase from my website and FreeGLUT was still very popular at 2010. Honestly I don't think it matters much because the actual OpenGL code remains the same but I decided to go with the flow so that people won't get the impression that my tutorials are out of date.

    • @fab_81
      @fab_81 2 года назад

      @@OGLDEV i understand the point of view about "make it by yourself", and in fact it helped me a lot in understanding how a manual matrix, and glm matrixes actually work, knowing matrix multiplication between other matrixes/vectors helps a lot with this too, i try to make code simpler to write only once i fully understood the basics behind it, and just to be sure i have documented the examples made with the formulas etc. Sometimes i replicate the glm matrix implementation into a paper and do the calculations just to be sure. By the way if you're planning to do a GLM/GLFW tutorial, i have reworked all of your first examples with it, my idea would be to still keep the same video base (showing formulas, etc), then show the glm library implementation of the matrixes/vectors (and others if needed), and as a final step the code implementation.
      I'm sharing these on my github page to not loose them just in case. If you are interested i can give you the link, the documentation in the source code might result a bit redundant, it's thinked to let understand in detail for a user how it works, not only with glm functions but openGL funcitons too.

    • @OGLDEV
      @OGLDEV  2 года назад

      Sure, it will be great to add a link to your code on the website and on relevant videos. Thanks!

  • @KinderJaay
    @KinderJaay 3 года назад +1

    Great work @Emeiri. I am happy that you are doing this series of OGL tutorials. It will help those who are interested in learning Open GL .
    Do you also have any plan to do tutorials on Vulkan as well ?

    • @OGLDEV
      @OGLDEV  3 года назад +2

      Thanks! In general I plan to do a series on Vulkan but not in the near future. Hope to get there eventually.

    • @KinderJaay
      @KinderJaay 3 года назад

      @@OGLDEV ok thanks I will wait for your vulkan series too 👍

    • @OGLDEV
      @OGLDEV  3 года назад +2

      @@KinderJaay I hope to be able to start with Vulkan in a couple of months.

  • @TaliPerry1
    @TaliPerry1 3 года назад +1

    Great video, thanks!

    • @OGLDEV
      @OGLDEV  3 года назад +1

      Thank you!

  • @samueleb.6739
    @samueleb.6739 3 года назад +3

    Hi, first of all, thank you for your tutorials. I'm really interested in how to write compute shaders, are they meant to be a part of your tutorials? Thanks in advance.

    • @OGLDEV
      @OGLDEV  3 года назад +1

      Compute shaders are not planned for the near future as I'm more focused on the graphics tutorials. You are most welcomed to watch them ;-)

  • @renzhixiong4660
    @renzhixiong4660 2 года назад +1

    Cool Job!!!💯

  • @vbessonow
    @vbessonow 3 года назад

    glutDisplayFunc(RenderSceneCB); // if glutDisplayFunc(RenderSceneCB) is commented out glutIdleFunc(RenderSceneCB) will work and draw element with no issue. Is it necessary to have glutDisplayFunc function starting from Tutorial 5?
    glutIdleFunc(RenderSceneCB);// if glutIdleFunc commented out - only first frame is drawn

    • @OGLDEV
      @OGLDEV  3 года назад

      I used to use glutInitFunc but I'm slowing phasing it out in favor or glutDisplayFunc+glutPostRedisplay as I'm creating the video tutorials. According to www.opengl.org/resources/libraries/glut/spec3/node63.html the idle function is more for background processing that should not take a long time to complete. Even if doing the rendering there works it may not be the recommended way of working with glut.

  • @tommybollman4546
    @tommybollman4546 4 месяца назад

    Hello. Running your build_all.sh script today, seems that you have removed "3dparty/meshoptimizer/src/meshoptimizer.h". No biggie really, I should be able to fix it, but just telling you it is missing.

    • @OGLDEV
      @OGLDEV  4 месяца назад

      Thanks. This is actually a submodule so if you didn't clone the repo with '--recurse-submodules' you need to run 'git submodule update' to get it.

  • @herickson4683
    @herickson4683 10 месяцев назад

    Support for password authentication was removed on August 13, 2021
    What it means?

    • @OGLDEV
      @OGLDEV  10 месяцев назад

      github is no longer accepting a username/password. You have to create a token. You can google that message and it will show you how to do that.

  • @toonagafonov
    @toonagafonov 2 года назад

    Have this issue during installing requirements:
    Can somebody help me to resolve it?
    Thanks
    The following packages have unmet dependencies:
    libmagick++-dev : Depends: libmagick++-6.q16-dev but it is not going to be installed

    • @OGLDEV
      @OGLDEV  2 года назад +1

      Hi Anton, what distribution and version are you using? This is working on my Linux Mint 20.3 but I guess not everywhere. Actually, I switched from imagemagick to stb image so this library is no longer required. You can just drop it from the script and rerun it. I will do the same.

    • @toonagafonov
      @toonagafonov 2 года назад +1

      @@OGLDEV Thanks for your fast answer. Worked for me to install by dropping imagemagic.Thanks

    • @OGLDEV
      @OGLDEV  2 года назад +1

      @@toonagafonov Great :-)

    • @toonagafonov
      @toonagafonov 2 года назад

      @@OGLDEV all works. Thanks

  •  Год назад

    Hi, so how come you didn't have any problems with x11?

    • @OGLDEV
      @OGLDEV  Год назад

      The latest Linux distributions usually provide a mechanism for installing the GPU drivers that are provided by the vendor. These drivers should take care of X11 problems. In the past I did encounter such problems when I used the Mesa3D drivers but in recent years I haven't. Are you referring to a specific error message?

    •  Год назад

      @@OGLDEV hi! Thank you for answering. So, I am trying to make it work with autottools on linux mint. I installed linux few weeks ago and I cant say that I am enjoying :) but to get to the point, I have amd radeon and I got glfw and tried to compile with autotools but when I try I get many linker errors about undefined references mentioning x11_window.c I must confess that I dont know what am I doing.

    •  Год назад

      @@OGLDEV and I would rather use amd drivers...

    • @OGLDEV
      @OGLDEV  Год назад

      First of all, get the AMD Linux drivers up and running. You can find them here: www.amd.com/en/support/linux-drivers. For Linux Mint I guess you should use Ubuntu drivers. I've always used NVIDIA and they provide a very simple installation script so I can't really help with AMD. Hopefully their process is also simple. Regarding GLFW - there's no reason to install it from source, especially if you are a beginner. Use the following command line to install both GLEW and GLFW:
      apt install libglew-dev libglew2.2 libglfw3 libglfw3-dev

    •  Год назад

      @@OGLDEV well, in linux i am a beginner...i believe i installed amd drivers...

  • @AnsonSavage
    @AnsonSavage 2 года назад

    It seems that libglew2.2 is now required in Ubuntu 22.04

    • @OGLDEV
      @OGLDEV  Год назад

      Thanks, I updated the install script.

    • @songsstoriesforkids1209
      @songsstoriesforkids1209 Год назад

      @@OGLDEV I met "E: Unable to locate package libglew2.2" error when install libglew2.2 on Ubuntu 20.04. Please help me to resolve this problem. Thank you so much.

    • @OGLDEV
      @OGLDEV  Год назад

      @@songsstoriesforkids1209 You are on an older version of Ubuntu so you need to manually fix 2.2 in the script back to 2.1. Unfortunately I don't have enough time so I try to keep the script updated for the latest version only ;-)

    • @songsstoriesforkids1209
      @songsstoriesforkids1209 Год назад

      @@OGLDEV What a very quick response !
      I also used cat command to check script, and that's also my opinion at the first time. But I used many other ways to fix this error.
      There is no word that can explain my appreciation, to be honest!
      Thanks a million,
      Dat Thanh Do

  • @Uri.Sab.
    @Uri.Sab. 2 года назад

    Anyone's from Mint21.1, how to install libglew2.1? Normal sudp apt install doesn't work

    • @OGLDEV
      @OGLDEV  2 года назад +1

      Unfortunately my Linux partition is currently not booting so I can't check it. What do you get when you run 'apt search glew' ?

    • @Uri.Sab.
      @Uri.Sab. 2 года назад +1

      @@OGLDEV thks after some experiments I get build almost all examples (exept 39, 40, and others higher id) it seems working well just without that.

  • @vbessonow
    @vbessonow 3 года назад +1

    when you are going to continue with tutorials?
    you have 49 ahead))
    thanks

    • @OGLDEV
      @OGLDEV  3 года назад

      The tutorial on rotation is currently WIP. I plan to produce new material every now and then that didn't appear on the website. Right now I'm still ramping up on the whole youtube/video/audio/editing process so I have little time left, but as things cool down I will definitely do that.

  • @vbessonow
    @vbessonow 3 года назад

    have you ever created windows tutorial?

    • @OGLDEV
      @OGLDEV  3 года назад

      There is an old Visual Studio 2017 (I think) solution file in github.com/emeiri/ogldev/blob/master/Windows/ogldev/ogldev.sln. It used to work but there are probably some problems now that I have to fix. I think that after the scaling tutorial I will do another "getting up and running" video targeted at windows and from there on will try to keep the solution file up to date.

    • @OGLDEV
      @OGLDEV  3 года назад +1

      Hi Vladimir, check out the new video on getting OpenGL up and running on windows: ruclips.net/video/WMTxY14aJJE/видео.html

    • @harrypotcha0283
      @harrypotcha0283 2 года назад

      @@OGLDEV Do you really need to install the whole Visual Studio suite, in order to compile simple Hello Triangle program? It's so annoying that it's necessary to go through the configuration hell.

    • @OGLDEV
      @OGLDEV  2 года назад +1

      @@harrypotcha0283 Not really, you can also use Visual Studio code which is much more lightweight. If you really want to go slim you can even use a simple notepad and build your code from the command line. Remember that the triangle is just the first step and I expect most people will want to continue to more complex stuff and eventually develop their own games or engines. In that case Visual Studio is a pretty good development enviroment (note that you don't need the entire suite - just the base package and the C++ support). I chose Visual Studio because I'm familiar with it and I think that many people will find the community edition very attractive. What are you using today for C++ development?

    • @harrypotcha0283
      @harrypotcha0283 2 года назад

      @@OGLDEV Yes I was looking for an IDE that is way more lightweight and easy to configure. In the end, Atom text editor and the GPP compiler extension are the best choice for my purposes. I plan to write a tutorial on Medium how to configure Atom. It’s a bit similar to using command line but way more convenient and compilation can be launched with a hit of button.

  • @NoOne-pi8cj
    @NoOne-pi8cj Год назад

    Did anyone encounter several errors when running build_all script?
    tutorial48.cpp: In member function ‘bool Tutorial48::Init()’:
    tutorial48.cpp:146:24: error: ‘class Camera’ has no member named ‘AddToATB’
    146 | m_pGameCamera->AddToATB(bar);
    | ^~~~~~~~
    tutorial48.cpp:159:28: error: ‘class DirectionalLight’ has no member named ‘AddToATB’
    159 | m_directionalLight.AddToATB(bar);
    | ^~~~~~~~
    tutorial48.cpp: In member function ‘virtual void Tutorial48::RenderSceneCB()’:
    tutorial48.cpp:195:49: error: ‘class BasicMesh’ has no member named ‘GetOrientation’
    195 | m_pipeline.Orient(m_mesh[m_currentMesh].GetOrientation());
    | ^~~~~~~~~~~~~~
    Building tutorial49 ...
    g++: error: mesh.cpp: No such file or directory
    Building tutorial50 ...
    Building tutorial51 ...
    Building tutorial52 ...
    Building tutorial53 ...
    Building tutorial54 ...
    Building Terrain1 ...
    Building Terrain10 ...
    ./build_all.sh: line 6: ./build.sh: Permission denied
    Building Terrain2 ...
    Building Terrain3 ...
    Building Terrain4 ...
    Building Terrain5 ...
    Building Terrain5.1 ...
    Building Terrain6 ...
    ./build_all.sh: line 6: ./build.sh: Permission denied
    Building Terrain7 ...
    ./build_all.sh: line 6: ./build.sh: Permission denied
    Building Terrain8 ...
    ./build_all.sh: line 6: ./build.sh: No such file or directory
    Building Terrain9 ...
    ./build_all.sh: line 6: ./build.sh: Permission denied

    • @OGLDEV
      @OGLDEV  Год назад +1

      Thanks for the report. Tutorial 48 is actually an older tutorial from my website. I stopped using ATB so there are various errors related to that. I'll try to fix those in the next few days. In the meantime you can simply comment out any reference to ATB and it should be ok. I'll also check the permission errors on Linux.

    • @OGLDEV
      @OGLDEV  Год назад

      Fixed.

    • @NoOne-pi8cj
      @NoOne-pi8cj Год назад

      @@OGLDEV Thank you so much!