mirror of
https://github.com/glest/glest-source.git
synced 2025-08-12 19:33:59 +02:00
- bugfix for g3d viewer and updated wxwidgets
This commit is contained in:
@@ -480,12 +480,15 @@ void MainWindow::setupTimer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupStartupSettings() {
|
void MainWindow::setupStartupSettings() {
|
||||||
GLuint err = glewInit();
|
|
||||||
if (GLEW_OK != err) {
|
glCanvas->setCurrentGLContext();
|
||||||
|
|
||||||
|
GLuint err = glewInit();
|
||||||
|
if (GLEW_OK != err) {
|
||||||
fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
|
fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
|
||||||
//return 1;
|
//return 1;
|
||||||
throw std::runtime_error((char *)glewGetErrorString(err));
|
throw std::runtime_error((char *)glewGetErrorString(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer= Renderer::getInstance();
|
renderer= Renderer::getInstance();
|
||||||
|
|
||||||
@@ -567,12 +570,12 @@ MainWindow::~MainWindow(){
|
|||||||
void MainWindow::init() {
|
void MainWindow::init() {
|
||||||
|
|
||||||
#if wxCHECK_VERSION(2, 9, 3)
|
#if wxCHECK_VERSION(2, 9, 3)
|
||||||
glCanvas->setCurrentGLContext();
|
//glCanvas->setCurrentGLContext();
|
||||||
//printf("setcurrent #1\n");
|
//printf("setcurrent #1\n");
|
||||||
#elif wxCHECK_VERSION(2, 9, 1)
|
#elif wxCHECK_VERSION(2, 9, 1)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
glCanvas->SetCurrent();
|
//glCanvas->SetCurrent();
|
||||||
//printf("setcurrent #2\n");
|
//printf("setcurrent #2\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -585,10 +588,12 @@ void MainWindow::init() {
|
|||||||
void MainWindow::onPaint(wxPaintEvent &event) {
|
void MainWindow::onPaint(wxPaintEvent &event) {
|
||||||
if(!IsShown()) return;
|
if(!IsShown()) return;
|
||||||
|
|
||||||
#if wxCHECK_VERSION(2, 9, 3)
|
#if wxCHECK_VERSION(2, 9, 4)
|
||||||
|
//glCanvas->setCurrentGLContext();
|
||||||
|
#elif wxCHECK_VERSION(2, 9, 3)
|
||||||
|
|
||||||
#elif wxCHECK_VERSION(2, 9, 1)
|
#elif wxCHECK_VERSION(2, 9, 1)
|
||||||
glCanvas->setCurrentGLContext();
|
//glCanvas->setCurrentGLContext();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(startupSettingsInited == false) {
|
if(startupSettingsInited == false) {
|
||||||
@@ -756,8 +761,8 @@ void MainWindow::onClose(wxCloseEvent &event){
|
|||||||
delete timer;
|
delete timer;
|
||||||
timer = NULL;
|
timer = NULL;
|
||||||
|
|
||||||
delete model;
|
//delete model;
|
||||||
model = NULL;
|
//model = NULL;
|
||||||
|
|
||||||
delete renderer;
|
delete renderer;
|
||||||
renderer = NULL;
|
renderer = NULL;
|
||||||
@@ -2029,7 +2034,7 @@ GlCanvas::GlCanvas(MainWindow * mainWindow, int *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GlCanvas::~GlCanvas() {
|
GlCanvas::~GlCanvas() {
|
||||||
delete this->context;
|
if(this->context) delete this->context;
|
||||||
this->context = NULL;
|
this->context = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2039,11 +2044,13 @@ void GlCanvas::setCurrentGLContext() {
|
|||||||
#if wxCHECK_VERSION(2, 9, 1)
|
#if wxCHECK_VERSION(2, 9, 1)
|
||||||
if(this->context == NULL) {
|
if(this->context == NULL) {
|
||||||
this->context = new wxGLContext(this);
|
this->context = new wxGLContext(this);
|
||||||
|
//printf("Set ctx [%p]\n",this->context);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//printf("Set ctx [%p]\n",this->context);
|
//printf("Set ctx [%p]\n",this->context);
|
||||||
if(this->context) {
|
if(this->context) {
|
||||||
wxGLCanvas::SetCurrent(*this->context);
|
wxGLCanvas::SetCurrent(*this->context);
|
||||||
|
//printf("Set ctx2 [%p]\n",this->context);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
this->SetCurrent();
|
this->SetCurrent();
|
||||||
|
@@ -201,6 +201,7 @@ public:
|
|||||||
void onKeyDown(wxKeyEvent &event);
|
void onKeyDown(wxKeyEvent &event);
|
||||||
void setCurrentGLContext();
|
void setCurrentGLContext();
|
||||||
|
|
||||||
|
wxGLContext * getCtx() { return context; }
|
||||||
private:
|
private:
|
||||||
MainWindow *mainWindow;
|
MainWindow *mainWindow;
|
||||||
wxGLContext *context;
|
wxGLContext *context;
|
||||||
|
@@ -1099,7 +1099,7 @@ Model::Model() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Model::~Model() {
|
Model::~Model() {
|
||||||
delete [] meshes;
|
if(meshes) delete [] meshes;
|
||||||
meshes = NULL;
|
meshes = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user