2

I'm learning C++ and have been following this learn openGL tutorial. I'm trying to geta texture file and put it into data, but I can't seem to get anything to work. What would be the best way to go about this?

 unsigned char* data = stbi_load("WHAT TO PUT HERE ", &width, &height, &nrChannels, 0);

Image of project

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Dahstroyer
  • 21
  • 1
  • 1
    Put the path of image file. – Summit Sep 18 '22 at 04:17
  • 1
    unsigned char* data1 = stbi_load("C:\\Temp\\RED.png" , &width, &height, &nrComponents, 0); – Summit Sep 18 '22 at 04:20
  • 1
    @Summit Thank you for the example. I forgot that you need to escape "\" with "\\". – mab0189 Mar 14 '23 at 01:11
  • For debugging you can also use `std::cout << "Error: Failed to load the image because " << stbi_failure_reason();` to get more information about why stbi failed to load the image. – mab0189 Mar 14 '23 at 01:17

0 Answers0