Skip to content

sj-silva/OpenGLModerno

Repository files navigation

Modern OpenGL Essentials

Welcome to the Modern OpenGL Essentials playlist! This series of 31 short videos is designed to help you get started with graphical programming using OpenGL. Whether you're a beginner or someone looking to brush up on the fundamentals, this playlist will guide you through the essential concepts and techniques needed for 2D and 3D rendering.

Playlist Overview

Video Duration Topics Covered
Video 1 5:24 - Installation of GLFW with vcpkg
- Drawing a triangle in Legacy mode
- Installation of GLEW
Video 2 7:16 - glGenBuffers
- glBindBuffer
- glBufferData
Video 3 7:10 - glVertexAttribPointer
- glEnableVertexAttribArray
- glDrawArrays
- Drawing a triangle at the end
Video 4 4:17 - Graphics Pipeline
- NVidia Mythbusters Demo: GPU vs CPU
Video 5 5:28 - Discussion of Main.vert and Main.frag (empty files)
- Creation of Error.h and Error.cpp
Video 6 3:21 - Vector and point operations
- Explanation of homogeneous coordinates
- Example: gl_Position using vec4(x, y, z, 1) in homogeneous coordinates
Video 7 8:06 - Explanation of in and out variables in vertex and fragment shaders
- Creation and linking of shaders using glShaderSource, glCompileShader, glAttachShader, glLinkProgram, glDeleteShader, glUseProgram
- Rendering a yellow triangle at the end
Video 8 5:43 - Coloring a triangle using a uniform variable
- Explanation and usage of glGetUniformLocation and glUniform functions
Video 9 7:42 - Rotating a triangle
- Working with the glUniformMatrix4fv function
Video 10 7:11 - Discussion of the stride concept
- Created a color buffer to color the triangle from previous videos
Video 11 7:41 - Rotation of a triangle and a square on the same screen
- Positioning polygons using the glm::translate matrix from the GLM library
Video 12 5:28 - Matrix multiplication and the transformation order from model to world coordinate
- Positioned 2 triangles and 2 squares, applying scale, rotation, and translation operations
Video 13 4:09 - Discussed Vertex Array Object (VAO)
- No longer need to save the triangle (and square) position VBO and color VBO globally
- Now saving the triangle (and square) VAO
- Covered the glBindVertexArray function
Video 14 6:08 - Element Buffer Object (EBO)
- Previously needed information of 2 triangles to render a square
- Now using an array of indices to connect and color the square
- Introduced another OpenGL object: GL_ELEMENT_ARRAY_BUFFER
- Covered the function glDrawElements
Video 15 10:07 - Created a unique buffer to retrieve information about square vertices' position, color, and indices
- Covered the function glBufferSubData
Video 16 14:02 - Drew a cube with a single buffer
- Approached world coordinates to projection coordinates using the glm::perspective matrix
Video 17 5:50 - Created a Shader Object
- Constructor used: Shader(vertexFilePath, fragFilePath)
Video 18 3:05 - Finished the Shader class
- Implemented procedures to link the Shader
Video 19 4:28 - Discussed the SendUniformData function in the Shader class
- This function receives the variable name and data to send to the Shader
- Implemented using unordered_map<string, int> to represent the variable name and its location in the shader
Video 20 9:14 - Created a class to draw a Cube
- Shared a Khronos page dealing with questions such as how to use glUniforms and when to call glUseProgram
Video 21 7:22 - Discussed instancing in an older approach
- Created 4 squares from a buffer but had to call glDrawElements 4 times, which is inefficient
- This highlights an incorrect approach that will be explained in future videos
Video 22 10:51 - Practiced another instancing technique
- Drew 4 squares using glDrawElementsInstanced, improving efficiency
- Created a VBO to store the center offsets of the 4 squares
- Used the array glm::vec2 centerOffSet[4] to pass position data
- Implemented glVertexAttribDivisor(2, 1) to update the center offset once per instance, allowing unique square positions without multiple draw calls
Video 23 10:47 - Created a VBO to store 4 matrices for instancing
- Discussed the size parameter of glVertexAttribPointer, which must be 1, 2, 3, or 4
- Since we are storing a 4x4 matrix, we sent 4 glm::vec4 (each representing a row of the matrix) to the shader, rather than passing 16 individual floats
Video 24 2:37 - Applied the matrix instancing strategy from video 21 to display 4 cubes on the screen
- Did not use a VBO to store the matrices; instead, positioned and rotated each cube by manipulating the model-to-world matrix
- Still used glDrawElements, but had to call the draw function 4 times
- Highlighted the inefficiency of this approach—imagine if there were 2000 cubes, making it clear this strategy is not optimal for large-scale rendering
Video 25 6:18 - Refactored the Cube class
- The constructor now requires the total number of cubes
- The model matrices of the cubes are stored in a VBO
- For the draw function, glDrawElementsInstanced was used, allowing all 4 cubes to be displayed with a single draw call
Video 26 6:10 - Discussed the use of multiple shaders applied to a Terrain class
- The model-view matrix for the terrain is the identity matrix
- Two programs were created: one compiled with Main.vert + Main.frag, and the other with Minor.vert + Main.frag
Video 27 6:02 - Used glDrawElements with GL_LINES to display the terrain
- Emphasized binding MajorShader to draw cubes and MinorShader to display the terrain
Video 28 3:39 - Created a base class called Primitive
- Developed a class to display pyramids
Video 29 7:09 - Created a class for the camera
- Discussed the glm::lookAt function
Video 30 8:25 - Updated the camera class to interact with the mouse
- Displacement in the x-axis creates a yaw rotation (rotation around the y-axis)
Video 31 3:57 - Created a scenario with 2000 objects

How to Use This Playlist

  1. Start from the Beginning: If you're new to OpenGL, it's recommended to start from the first video and work your way through the playlist sequentially. Each video builds on the previous ones, providing a comprehensive learning experience.

  2. Reference Individual Topics: Already familiar with the basics? Feel free to jump to any video that covers a specific topic you're interested in.

  3. Practice: OpenGL is best learned by doing. Try to implement the concepts discussed in each video by writing your own code and experimenting with different techniques.

Link para o playlist no YouTube:

Get Started

Ready to dive into graphical programming? Watch the Playlist on YouTube and start your journey with OpenGL!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors