OpenGL is a cross-language, cross-platform graphics API for rendering 2D and 3D scenes using a graphics card.
We just released a course on the freeCodeCamp.org YouTube channel that will teach you how to use OpenGL with C++ to create 3D and 2D graphics.
Victor Gordan developed this course. His course is great for beginners. It features simple-to-follow instructions and informative diagrams.
The course will take you from installing the needed software all the way to creating your own graphics and importing models.
Here is a detailed list of topics covered in this course:
- Installation
- Setting Up VS Project
- Generating GLFW
- Build Solution GLFW
- Importing Libraries
- Configuring VS
- Finishing up & Testing
- Initializing GLFW
- Configuring GLFW
- Creating Window
- While Loop
- OpenGL Viewport
- Buffer Explanation
- Adding Color
- Comments for Window
- Graphics Pipeline
- Shaders Source Code
- Vertices
- Vertex and Fragment Shaders
- Shader Program
- Vertex Buffer Object
- Vertex Array Object
- Cleaning Up
- Rendering Loop
- Comments for Triangle
- Normal Triangle
- Duplicate Vertices
- Solution
- Index Buffer
- Implementation
- Comments for Index Buffer
- Introduction to Organizing
- Shader Text Files
- Shader Class
- VBO Class
- EBO Class
- VAO Class
- Adding Classes to Main.cpp
- Comments for Organizing
- Introduction to Shaders
- Shaders Properties
- Vertex Shader
- Fragment Shader
- Adding Colors
- Modifying the VAO class
- Vertex Attribute Pointer Explanation
- linkAttrib Code
- Interpolation
- Uniforms
- Error Checking Shaders
- Comments for Shaders
- Types of Textures
- stb Library
- Square
- Texture Sizes
- Importing in an Image
- Creating the Texture
- Texture Units
- Interpolation Types
- Texture Mapping
- Assigning the Image to the Texture
- Errors
- Mipmaps
- Texture Coordinates
- Vertex and Fragment Shaders
- Finishing up
- Texture Class
- Comments for Textures
- Introduction to Going 3D
- Correction
- Matrices
- GLM
- Coordinate Types
- Transformation Matrices
- Matrix Initialization
- View & Projection Matrices
- Importing Matrices
- Matrices Final Multiplication
- Pyramid
- Rotation & Timer
- Depth Buffer
- Comments for Going 3D
- Header File
- Basic Camera Class Functions
- Main File Changes
- Vertex Shader Changes
- Key Inputs
- Mouse Inputs
- Fixing Camera Jumps
- Comments for Camera
- Modify Camera
- Light Cube
- Light Color
- Diffuse Lighting & Normals
- Ambient Lighting
- Specular Lighting
- Comments for Lighting
- Modify Texture Class
- Plane With Texture
- Specular Maps Theory
- Implementing Specular Maps
- Ending for Specular Maps
- Types of Light
- Point Light
- Intensity Attenuation
- Inverse Square Law
- CG Intensity Equation
- Implementation of Attenuation
- Directional Light
- Spotlight
- Light Cones
- Cones Comparison
- Cos vs Angle
- Finishing the Spotlight
- Comments for Types of Light
- Introduction for Mesh Class
- Mesh Definition
- Mesh Class Header
- Modify the VBO Class
- Modify the EBO Class
- Mesh Constructor
- Rearrange Shader Layouts
- Mesh Draw Function I
- Modify the Texture Class
- Mesh Draw Function II
- Modify the Uniforms
- Main.cpp Changes
- Comments for Mesh Class
- Introduction for Model Loading
- Small Note on 3D Models
- JSON Library
- Model Header
- Model.cpp File
- JSON File Structure
- Getting the Binary Data
- glTF File Structure
- getFloats() and getIndices()
- Grouping Functions
- assembleVertices()
- Modifying the Texture Class
- getTextures()
- loadMesh()
- Matrix Transformations Explanation
- traverseNode() Declaration
- Modifying the Mesh Class
- Modifying the Vertex Shader
- traverseNode() Writing
- Modifying the Main.cpp File
- Examples of Models
- Comments for Model Loading
Watch the full course below or on the freeCodeCamp.org YouTube channel (2-hour watch).