From 72611b5fa759fb63081978c797bfe400486ad408 Mon Sep 17 00:00:00 2001 From: Ryzerth Date: Thu, 22 Oct 2020 03:16:11 +0200 Subject: [PATCH] Fixed OpenGL memory leak --- core/src/gui/main_window.cpp | 2 +- core/src/gui/waterfall.cpp | 5 ++++- core/src/gui/waterfall.h | 2 ++ root_dev/config.json | 2 +- root_dev/soapy_source_config.json | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index da429e5e..6cf486ee 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -88,7 +88,7 @@ bool showMenu = true; dsp::stream dummyStream; void windowInit() { - spdlog::info("Initializing SoapySDR"); + gui::waterfall.init(); credits::init(); diff --git a/core/src/gui/waterfall.cpp b/core/src/gui/waterfall.cpp index 3d60dabd..de25afe7 100644 --- a/core/src/gui/waterfall.cpp +++ b/core/src/gui/waterfall.cpp @@ -107,6 +107,10 @@ namespace ImGui { updatePallette(COLOR_MAP, 13); } + void WaterFall::init() { + glGenTextures(1, &textureId); + } + void WaterFall::drawFFT() { // Calculate scaling factor float startLine = floorf(fftMax / vRange) * vRange; @@ -361,7 +365,6 @@ namespace ImGui { } void WaterFall::updateWaterfallTexture() { - glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_2D, textureId); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); diff --git a/core/src/gui/waterfall.h b/core/src/gui/waterfall.h index 12d62c44..20cdf588 100644 --- a/core/src/gui/waterfall.h +++ b/core/src/gui/waterfall.h @@ -51,6 +51,8 @@ namespace ImGui { public: WaterFall(); + void init(); + void draw(); void pushFFT(std::vector data, int n); diff --git a/root_dev/config.json b/root_dev/config.json index 15b8dabe..508544b9 100644 --- a/root_dev/config.json +++ b/root_dev/config.json @@ -19,7 +19,7 @@ "bandPlan": "General", "bandPlanEnabled": true, "fftHeight": 298, - "frequency": 98200000, + "frequency": 100100000, "max": 0.0, "maximized": true, "menuOrder": [ diff --git a/root_dev/soapy_source_config.json b/root_dev/soapy_source_config.json index 3401091d..47627fd8 100644 --- a/root_dev/soapy_source_config.json +++ b/root_dev/soapy_source_config.json @@ -1,5 +1,5 @@ { - "device": "HackRF One #0 901868dc282c8f8b", + "device": "Generic RTL2832U OEM :: 00000001", "devices": { "AirSpy HF+ [c852435de0224af7]": { "gains": {