Color theme tweaks and fixes

This commit is contained in:
Charles J. Cliffe 2015-01-15 20:37:51 -05:00
parent 15347bd791
commit c04779e91b
6 changed files with 161 additions and 95 deletions

View File

@ -61,6 +61,34 @@ DefaultColorTheme::DefaultColorTheme() {
generalBackground = RGBColor(0.1, 0.1, 0.1); generalBackground = RGBColor(0.1, 0.1, 0.1);
} }
RadarColorTheme::RadarColorTheme() {
name = "Rad";
waterfallGradient.addColor(GradientColor(5.0 / 255.0, 45.0 / 255.0, 10.0 / 255.0));
waterfallGradient.addColor(GradientColor(30.0 / 255.0, 150.0 / 255.0, 40.0 / 255.0));
waterfallGradient.addColor(GradientColor(40.0 / 255.0, 240.0 / 255.0, 60.0 / 255.0));
waterfallGradient.addColor(GradientColor(250.0 / 255.0, 250.0 / 255.0, 250.0 / 255.0));
waterfallGradient.generate(256);
waterfallHighlight = RGBColor(1, 1, 1);
waterfallNew = RGBColor(0, 1, 0);
waterfallHover = RGBColor(1, 1, 0);
waterfallDestroy = RGBColor(1, 0, 0);
fftLine = RGBColor(0.8, 1.0, 0.8);
fftHighlight = RGBColor(1, 1, 1);
scopeLine = RGBColor(0.8, 1.0, 0.8);
tuningBar = RGBColor(0.2, 0.9, 0.2);
meterLevel = RGBColor(0, 0.5, 0);
meterValue = RGBColor(0, 0.5, 0);
text = RGBColor(0.8, 1.0, 0.8);
freqLine = RGBColor(1, 1, 1);
button = RGBColor(0.65, 0.75, 0.65);
buttonHighlight = RGBColor(0.65, 1.0, 0.65);
scopeBackground = RGBColor(0.05, 0.1, 0.05);
fftBackground = RGBColor(0.05, 0.1, 0.05);
generalBackground = RGBColor(0.05, 0.1, 0.05);
}
BlackAndWhiteColorTheme::BlackAndWhiteColorTheme() { BlackAndWhiteColorTheme::BlackAndWhiteColorTheme() {
name = "Black & White"; name = "Black & White";
waterfallGradient.addColor(GradientColor(0, 0, 0)); waterfallGradient.addColor(GradientColor(0, 0, 0));
@ -108,14 +136,14 @@ SharpColorTheme::SharpColorTheme() {
waterfallDestroy = RGBColor(1, 0, 0); waterfallDestroy = RGBColor(1, 0, 0);
fftLine = RGBColor(0.9, 0.9, 1.0); fftLine = RGBColor(0.9, 0.9, 1.0);
fftHighlight = RGBColor(0.9, 0.9, 1.0); fftHighlight = RGBColor(0.9, 0.9, 1.0);
scopeLine = RGBColor(0.9, 0.9, 1.0); scopeLine = RGBColor(0.85, 0.85, 1.0);
tuningBar = RGBColor(0.2, 0.2, 0.9); tuningBar = RGBColor(0.2, 0.2, 0.9);
meterLevel = RGBColor(28.0/255.0,106.0/255.0,179.0/255.0); meterLevel = RGBColor(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
meterValue = RGBColor(190.0/255.0,190.0/255.0,60.0/255.0); meterValue = RGBColor(190.0 / 255.0, 190.0 / 255.0, 60.0 / 255.0);
text = RGBColor(0.9, 0.9, 1); text = RGBColor(0.9, 0.9, 1);
freqLine = RGBColor(0.9, 0.9, 1); freqLine = RGBColor(0.85, 0.85, 1.0);
button = RGBColor(217.0/255.0,218.0/255.0,228.0/255.0); button = RGBColor(217.0 / 255.0, 218.0 / 255.0, 228.0 / 255.0);
buttonHighlight= RGBColor(208.0/255.0,249.0/255.0,255.0/255.0); buttonHighlight = RGBColor(208.0 / 255.0, 249.0 / 255.0, 255.0 / 255.0);
scopeBackground = RGBColor(0.05, 0.05, 0.15); scopeBackground = RGBColor(0.05, 0.05, 0.15);
fftBackground = RGBColor(0.05, 0.05, 0.15); fftBackground = RGBColor(0.05, 0.05, 0.15);
@ -134,23 +162,27 @@ RadColorTheme::RadColorTheme() {
waterfallNew = RGBColor(0, 1, 0); waterfallNew = RGBColor(0, 1, 0);
waterfallHover = RGBColor(1, 1, 0); waterfallHover = RGBColor(1, 1, 0);
waterfallDestroy = RGBColor(1, 0, 0); waterfallDestroy = RGBColor(1, 0, 0);
fftLine = RGBColor(0.9, 0.9, 0.9); fftLine = RGBColor(1.0, 0.9, 0.9);
fftHighlight = RGBColor(1, 1, 1); fftHighlight = RGBColor(1, 1, 1);
scopeLine = RGBColor(0.9, 0.9, 0.9); scopeLine = RGBColor(1.0, 0.9, 0.9);
tuningBar = RGBColor(0.2, 0.2, 0.9); tuningBar = RGBColor(0.2, 0.2, 0.9);
meterLevel = RGBColor(0, 1, 0); meterLevel = RGBColor(0, 0.5, 0);
meterValue = RGBColor(1, 0, 0); meterValue = RGBColor(0.5, 0, 0);
text = RGBColor(1, 1, 1); text = RGBColor(1, 1, 1);
freqLine = RGBColor(1, 1, 1); freqLine = RGBColor(1, 1, 1);
button = RGBColor(0.65, 0.65, 0.65); button = RGBColor(0.65, 0.65, 0.65);
buttonHighlight = RGBColor(1, 1, 0); buttonHighlight = RGBColor(0.76, 0.65, 0);
scopeBackground = RGBColor(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
fftBackground = RGBColor(0, 0, 50.0 / 255.0);
generalBackground = RGBColor(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
} }
TouchColorTheme::TouchColorTheme() { TouchColorTheme::TouchColorTheme() {
name = "Touch"; name = "Touch";
waterfallGradient.addColor(GradientColor(0, 0, 0)); waterfallGradient.addColor(GradientColor(0, 0, 0));
waterfallGradient.addColor(GradientColor(55.0 / 255.0, 40.0 / 255.0, 55.0 / 255.0)); waterfallGradient.addColor(GradientColor(55.0 / 255.0, 40.0 / 255.0, 55.0 / 255.0));
waterfallGradient.addColor(GradientColor(60.0 / 255.0, 60.0 / 255.0, 90.0 / 255.0)); waterfallGradient.addColor(GradientColor(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0));
waterfallGradient.addColor(GradientColor(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0)); waterfallGradient.addColor(GradientColor(0.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0));
waterfallGradient.addColor(GradientColor(10.0 / 255.0, 255.0 / 255.0, 85.0 / 255.0)); waterfallGradient.addColor(GradientColor(10.0 / 255.0, 255.0 / 255.0, 85.0 / 255.0));
waterfallGradient.addColor(GradientColor(255.0 / 255.0, 255.0 / 255.0, 75.0 / 255.0)); waterfallGradient.addColor(GradientColor(255.0 / 255.0, 255.0 / 255.0, 75.0 / 255.0));
@ -161,16 +193,21 @@ TouchColorTheme::TouchColorTheme() {
waterfallNew = RGBColor(0, 1, 0); waterfallNew = RGBColor(0, 1, 0);
waterfallHover = RGBColor(1, 1, 0); waterfallHover = RGBColor(1, 1, 0);
waterfallDestroy = RGBColor(1, 0, 0); waterfallDestroy = RGBColor(1, 0, 0);
fftLine = RGBColor(0.9, 0.9, 0.9); fftLine = RGBColor(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
fftHighlight = RGBColor(1, 1, 1); fftHighlight = RGBColor(1.0, 1.0, 1.0);
scopeLine = RGBColor(0.9, 0.9, 0.9); scopeLine = RGBColor(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
tuningBar = RGBColor(0.2, 0.2, 0.9); tuningBar = RGBColor(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
meterLevel = RGBColor(0, 1, 0); meterLevel = RGBColor(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
meterValue = RGBColor(1, 0, 0); meterValue = RGBColor(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
text = RGBColor(1, 1, 1); text = RGBColor(1, 1, 1);
freqLine = RGBColor(1, 1, 1); freqLine = RGBColor(1, 1, 1);
button = RGBColor(0.65, 0.65, 0.65); button = RGBColor(1.0, 1.0, 1.0);
buttonHighlight = RGBColor(1, 1, 0); buttonHighlight = RGBColor(208.0 / 255.0, 202.0 / 255.0, 247.0 / 255.0);
scopeBackground = RGBColor(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
fftBackground = RGBColor(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
generalBackground = RGBColor(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
} }
HDColorTheme::HDColorTheme() { HDColorTheme::HDColorTheme() {
@ -191,39 +228,17 @@ HDColorTheme::HDColorTheme() {
fftLine = RGBColor(0.9, 0.9, 0.9); fftLine = RGBColor(0.9, 0.9, 0.9);
fftHighlight = RGBColor(1, 1, 1); fftHighlight = RGBColor(1, 1, 1);
scopeLine = RGBColor(0.9, 0.9, 0.9); scopeLine = RGBColor(0.9, 0.9, 0.9);
tuningBar = RGBColor(0.2, 0.2, 0.9); tuningBar = RGBColor(0, 0.7, 0.7);
meterLevel = RGBColor(0, 1, 0); meterLevel = RGBColor(0, 0.5, 0);
meterValue = RGBColor(1, 0, 0); meterValue = RGBColor(0.0, 0.0, 1.0);
text = RGBColor(1, 1, 1); text = RGBColor(1, 1, 1);
freqLine = RGBColor(1, 1, 1); freqLine = RGBColor(1, 1, 1);
button = RGBColor(0.65, 0.65, 0.65); button = RGBColor(0, 0.7, 0.7);
buttonHighlight = RGBColor(1, 1, 0); buttonHighlight = RGBColor(1, 1, 1);
}
scopeBackground = RGBColor(0.0, 0.0, 48.0 / 255.0);
RadarColorTheme::RadarColorTheme() { fftBackground = RGBColor(0.0, 0.0, 48.0 / 255.0);
name = "Rad"; generalBackground = RGBColor(0.0, 0.0, 0.0);
waterfallGradient.addColor(GradientColor(5.0 / 255.0, 45.0 / 255.0, 10.0 / 255.0));
waterfallGradient.addColor(GradientColor(30.0 / 255.0, 150.0 / 255.0, 40.0 / 255.0));
waterfallGradient.addColor(GradientColor(40.0 / 255.0, 240.0 / 255.0, 60.0 / 255.0));
waterfallGradient.addColor(GradientColor(250.0 / 255.0, 250.0 / 255.0, 250.0 / 255.0));
waterfallGradient.generate(256);
waterfallHighlight = RGBColor(1, 1, 1);
waterfallNew = RGBColor(0, 1, 0);
waterfallHover = RGBColor(1, 1, 0);
waterfallDestroy = RGBColor(1, 0, 0);
fftLine = RGBColor(0.8, 1.0, 0.8);
fftHighlight = RGBColor(1, 1, 1);
scopeLine = RGBColor(0.8, 1.0, 0.8);
tuningBar = RGBColor(0.2, 0.9, 0.2);
meterLevel = RGBColor(0, 0.5, 0);
meterValue = RGBColor(0, 0.5, 0);
text = RGBColor(0.8, 1.0, 0.8);
freqLine = RGBColor(1, 1, 1);
button = RGBColor(0.65, 0.75, 0.65);
buttonHighlight = RGBColor(0.65, 1.0, 0.65);
scopeBackground = RGBColor(0.05, 0.1, 0.05);
fftBackground = RGBColor(0.05, 0.1, 0.05);
generalBackground = RGBColor(0.05, 0.1, 0.05);
} }

View File

@ -53,7 +53,7 @@ void ModeSelectorContext::DrawSelector(std::string label, int c, int cMax, bool
glEnd(); glEnd();
if (on) { if (on) {
glColor4f(1.0-r, 1.0-g, 1.0-b, a); glColor4f(0, 0, 0, a);
} }
getFont(fontSize).drawString(label, 0.0, y + height / 2.0, fontHeight, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER); getFont(fontSize).drawString(label, 0.0, y + height / 2.0, fontHeight, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);

View File

@ -116,7 +116,7 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, float r, float
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_DST_COLOR); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(r, g, b, 0.6); glColor4f(r, g, b, 0.6);
float ofs = ((float) demod->getBandwidth()) / (float) srate; float ofs = ((float) demod->getBandwidth()) / (float) srate;

View File

@ -5,67 +5,105 @@
ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext) : ScopeContext::ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext) :
PrimaryGLContext(canvas, sharedContext) { PrimaryGLContext(canvas, sharedContext) {
glDisable(GL_CULL_FACE); glDisable (GL_CULL_FACE);
glDisable(GL_DEPTH_TEST); glDisable (GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION); glMatrixMode (GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
} }
void ScopeContext::DrawBegin() { void ScopeContext::DrawBegin() {
glClearColor(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b, 1.0); glClearColor(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g,
ThemeMgr::mgr.currentTheme->scopeBackground.b, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW); glMatrixMode (GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
glDisable(GL_TEXTURE_2D); glDisable (GL_TEXTURE_2D);
} }
void ScopeContext::Plot(std::vector<float> &points, bool stereo) { void ScopeContext::Plot(std::vector<float> &points, bool stereo) {
if (stereo) {
glBegin(GL_QUADS); glBegin(GL_QUADS);
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.g*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.b*2.0); glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b);
glVertex2f(1, 1); glVertex2f(1, 1);
glVertex2f(-1, 1); glVertex2f(-1, 1);
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.g*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.b*2.0);
glVertex2f(-1, 0.5);
glVertex2f(1, 0.5);
glVertex2f(-1, 0.5);
glVertex2f(1, 0.5);
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b); glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b);
glVertex2f(1, 0.0);
glVertex2f(-1, 0.0);
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b);
glVertex2f(1, 0);
glVertex2f(-1, 0);
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.g*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.b*2.0);
glVertex2f(-1, -0.5);
glVertex2f(1, -0.5);
glVertex2f(-1, -0.5);
glVertex2f(1, -0.5);
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b);
glVertex2f(1, -1.0);
glVertex2f(-1, -1.0);
glEnd();
} else {
glBegin (GL_QUADS);
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g,
ThemeMgr::mgr.currentTheme->scopeBackground.b);
glVertex2f(1, 1);
glVertex2f(-1, 1);
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r * 2.0, ThemeMgr::mgr.currentTheme->scopeBackground.g * 2.0,
ThemeMgr::mgr.currentTheme->scopeBackground.b * 2.0);
glVertex2f(-1, 0); glVertex2f(-1, 0);
glVertex2f(1, 0); glVertex2f(1, 0);
glVertex2f(-1, 0); glVertex2f(-1, 0);
glVertex2f(1, 0); glVertex2f(1, 0);
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.g*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.b*2.0); glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g,
ThemeMgr::mgr.currentTheme->scopeBackground.b);
glVertex2f(1, -1); glVertex2f(1, -1);
glVertex2f(-1, -1); glVertex2f(-1, -1);
glEnd(); glEnd();
}
glColor3f(1.0, 1.0, 1.0); glLineWidth(1.0);
if (stereo) { if (stereo) {
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r, ThemeMgr::mgr.currentTheme->scopeLine.g, ThemeMgr::mgr.currentTheme->scopeLine.b); glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r, ThemeMgr::mgr.currentTheme->scopeLine.g, ThemeMgr::mgr.currentTheme->scopeLine.b);
glBegin(GL_LINES); glBegin (GL_LINES);
glVertex2f(-1.0, 0.0); glVertex2f(-1.0, 0.0);
glVertex2f(1.0, 0.0); glVertex2f(1.0, 0.0);
glEnd(); glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r * 0.35, ThemeMgr::mgr.currentTheme->scopeLine.g * 0.35,
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r*0.35, ThemeMgr::mgr.currentTheme->scopeLine.g*0.35, ThemeMgr::mgr.currentTheme->scopeLine.b*0.35); ThemeMgr::mgr.currentTheme->scopeLine.b * 0.35);
glBegin(GL_LINES);
glVertex2f(-1.0, 0.5); glVertex2f(-1.0, 0.5);
glVertex2f(1.0, 0.5); glVertex2f(1.0, 0.5);
glVertex2f(-1.0, -0.5); glVertex2f(-1.0, -0.5);
glVertex2f(1.0, -0.5); glVertex2f(1.0, -0.5);
glEnd(); glEnd();
} else { } else {
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r*0.35, ThemeMgr::mgr.currentTheme->scopeLine.g*0.35, ThemeMgr::mgr.currentTheme->scopeLine.b*0.35); glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r * 0.35, ThemeMgr::mgr.currentTheme->scopeLine.g * 0.35,
glBegin(GL_LINES); ThemeMgr::mgr.currentTheme->scopeLine.b * 0.35);
glBegin (GL_LINES);
glVertex2f(-1.0, 0.0); glVertex2f(-1.0, 0.0);
glVertex2f(1.0, 0.0); glVertex2f(1.0, 0.0);
glEnd(); glEnd();
} }
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r, ThemeMgr::mgr.currentTheme->scopeLine.g, ThemeMgr::mgr.currentTheme->scopeLine.b);
if (points.size()) { if (points.size()) {
glEnableClientState(GL_VERTEX_ARRAY); glEnable (GL_BLEND);
glEnable (GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(ThemeMgr::mgr.currentTheme->scopeLine.r, ThemeMgr::mgr.currentTheme->scopeLine.g, ThemeMgr::mgr.currentTheme->scopeLine.b, 1.0);
glEnableClientState (GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, &points[0]); glVertexPointer(2, GL_FLOAT, 0, &points[0]);
if (stereo) { if (stereo) {
glLineWidth(1.5);
glPushMatrix(); glPushMatrix();
glTranslatef(-1.0f, 0.5f, 0.0f); glTranslatef(-1.0f, 0.5f, 0.0f);
glScalef(4.0f, 0.92f, 1.0f); glScalef(4.0f, 0.92f, 1.0f);
@ -80,24 +118,26 @@ void ScopeContext::Plot(std::vector<float> &points, bool stereo) {
glPopMatrix(); glPopMatrix();
glPopMatrix(); glPopMatrix();
} else { } else {
glLineWidth(1.5);
glPushMatrix(); glPushMatrix();
glTranslatef(-1.0f, 0.0f, 0.0f); glTranslatef(-1.0f, 0.0f, 0.0f);
glScalef(2.0f, 2.0f, 1.0f); glScalef(2.0f, 2.0f, 1.0f);
glDrawArrays(GL_LINE_STRIP, 0, points.size() / 2); glDrawArrays(GL_LINE_STRIP, 0, points.size() / 2);
glPopMatrix(); glPopMatrix();
} }
glLineWidth(1.0);
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glDisable(GL_BLEND);
} }
} }
void ScopeContext::DrawDeviceName(std::string deviceName) { void ScopeContext::DrawDeviceName(std::string deviceName) {
GLint vp[4]; GLint vp[4];
glGetIntegerv( GL_VIEWPORT, vp); glGetIntegerv(GL_VIEWPORT, vp);
float viewHeight = (float) vp[3]; float viewHeight = (float) vp[3];
float hPos = (float) (viewHeight - 20) / viewHeight; float hPos = (float) (viewHeight - 20) / viewHeight;
glColor3f(0.65,0.65,0.65); glColor3f(0.65, 0.65, 0.65);
getFont(PrimaryGLContext::GLFONT_SIZE12).drawString(deviceName.c_str(), 1.0, hPos, 12, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER); getFont(PrimaryGLContext::GLFONT_SIZE12).drawString(deviceName.c_str(), 1.0, hPos, 12, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
} }
@ -109,7 +149,7 @@ void ScopeContext::DrawEnd() {
void ScopeContext::DrawDivider() { void ScopeContext::DrawDivider() {
glColor3f(1.0, 1.0, 1.0); glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINES); glBegin (GL_LINES);
glVertex2f(0.0, -1.0); glVertex2f(0.0, -1.0);
glVertex2f(0.0, 1.0); glVertex2f(0.0, 1.0);
glEnd(); glEnd();

View File

@ -19,18 +19,22 @@ SpectrumContext::SpectrumContext(SpectrumCanvas *canvas, wxGLContext *sharedCont
void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandwidth) { void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandwidth) {
glBegin(GL_QUADS); glBegin(GL_QUADS);
glColor3f(ThemeMgr::mgr.currentTheme->fftBackground.r*2.0, ThemeMgr::mgr.currentTheme->fftBackground.g*2.0, ThemeMgr::mgr.currentTheme->fftBackground.b*2.0);
glVertex2f(1, 1);
glVertex2f(-1, 1);
glColor3f(ThemeMgr::mgr.currentTheme->fftBackground.r, ThemeMgr::mgr.currentTheme->fftBackground.g, ThemeMgr::mgr.currentTheme->fftBackground.b); glColor3f(ThemeMgr::mgr.currentTheme->fftBackground.r, ThemeMgr::mgr.currentTheme->fftBackground.g, ThemeMgr::mgr.currentTheme->fftBackground.b);
glVertex2f(-1, -0.5); glVertex2f(1, 0.5);
glVertex2f(1, -0.5); glVertex2f(-1, 0.5);
glColor3f(ThemeMgr::mgr.currentTheme->fftBackground.r*2.0, ThemeMgr::mgr.currentTheme->fftBackground.g*2.0, ThemeMgr::mgr.currentTheme->fftBackground.b*2.0);
glVertex2f(-1, -1);
glVertex2f(1, -1);
glEnd(); glEnd();
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glColor3f(ThemeMgr::mgr.currentTheme->fftLine.r, ThemeMgr::mgr.currentTheme->fftLine.g, ThemeMgr::mgr.currentTheme->fftLine.b); glColor3f(ThemeMgr::mgr.currentTheme->fftLine.r, ThemeMgr::mgr.currentTheme->fftLine.g, ThemeMgr::mgr.currentTheme->fftLine.b);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (points.size()) { if (points.size()) {
glPushMatrix(); glPushMatrix();
glTranslatef(-1.0f, -0.75f, 0.0f); glTranslatef(-1.0f, -0.75f, 0.0f);

View File

@ -40,10 +40,17 @@ void TuningContext::DrawBegin() {
void TuningContext::Draw(float r, float g, float b, float a, float p1, float p2) { void TuningContext::Draw(float r, float g, float b, float a, float p1, float p2) {
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
glColor4f(r, g, b, a);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glColor4f(r*0.5, g*0.5, b*0.5, a);
glVertex2f(-1.0+p2*2.0, 1.0); glVertex2f(-1.0+p2*2.0, 1.0);
glVertex2f(-1.0+p1*2.0, 1.0); glVertex2f(-1.0+p1*2.0, 1.0);
glColor4f(r, g, b, a);
glVertex2f(-1.0+p1*2.0, 0.0);
glVertex2f(-1.0+p2*2.0, 0.0);
glVertex2f(-1.0+p2*2.0, 0.0);
glVertex2f(-1.0+p1*2.0, 0.0);
glColor4f(r*0.5, g*0.5, b*0.5, a);
glVertex2f(-1.0+p1*2.0, -1.0); glVertex2f(-1.0+p1*2.0, -1.0);
glVertex2f(-1.0+p2*2.0, -1.0); glVertex2f(-1.0+p2*2.0, -1.0);
glEnd(); glEnd();
@ -77,7 +84,7 @@ void TuningContext::DrawDemodFreqBw(long long freq, unsigned int bw, long long c
getFont(fontSize).drawString("Freq: ", -0.75, 0, fontHeight, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER); getFont(fontSize).drawString("Freq: ", -0.75, 0, fontHeight, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
if (bw) { if (bw) {
freqStr.str(""); freqStr.str("");
freqStr << std::fixed << freq << "Hz"; freqStr << std::fixed << freq << " Hz";
} else { } else {
freqStr.str("---"); freqStr.str("---");
} }
@ -87,7 +94,7 @@ void TuningContext::DrawDemodFreqBw(long long freq, unsigned int bw, long long c
getFont(fontSize).drawString("BW: ", -0.10, 0, fontHeight, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER); getFont(fontSize).drawString("BW: ", -0.10, 0, fontHeight, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
if (bw) { if (bw) {
freqStr.str(""); freqStr.str("");
freqStr << std::fixed << bw << "Hz"; freqStr << std::fixed << bw << " Hz";
} else { } else {
freqStr.str("---"); freqStr.str("---");
} }
@ -97,7 +104,7 @@ void TuningContext::DrawDemodFreqBw(long long freq, unsigned int bw, long long c
getFont(fontSize).drawString("CTR: ", 0.50, 0, fontHeight, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER); getFont(fontSize).drawString("CTR: ", 0.50, 0, fontHeight, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
if (center) { if (center) {
freqStr.str(""); freqStr.str("");
freqStr << std::fixed << center << "Hz"; freqStr << std::fixed << center << " Hz";
} else { } else {
freqStr.str("---"); freqStr.str("---");
} }