MCPcopy Create free account
hub / github.com/chrxh/alien / initFileDialogs

Method initFileDialogs

source/Gui/MainWindow.cpp:244–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244void _MainWindow::initFileDialogs()
245{
246 ifd::FileDialog::Instance().CreateTexture = [](uint8_t* data, int w, int h, char fmt) -> void* {
247 GLuint tex;
248
249 glGenTextures(1, &tex);
250 glBindTexture(GL_TEXTURE_2D, tex);
251 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
252 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
253 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
254 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
255 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, (fmt == 0) ? GL_BGRA : GL_RGBA, GL_UNSIGNED_BYTE, data);
256 glGenerateMipmap(GL_TEXTURE_2D);
257 glBindTexture(GL_TEXTURE_2D, 0);
258
259 return reinterpret_cast<void*>(uintptr_t(tex));
260 };
261 ifd::FileDialog::Instance().DeleteTexture = [](void* tex) {
262 GLuint texID = reinterpret_cast<uintptr_t>(tex);
263 glDeleteTextures(1, &texID);
264 };
265}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected