MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/RTXGI-DDGI / LoadTexture

Function LoadTexture

samples/test-harness/src/Textures.cpp:50–64  ·  view source on GitHub ↗

* Load an image from disk. */

Source from the content-addressed store, hash-verified

48* Load an image from disk.
49*/
50bool LoadTexture(Texture &texture)
51{
52 // Load the texture with stb_image (require 4 component RGBA)
53 texture.pixels = stbi_load(texture.filepath.c_str(), &texture.width, &texture.height, &texture.stride, STBI_rgb_alpha);
54 texture.stride = 4;
55 if (!texture.pixels)
56 {
57 std::string msg = "Error: failed to load texture: \'";
58 msg.append(texture.name);
59 msg.append("\'");
60 MessageBox(NULL, msg.c_str(), "Error", MB_OK);
61 return false;
62 }
63 return true;
64}
65
66/**
67* Release texture memory.

Callers 2

ParseGLFTexturesFunction · 0.85
LoadAndCreateTextureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected