| 160 | }; |
| 161 | |
| 162 | static GLuint upload_texture(const uint8_t* data, int w, int h, int ch, GLuint existing = 0) { |
| 163 | GLuint tex = existing; |
| 164 | if (!tex) glGenTextures(1, &tex); |
| 165 | glBindTexture(GL_TEXTURE_2D, tex); |
| 166 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 167 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 168 | GLenum fmt = (ch == 4) ? GL_RGBA : GL_RGB; |
| 169 | glTexImage2D(GL_TEXTURE_2D, 0, fmt, w, h, 0, fmt, GL_UNSIGNED_BYTE, data); |
| 170 | return tex; |
| 171 | } |
| 172 | |
| 173 | static void build_frame_overlay(vapp_state& app, std::vector<uint8_t>& overlay) { |
| 174 | if (app.frame.data.empty()) return; |