Transparent demod overlay on waterfall

This commit is contained in:
Charles J. Cliffe 2014-11-30 17:59:24 -05:00
parent 874746b1d4
commit 0bc31eed6c
4 changed files with 23 additions and 6 deletions

View File

@ -6,7 +6,7 @@ DemodulatorThread::DemodulatorThread(DemodulatorThreadInputQueue* pQueue) :
inputQueue(pQueue), visOutQueue(NULL), terminated(false), initialized(false), audio_resampler(NULL), resample_ratio(1), audio_resample_ratio(
1), resampler(NULL), commandQueue(NULL), fir_filter(NULL) {
float kf = 0.75; // modulation factor
float kf = 0.5; // modulation factor
fdem = freqdem_create(kf);
// freqdem_print(fdem);

View File

@ -71,7 +71,7 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
}
if (mTracker.mouseInView()) {
glContext->DrawFreqSelector(mTracker.getMouseX());
glContext->DrawFreqSelector(mTracker.getMouseX(),0,1,0);
}
glContext->EndDraw();

View File

@ -92,7 +92,9 @@ void WaterfallContext::DrawDemod(DemodulatorInstance *demod) {
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glColor3f(1.0, 1.0, 1.0);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_DST_COLOR);
glColor4f(1.0, 1.0, 1.0, 0.6);
glBegin(GL_LINES);
glVertex3f((uxPos - 0.5) * 2.0, 1.0, 0.0);
@ -107,11 +109,23 @@ void WaterfallContext::DrawDemod(DemodulatorInstance *demod) {
glVertex3f((uxPos - 0.5) * 2.0 + ofs, -1.0, 0.0);
glEnd();
glBlendFunc(GL_SRC_ALPHA, GL_DST_COLOR);
glColor4f(1.0, 1.0, 1.0, 0.2);
glBegin(GL_QUADS);
glVertex3f((uxPos - 0.5) * 2.0 - ofs, 1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 - ofs, -1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofs, -1.0, 0.0);
glVertex3f((uxPos - 0.5) * 2.0 + ofs, 1.0, 0.0);
glEnd();
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
}
void WaterfallContext::DrawFreqSelector(float uxPos) {
void WaterfallContext::DrawFreqSelector(float uxPos, float r = 1, float g = 1, float b = 1) {
DemodulatorInstance *demod = wxGetApp().getDemodTest();
if (!demod) {
@ -121,7 +135,9 @@ void WaterfallContext::DrawFreqSelector(float uxPos) {
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glColor3f(1.0, 1.0, 1.0);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_DST_COLOR);
glColor4f(r, g, b, 0.6);
glBegin(GL_LINES);
glVertex3f((uxPos - 0.5) * 2.0, 1.0, 0.0);
@ -136,6 +152,7 @@ void WaterfallContext::DrawFreqSelector(float uxPos) {
glVertex3f((uxPos - 0.5) * 2.0 + ofs, -1.0, 0.0);
glEnd();
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
}

View File

@ -14,7 +14,7 @@ public:
void BeginDraw();
void Draw(std::vector<float> &points);
void DrawFreqSelector(float uxPos);
void DrawFreqSelector(float uxPos, float r, float g, float b);
void DrawDemod(DemodulatorInstance *demod);
void EndDraw();