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;
void windowInit() {
spdlog::info("Initializing SoapySDR");
gui::waterfall.init();
credits::init();

View File

@ -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);

View File

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