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

freeCodeCamp.org · 1.4M views · 2021 · 1:46:24

Open on YouTube

Computer graphics & renderingC, C++, Rust, Go & systems languagesUniversity lectures & coursescourse

Why Stack Overflow recommends it

Stack Overflow users cite it as the tutorial they were following when they hit window, linker, shader-class and rendering problems while learning OpenGL.

Recommended by 1 people across 1 different months, 2021 to 2023.

What it is

A 1h46m freeCodeCamp course by Victor Gordan that teaches OpenGL with C++ from scratch. It covers setting up GLFW and GLAD in Visual Studio, creating a window, drawing a triangle with shaders and buffers, organizing code into classes, then textures and 3D topics.

What people said

Recommends LawlessWalrus · 2022-09 · Stack Overflow · on “No square after draw call and no errors”

I'm trying to setup an OpenGL project for a 2D physics engine I plan to make, however I'm unable to successfully create an "Entity" class with a draw method. A window pops up with the background color specified in the render loop, but nothing else. There are no errors, so it's difficult for me to debug. I've been following this tutorial [this video] for guidance on the abstraction, with some differences because I don't need textures or 3D. VAO.cpp #include "VAO.h" VAO::VAO() { glGenVertexArrays(1, &ID); }; void VAO::LinkAttrib(VBO& VBO, GLuint layout, GLuint numComponents, GLenum type, GLsizeiptr stride, void* offset) { VBO.Bind(); glVertexAttribPointer(layout, numComponents, type, GL_FALSE, stri

Cites Will Mungas · 2021-10 · Stack Overflow · on “Why is OpenGL creating a completely unresponsive window?”

I'm trying to learn OpenGL with C++ and Visual Studio; I got a little sick of trying to work with all the added layers of Unity's graphics and just wanted to make something simple myself, and realized real quick that Vulkan was a bit over my head. I happened across this tutorial on YouTube: [this video] It was pretty helpful for about 20 minutes; however, once it got to rendering a triangle my computer ran into an issue. Despite no compiler errors and basically copy-paste code from the video, upon running the program a window opens up that is completely unresponsive. Sometimes the proper background color will load, but no triangle has worked yet. I cannot interact with this window, not even to mo

Cites PrimeNumbrs · 2022-01 · Stack Overflow · on “why does linker error keep happening even though I set the AdditionalDependencies already?”

I was following the OpenGL tutorial from Freecodecamp.org ( [this video] ) and I got this error while following the "Window" part of the tutorial. #include <iostream> #include <glad/glad.h> #include <GLFW/glfw3.h> int main() { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); GLFWwindow* window = glfwCreateWindow(800, 800, "openGLTest", NULL, NULL); if (window == NULL) { std::cout << "Failed to create GLFW window" << std::endl; glfwTerminate(); return -1; } glfwMakeContextCurrent(window); gladLoadGL(); glViewport(0, 0, 800, 800); //error starts when I wrote this glClearColor(0.07

Cites cyber blade · 2022-04 · Stack Overflow · on “Unhandled exception at Microsoft C++ exception: int at memory location”

I am not the best with c/c++ code but ill do my best to explain. so I am watching an OpenCL tutorial video with visual studio, and right when it gets here( [this video] ), it works for the guy writing the code but when I give it a try this is what pops up the error [LINK] #include"shaderClass.h" // Reads a text file and outputs a string with everything in the text file std::string get_file_contents(const char* filename) { std::ifstream in(filename, std::ios::binary); if (in) { std::string contents; in.seekg(0, std::ios::end); contents.resize(in.tellg()); in.seekg(0, std::ios::beg); in.read(&contents[0], contents.size()); in.close(); return(contents); } throw(errno); //error here I am using opengl

Cites Electro · 2022-08 · Stack Overflow · on “OpenGL on Arch Linux - Linker Error: Undefined Reference”

I have a problem. I recently started learning OpenGL from [this video] . After the lesson "Organizing" after compiling I got errors like an undefined references. I have been comparing code for a long time, copying it from original repositories [LINK] , but nothing helped. main.cpp file: #include <iostream> #include <glad/glad.h> #include <GLFW/glfw3.h> #include <math.h> #include <stdio.h> #include "shaderClass.h" #include "VBO.h" #include "VAO.h" #include "EBO.h" // Vertices coordinates GLfloat vertices[] = { -0.5f, -0.5f * float(sqrt(3)) / 3, 0.0f, // Lower left corner 0.5f, -0.5f * float(sqrt(3)) / 3, 0.0f, // Lower right corner 0.0f, 0.5f * float(sqrt(3)) * 2 / 3, 0.0f, // Upper corner -0.5f /

Cites Matheus Yan · 2022-09 · Stack Overflow · on “glfwWindowShouldClose(window); generate exeption, why?”

Im starting with OpenGL and C++ but the first test code give me an error that I do not understend why or how to fix it. Im with some trobles to finally intall the libraries glfw3.h and glad.h, everithing works normal until I tap "glfwWindowShouldClose(window);" enter image description here [LINK] #include <iostream> #include <glad/glad.h> #include <GLFW/glfw3.h> int main() { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); GLFWwindow* window = glfwCreateWindow(640, 480, "teste", NULL, NULL); glfwMakeContextCurrent(window); while (!glfwWindowShouldClose(window)) { glfwPollEv

Cites extra_caffeine · 2023-06 · Stack Overflow · on “Why is my triangles been drawn in left-bottom side of the window”

I am trying to learn OpenGL just to kill time and was just curious about computer graphics. I am following a crash course tutorial on Youtube channel FreeCodeCamp.org this [this video] following is code for the basic creation of window and draw some primitives. (Using C++ and OpenGL) #include<iostream> #include<glad/glad.h> #include<GLFW/glfw3.h> // Vertex Shader source code const char* vertexShaderSource = "#version 330 core\n" "layout (location = 0) in vec3 aPos;\n" "void main()\n" "{\n" " gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n" "}\0"; //Fragment Shader source code const char* fragmentShaderSource = "#version 330 core\n" "out vec4 FragColor;\n" "void main()\n" "{\n" " FragColor = ve