Unhandled exception in for loop

前端 未结 1 642
一向
一向 2021-01-29 08:54

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

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-29 09:31

    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.

    0 讨论(0)
提交回复
热议问题