Fixed OpenGL memory leak

This commit is contained in:
Ryzerth 2020-10-22 03:16:11 +02:00
parent 313b786d88
commit 72611b5fa7
5 changed files with 9 additions and 4 deletions

View File

@ -88,7 +88,7 @@ bool showMenu = true;
dsp::stream<dsp::complex_t> dummyStream; dsp::stream<dsp::complex_t> dummyStream;
void windowInit() { void windowInit() {
spdlog::info("Initializing SoapySDR"); gui::waterfall.init();
credits::init(); credits::init();

View File

@ -107,6 +107,10 @@ namespace ImGui {
updatePallette(COLOR_MAP, 13); updatePallette(COLOR_MAP, 13);
} }
void WaterFall::init() {
glGenTextures(1, &textureId);
}
void WaterFall::drawFFT() { void WaterFall::drawFFT() {
// Calculate scaling factor // Calculate scaling factor
float startLine = floorf(fftMax / vRange) * vRange; float startLine = floorf(fftMax / vRange) * vRange;
@ -361,7 +365,6 @@ namespace ImGui {
} }
void WaterFall::updateWaterfallTexture() { void WaterFall::updateWaterfallTexture() {
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId); glBindTexture(GL_TEXTURE_2D, textureId);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 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_MAG_FILTER, GL_LINEAR);

View File

@ -51,6 +51,8 @@ namespace ImGui {
public: public:
WaterFall(); WaterFall();
void init();
void draw(); void draw();
void pushFFT(std::vector<float> data, int n); void pushFFT(std::vector<float> data, int n);

View File

@ -19,7 +19,7 @@
"bandPlan": "General", "bandPlan": "General",
"bandPlanEnabled": true, "bandPlanEnabled": true,
"fftHeight": 298, "fftHeight": 298,
"frequency": 98200000, "frequency": 100100000,
"max": 0.0, "max": 0.0,
"maximized": true, "maximized": true,
"menuOrder": [ "menuOrder": [

View File

@ -1,5 +1,5 @@
{ {
"device": "HackRF One #0 901868dc282c8f8b", "device": "Generic RTL2832U OEM :: 00000001",
"devices": { "devices": {
"AirSpy HF+ [c852435de0224af7]": { "AirSpy HF+ [c852435de0224af7]": {
"gains": { "gains": {