I\'m trying to create two textures for my OpenGL project. Initially i created the textures seperately and this worked perfectly fine. Not to repeat myself, I decided to attempt
Please read the manuals of the libraries you're using.
Loading images with stb wrote:
The fifth parameter of stbi_load() specifies the number of 8-bit components per pixel to use. It can be set to one of following four options:
STBI_grey = 1
STBI_grey_alpha = 2
STBI_rgb = 3
STBI_rgb_alpha = 4
If you pass 0
as the fifth parameter stbi_load()
will use your nrChannels
which is uninitialized in your code and thuss causes undefined behaviour.