are you able to make a simple “hello world” console application ??
–> new projct –> console application -> give it a name
–> add a new cpp file called “main.cpp”, just cout a “hello world”
#include <iostream>
int main()
{
std::cout << "hello world" << std::endl;
return 0;
}
until now, you dont need any external libraries
part 1: creating a window
to be able to create a window in which you can draw, you need GLFW
but if you do that:
#include <GLFW/glfw3.h>
you will get a compile error: “no such file found”
download + unzip glfw (32bit pre-compiled windows binaries)
https://github.com/glfw/glfw/releases/download/3.2.1/glfw-3.2.1.bin.WIN32.zip
in it, you will find a directory called “include”, in it, you will find a directory called “GLFW”
copy the include directory into your project, where your “main.cpp” is located
open the project’s properties → add a new “include directory” → add the copied folder path
now you should be able to compile:
#include <iostream>
#include <GLFW/glfw3.h>
int main()
{
std::cout << "hello world" << std::endl;
return 0;
}
to create a window, replace that code with this:
compilation will fail, because you are missing some .lib files
what you just downloaded –> in it, you will find a directory called “lib-vc2010”, in it you’ll find “glfw3.lib”
beside the “include” folder in your project directory, create another folder called “lib”, copy the glfw3.lib into it
open the project’s properties –> add a new “library directory” –> add the path to the lib folder
then go to the “linker” section, “input” –> “additional dependencies” –> add “glfw3.lib”
now you should be able to compile the example code to create a window
(if not, you should read something about “using c++ libs”, “compiling / linking”)
part 2: loading openGL functions
once you have downloaded glew windows 32 binaries …
https://sourceforge.net/projects/glew/files/glew/2.0.0/glew-2.0.0-win32.zip/download
… you will again find a “include” folder in it, copy the “GL” folder into your “include” folder where you already have “GLFW”
beside that, there is a “lib” folder, in it a “Release” folder, in it a “Win32” folder, in it a file called “glew32s.lib”
–> copy that file into your lib folder
–> go again into your project properties –> linker section –> input –> additional deps –> add “glew32s.lib”
–> in addition to that, add “OpenGL32.lib”
then in your example code, right BEFORE #include <GLFW/glfw3.h>, add:
#define GLEW_STATIC
#include <GL/glew.h>
now you can easily replace ANY code piece you find at https://learnopengl.com
like that:
https://learnopengl.com/code_viewer.php?code=getting-started/hellotriangle2