I am trying to use stb_image to load image files as textures in an OpenGL program, the documentation of the header file stb_image.h states the following:
"Do this:
#define STB_IMAGE_IMPLEMENTATION
before you include this file in one C or C++ file to create the implementation."
What does this type of preprocessor directive actually do?
For the benefit of the reader, here is how my project is structured.
- main.cpp
- stb_image.h
The header of the main.cpp file looks likes this:
#include <iostream>
#include <glad/glad.h>
#include <glfw3.h>
#include "shader.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"