Merge pull request #34 from cjcliffe/issue33-linux-setcurrent

GL context init fixes and warning cleanup
This commit is contained in:
Charles J. Cliffe 2015-01-20 20:45:15 -05:00
commit 3657ce38bc
12 changed files with 33 additions and 20 deletions

View File

@ -237,7 +237,6 @@ include_directories (
${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/external/rtaudio ${PROJECT_SOURCE_DIR}/external/rtaudio
${PROJECT_SOURCE_DIR}/external/lodepng ${PROJECT_SOURCE_DIR}/external/lodepng
${PROJECT_SOURCE_DIR}/external/fastlz
${PROJECT_SOURCE_DIR}/external/tinyxml ${PROJECT_SOURCE_DIR}/external/tinyxml
) )

View File

@ -559,4 +559,6 @@ bool AppFrame::loadSession(std::string fileName) {
GetStatusBar()->SetStatusText(wxString::Format(wxT("Loaded session file: %s"), currentSessionFile.c_str())); GetStatusBar()->SetStatusText(wxString::Format(wxT("Loaded session file: %s"), currentSessionFile.c_str()));
SetTitle(wxString::Format(wxT("%s: %s"), CUBICSDR_TITLE, filePart.c_str())); SetTitle(wxString::Format(wxT("%s: %s"), CUBICSDR_TITLE, filePart.c_str()));
return true;
} }

View File

@ -122,8 +122,6 @@ PrimaryGLContext& CubicSDR::GetContext(wxGLCanvas *canvas) {
} }
glContext = m_glContext; glContext = m_glContext;
glContext->SetCurrent(*canvas);
return *glContext; return *glContext;
} }

View File

@ -20,7 +20,7 @@
class CubicSDR: public wxApp { class CubicSDR: public wxApp {
public: public:
CubicSDR() : CubicSDR() :
m_glContext(NULL), frequency(DEFAULT_FREQ), sdrThread(NULL), sdrPostThread(NULL), threadCmdQueueSDR(NULL), iqVisualQueue(NULL), iqPostDataQueue(NULL), audioVisualQueue(NULL), t_SDR(NULL), t_PostSDR(NULL), sampleRate(DEFAULT_SAMPLE_RATE) { m_glContext(NULL), frequency(DEFAULT_FREQ), sdrThread(NULL), sdrPostThread(NULL), threadCmdQueueSDR(NULL), iqVisualQueue(NULL), iqPostDataQueue(NULL), audioVisualQueue(NULL), t_SDR(NULL), t_PostSDR(NULL), sampleRate(DEFAULT_SAMPLE_RATE), offset(0) {
} }

View File

@ -292,7 +292,6 @@ void DemodulatorInstance::setFrequency(long long freq) {
command.llong_value = freq; command.llong_value = freq;
threadQueueCommand->push(command); threadQueueCommand->push(command);
} }
demodulatorPreThread->getParams().bandwidth;
} }
long long DemodulatorInstance::getFrequency() { long long DemodulatorInstance::getFrequency() {

View File

@ -100,6 +100,8 @@ void DemodulatorPreThread::threadMain() {
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_SET_FREQUENCY: case DemodulatorThreadCommand::DEMOD_THREAD_CMD_SET_FREQUENCY:
params.frequency = command.llong_value; params.frequency = command.llong_value;
break; break;
default:
break;
} }
} }
} }
@ -227,6 +229,8 @@ void DemodulatorPreThread::threadMain() {
params.bandwidth = result.bandwidth; params.bandwidth = result.bandwidth;
params.sampleRate = result.sampleRate; params.sampleRate = result.sampleRate;
break;
default:
break; break;
} }
} }
@ -243,6 +247,10 @@ void DemodulatorPreThread::threadMain() {
tCmd.context = this; tCmd.context = this;
threadQueueNotify->push(tCmd); threadQueueNotify->push(tCmd);
std::cout << "Demodulator preprocessor thread done." << std::endl; std::cout << "Demodulator preprocessor thread done." << std::endl;
#ifdef __APPLE__
return this;
#endif
} }
void DemodulatorPreThread::terminate() { void DemodulatorPreThread::terminate() {

View File

@ -410,6 +410,10 @@ void DemodulatorThread::threadMain() {
tCmd.context = this; tCmd.context = this;
threadQueueNotify->push(tCmd); threadQueueNotify->push(tCmd);
std::cout << "Demodulator thread done." << std::endl; std::cout << "Demodulator thread done." << std::endl;
#ifdef __APPLE__
return this;
#endif
} }
void DemodulatorThread::setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue) { void DemodulatorThread::setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue) {

View File

@ -27,6 +27,8 @@ void DemodulatorWorkerThread::threadMain() {
filterChanged = true; filterChanged = true;
filterCommand = command; filterCommand = command;
break; break;
default:
break;
} }
done = commandQueue->empty(); done = commandQueue->empty();
} }

View File

@ -45,7 +45,7 @@ void MeterCanvas::setMax(float max_in) {
level_max = max_in; level_max = max_in;
} }
bool MeterCanvas::setInputValue(float slider_in) { void MeterCanvas::setInputValue(float slider_in) {
userInputValue = inputValue = slider_in; userInputValue = inputValue = slider_in;
} }

View File

@ -23,7 +23,7 @@ public:
void setMax(float max_in); void setMax(float max_in);
bool setInputValue(float slider_in); void setInputValue(float slider_in);
bool inputChanged(); bool inputChanged();
float getInputValue(); float getInputValue();

View File

@ -4,14 +4,12 @@
MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext) : MeterContext::MeterContext(MeterCanvas *canvas, wxGLContext *sharedContext) :
PrimaryGLContext(canvas, sharedContext) { PrimaryGLContext(canvas, sharedContext) {
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
} }
void MeterContext::DrawBegin() { void MeterContext::DrawBegin() {
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glClearColor(ThemeMgr::mgr.currentTheme->generalBackground.r, ThemeMgr::mgr.currentTheme->generalBackground.g, ThemeMgr::mgr.currentTheme->generalBackground.b, 1.0); glClearColor(ThemeMgr::mgr.currentTheme->generalBackground.r, ThemeMgr::mgr.currentTheme->generalBackground.g, ThemeMgr::mgr.currentTheme->generalBackground.b, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

View File

@ -53,14 +53,14 @@ void PrimaryGLContext::CheckGLError() {
PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext) : PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContext) :
wxGLContext(canvas, sharedContext) { wxGLContext(canvas, sharedContext) {
SetCurrent(*canvas); //#ifndef __linux__
#ifndef __linux__ // SetCurrent(*canvas);
// Pre-load fonts // // Pre-load fonts
for (int i = 0; i < GLFONT_MAX; i++) { // for (int i = 0; i < GLFONT_MAX; i++) {
getFont((GLFontSize) i); // getFont((GLFontSize) i);
} // }
CheckGLError(); // CheckGLError();
#endif //#endif
} }
GLFont &PrimaryGLContext::getFont(GLFontSize esize) { GLFont &PrimaryGLContext::getFont(GLFontSize esize) {
@ -86,6 +86,9 @@ GLFont &PrimaryGLContext::getFont(GLFontSize esize) {
case GLFONT_SIZE48: case GLFONT_SIZE48:
fontName = "vera_sans_mono48.fnt"; fontName = "vera_sans_mono48.fnt";
break; break;
default:
fontName = "vera_sans_mono12.fnt";
break;
} }
fonts[esize].loadFont(fontName); fonts[esize].loadFont(fontName);