| 158 | }; |
| 159 | |
| 160 | static GLuint upload_texture(const uint8_t* data, int w, int h, int ch, GLuint existing = 0) { |
| 161 | GLuint tex = existing; |
| 162 | if (!tex) glGenTextures(1, &tex); |
| 163 | glBindTexture(GL_TEXTURE_2D, tex); |
| 164 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 165 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 166 | GLenum fmt = (ch == 4) ? GL_RGBA : GL_RGB; |
| 167 | glTexImage2D(GL_TEXTURE_2D, 0, fmt, w, h, 0, fmt, GL_UNSIGNED_BYTE, data); |
| 168 | return tex; |
| 169 | } |
| 170 | |
| 171 | static void build_overlay(app_state& app) { |
| 172 | if (app.image.data.empty()) return; |
no outgoing calls
no test coverage detected