OpenGL Course – Create 3D and 2D Graphics With C++

Wordpress sites

Learn how to use OpenGL to create 2D and 3D vector graphics in this course.

Course by Victor Gordan. Check out his channel:

💻 Code:

See top comment for more resources.

⭐️ Contents ⭐️

Introduction
0:00:00 Introduction to Course

Install
0:00:00 Downloads
0:02:11 Setting Up VS Project
0:02:50 Generating GLFW
0:03:29 Build Solution GLFW
0:04:03 Importing Libraries
0:04:53 Configuring VS
0:06:02 Finishing up & Testing

Window
0:06:36 Initializing GLFW
0:07:03 Configuring GLFW
0:08:26 Creating Window
0:09:53 While Loop
0:11:01 OpenGL Viewport
0:11:36 Buffer Explanation
0:12:55 Adding Color
0:14:03 Comments for Window

Triangle
0:14:25 Graphics Pipeline
0:16:56 Shaders Source Code
0:17:24 Vertices
0:18:54 Vertex and Fragment Shaders
0:20:45 Shader Program
0:21:36 Vertex Buffer Object
0:24:35 Vertex Array Object
0:26:57 Cleaning Up
0:27:34 Rendering Loop
0:28:38 Comments for Triangle

Index Buffer
0:29:24 Normal Triangle
0:29:47 Duplicate Vertices
0:30:06 Solution
0:30:26 Index Buffer
0:30:51 Implementation
0:32:22 Comments for Index Buffer

Organizing
0:32:33 Introduction to Organizing
0:32:43 Shader Text Files
0:33:21 Shader Class
0:35:27 VBO Class
0:36:18 EBO Class
0:36:35 VAO Class
0:37:36 Adding Classes to Main.cpp
0:37:59 Comments for Organizing

Shaders
0:38:34 Introduction to Shaders
0:38:44 Shaders Properties
0:38:57 Vertex Shader
0:40:01 Fragment Shader
0:40:17 Adding Colors
0:41:23 Modifying the VAO class
0:41:54 Vertex Attribute Pointer Explanation
0:43:09 linkAttrib Code
0:43:19 Interpolation
0:43:50 Uniforms
0:46:08 Error Checking Shaders
0:46:29 Comments for Shaders

Textures
0:46:39 Types of Textures
0:46:54 stb Library
0:47:58 Square
0:48:14 Texture Sizes
0:48:37 Importing in an Image
0:49:19 Creating the Texture
0:49:43 Texture Units
0:50:19 Interpolation Types
0:51:11 Texture Mapping
0:52:27 Assigning the Image to the Texture
0:53:10 Errors
0:53:21 Mipmaps
0:53:50 Texture Coordinates
0:54:15 Vertex and Fragment Shaders
0:54:51 Finishing up
0:55:39 Texture Class
0:55:56 Comments for Textures

Going 3D
0:56:01 Introduction to Going 3D
0:56:11 Correction
0:56:23 Matrices
0:56:57 GLM
0:57:26 Coordinate Types
0:58:35 Transformation Matrices
0:59:13 Matrix Initialization
0:59:41 View & Projection Matrices
1:01:16 Importing Matrices
1:01:53 Matrices Final Multiplication
1:02:07 Pyramid
1:02:41 Rotation & Timer
1:03:11 Depth Buffer
1:03:36 Comments for Going 3D

Camera
1:04:11 Header File
1:05:04 Basic Camera Class Functions
1:05:54 Main File Changes
1:06:21 Vertex Shader Changes
1:06:43 Key Inputs
1:07:38 Mouse Inputs
1:09:21 Fixing Camera Jumps
1:09:49 Comments for Camera

Lighting
1:10:13 Modify Camera
1:10:30 Light Cube
1:10:50 Light Color
1:12:03 Diffuse Lighting & Normals
1:15:36 Ambient Lighting
1:16:18 Specular Lighting
1:17:54 Comments for Lighting

Specular Maps
1:18:15 Modify Texture Class
1:18:34 Plane With Texture
1:19:06 Specular Maps Theory
1:19:30 Implementing Specular Maps
1:20:06 Ending for Specular Maps

Types of Light
1:20:16 Types of Light
1:20:26 Point Light
1:20:41 Intensity Attenuation
1:20:51 Inverse Square Law
1:21:03 CG Intensity Equation
1:21:36 Implementation of Attenuation
1:22:09 Directional Light
1:22:52 Spotlight
1:23:08 Light Cones
1:23:18 Cones Comparison
1:23:31 Cos vs Angle
1:23:45 Finishing the Spotlight
1:24:19 Comments for Types of Light

Mesh Class
1:24:33 Introduction for Mesh Class
1:24:46 Mesh Definition
1:25:01 Mesh Class Header
1:25:58 Modify the VBO Class
1:27:06 Modify the EBO Class
1:27:16 Mesh Constructor
1:27:41 Rearrange Shader Layouts
1:28:10 Mesh Draw Function I
1:28:51 Modify the Texture Class
1:29:22 Mesh Draw Function II
1:29:54 Modify the Uniforms
1:30:20 Main.cpp Changes
1:31:06 Comments for Mesh Class

Model Loading
1:31:28 Introduction for Model Loading
1:31:47 Small Note on 3D Models
1:32:27 JSON Library
1:32:41 Model Header
1:33:03 Model.cpp File
1:33:13 JSON File Structure
1:33:30 Getting the Binary Data
1:34:07 glTF File Structure
1:36:28 getFloats() and getIndices()
1:39:09 Grouping Functions
1:39:19 assembleVertices()
1:39:50 Modifying the Texture Class
1:40:22 getTextures()
1:41:50 loadMesh()
1:42:23 Matrix Transformations Explanation
1:42:54 traverseNode() Declaration
1:43:28 Modifying the Mesh Class
1:43:41 Modifying the Vertex Shader
1:44:15 traverseNode() Writing
1:45:18 Modifying the Main.cpp File
1:45:28 Examples of Models
1:46:01 Comments for Model Loading

40 thoughts on “OpenGL Course – Create 3D and 2D Graphics With C++”

  1. Anass Soulimani

    No way, I start this semestre with C++,you guys put an oop video. I start UML before Java and you guys put an UML video. My teacher asks me to create an-ecomerce website and you guys put the same thing. And now I’m on holiday, I start watching brian will videos on opengl and you guys post this.Thanks a lot!!❤❤❤❤❤❤❤❤

  2. What a blessing – I’m learning OpenGL currently and it’s hard to find self-consistent sources. Thank you so much.

    1. Yeah, for sure… I kinda wish those types of things came with some kind of pdf or documentation guiding you through all the commands and codes. But hey, I found this video so I’ll dive right in

  3. Excellent tutorials especially using graphics in C++, maybe offer some tutorials on creating a full scale Application in C++ as well.

  4. I’ve been searching for ways to learn C++ graphics rendering and then you go and upload my solution. Just what I needed today, thank you so much!

    1. 4671_ Mrunal wankhede

      i have no idea what gl do, can you please explain, what it is and what it is used for, so that i can think, if i need it

  5. JeanJacques Strydom

    This is an absolutely awesome tutorial, thank you so much for making it! I just wish people would make more OpenGL tutorials that are a bit more cross-platform, rather than just always focusing on Windows

    1. Victor Gordan

      Thank you! Sadly it would be quite a bit more work to translate it to the other OSs and then also check if it works properly on them, and I just don’t have that kind of time right now in university…

    2. JeanJacques Strydom

      @Victor Gordan yeah I can definitely imagine that. And as someone that makes videos as well I can totally sympathize with you, it was more just my frustration from trying to do graphics programming outside of windows 😅

  6. Hey everyone, I hope you’ve enjoyed the course I’ve made, had a lot of fun making it! 🙂

    1. Astaghfirullahalzim Astaghfirullahalzim

      use GLhalf
      because it only requires 2bytes
      floating point not 4bytes..

      because r,g,b can store 256 possible numbers

      if you try to represent that number
      in between 0 and 1

      first try divide 256/100
      we get 2.56 which means there numbers that cannot fit

      try 256/1000
      you get 0.256

      so you need 3 decimal points
      and an integer

      so you calculate how many possible numbers can fit

      (10^3)+(10^2)+10+1

      you get 11xx
      about 1000 + numbers
      so this is actually lower than 16 bits data type for floating point

      so does this waste some memory inside the program?
      I don’t know

    2. Astaghfirullahalzim Astaghfirullahalzim

      2^10=1024
      2^11=20xx
      which means we only needs 11 bits
      for one data type

      so they wasted 5 bits there doing nothing

    3. Victor Gordan

      @Astaghfirullahalzim Astaghfirullahalzim ummm…. not sure what sort of calculations you did there but that’s not how it works…

      Each channel in a color is generally one byte, so a color (RGBA) would be 4 bytes which works quite nicely with GPUs. But this can change and is necessary to change sometimes. For example you can have 2 bytes per channel, more commonly known as (16 bit colors). You would use this if you get clear banding colors on the screen and you need more precision.

      Keep in mind that even though 1 byte only represents 256 possible numbers, it does not represent 256 colors. It reprezents 256 shades of “red” or “green” or “blue”. Combining these shades gives you different colors. To be more precise, 256 x 256 x256 = 16.7 million colors.

      In other words, it’s great at distinguishing between different colors, but not so great at distinguishinf between shades of the same color, which sometimes results in clear bands.

      Generally speaking, if your hardware can take it, it’s better to use 16bit per channel rather than 8bit. In some extreme cases you might even want to go to 32bit 🙂

  7. I Am the Great

    This was so awesome. I love you guys for giving us free education. Please if possible, make a course on developing a video game using OpenGL

  8. Ernests Lavrinovics

    I guess a lot of people have started building their own graphics engines during pandemic haha. Nice video!

  9. I have used DirectX11 before with hlsl shaders, but I always wanted to learn opengl. This is perfect!

  10. Very good. Thanks. My only criticism is the volume is very low – relative to most other media/content. Other than that thank you very much.

  11. IndustrialDonut

    this is crazy high quality like I’m actually able to follow along with almost no problems so far

  12. CHITUS💖⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻

    This was so awesome. I love you guys for giving us free education. Please if possible, make a course on developing a video game using OpenGL

  13. Очень хороший туториал. Просто отличный. Всё понятно, всё доступно. Все основные проблематики разобраны. Супер.

  14. 17:20 | if anyone is interested, here is the code he pasted.
    (if you have the laziness to go through GitHub).

    // Vertex Shader source code
    const char* vertexShaderSource = “#version 330 coren”
    “layout (location = 0) in vec3 aPos;n”
    “void main()n”
    “{n”
    ” gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);n”
    “}”;
    //Fragment Shader source code
    const char* fragmentShaderSource = “#version 330 coren”
    “out vec4 FragColor;n”
    “void main()n”
    “{n”
    ” FragColor = vec4(0.8f, 0.3f, 0.02f, 1.0f);n”
    “}n”;

  15. The Beaver Kidd

    You plus the OpenGL/C++ 3D Tutorial by Suraj Sharma combined has helped me learn a lot really quickly for starting to do a 3d game.
    The only thing I feel like you could have touched on is Resizing the window which i later on found out I could to by changing the width and height from ‘const static int’ to just ‘int’ and then in the while loop do this:
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);
    camera.Matrix(45.0f, 0.1f, 100.0f, shaderProgram, “camMatrix”, height, width);

    I added int height and width to the camera::matrix function in Camera.cpp and .h to update the camera size or else everything just stretched whenever I resized the window
    but for anyone else experiencing this issue here you go : )
    (oh yea, you also need ‘glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);’ by all the other glfwWindowHint’s for resizing)

Comments are closed.