FlutterAngleTexture invoke resize callback on size change, cleanup on destruction and call glFinish in RenderCallback

FlutterAngleTexture invoke resize callback on size change, cleanup on destruction and call glFinish in RenderCallback
move OpenGlTextureBuffer cleanup to destructor
This commit is contained in:
Nick Fisher
2023-10-24 12:26:07 +11:00
parent 435ed7bee6
commit 3f988a119c
5 changed files with 59 additions and 39 deletions

View File

@@ -126,6 +126,17 @@ OpenGLTextureBuffer::OpenGLTextureBuffer(
result->Success(resultList);
}
OpenGLTextureBuffer::~OpenGLTextureBuffer() {}
OpenGLTextureBuffer::~OpenGLTextureBuffer() {
HWND hwnd = _pluginRegistrar->GetView()->GetNativeWindow();
HDC whdc = GetDC(hwnd);
if (!wglMakeCurrent(whdc, _context)) {
std::cout << "Failed to switch OpenGL context in destructor." << std::endl;
// result->Error("CONTEXT", "Failed to switch OpenGL context.", nullptr);
return;
}
glDeleteTextures(1, &this->_inactive->glTextureId);
wglMakeCurrent(NULL, NULL);
}
} // namespace polyvox_filament