diff --git a/overlay_experimental/windows/OpenGL_Hook.cpp b/overlay_experimental/windows/OpenGL_Hook.cpp index e88de9d..43e4050 100644 --- a/overlay_experimental/windows/OpenGL_Hook.cpp +++ b/overlay_experimental/windows/OpenGL_Hook.cpp @@ -163,12 +163,7 @@ std::weak_ptr OpenGL_Hook::CreateImageResource(const void* image_data, { GLuint* texture = new GLuint(0); glGenTextures(1, texture); - if (glGetError() != GL_NO_ERROR) - { - delete texture; - return std::shared_ptr(nullptr); - } - + // Save old texture id GLint oldTex; glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTex); @@ -177,13 +172,17 @@ std::weak_ptr OpenGL_Hook::CreateImageResource(const void* image_data, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Upload pixels into texture +#if defined(GL_UNPACK_ROW_LENGTH) && !defined(__EMSCRIPTEN__) glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); +#endif + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data); - glBindTexture(GL_TEXTURE_2D, oldTex); - + glFlush(); auto ptr = std::shared_ptr((uint64_t*)texture, [](uint64_t* handle) { if (handle != nullptr)