From 013e72b3346002d83dffdc05c7c7bf3b227a3ed1 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 11 Aug 2013 20:35:04 +0000 Subject: [PATCH] Fixed crash loading a project from the command line. --- common/lc_application.cpp | 10 ++-------- docs/leocad.1 | 5 ----- leocad.pro | 3 +++ qt/lc_qmainwindow.cpp | 13 +++++++++++++ 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/common/lc_application.cpp b/common/lc_application.cpp index e7dd5ed5..14f5bc83 100644 --- a/common/lc_application.cpp +++ b/common/lc_application.cpp @@ -121,9 +121,7 @@ void lcApplication::ParseStringArgument(int* CurArg, int argc, char* argv[], cha bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstallPath, const char* LibraryCachePath) { - // System setup parameters. char* LibPath = NULL; - char* GLPath = NULL; // Image output options. bool SaveImage = false; @@ -146,11 +144,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal if (Param[0] == '-') { - if (strcmp(Param, "--libgl") == 0) - { - ParseStringArgument(&i, argc, argv, &GLPath); - } - else if ((strcmp(Param, "-l") == 0) || (strcmp(Param, "--libpath") == 0)) + if ((strcmp(Param, "-l") == 0) || (strcmp(Param, "--libpath") == 0)) { ParseStringArgument(&i, argc, argv, &LibPath); } @@ -211,7 +205,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal return false; } else - console.PrintWarning("Unknown parameter: %s\n", Param); + printf("Unknown parameter: %s\n", Param); } else { diff --git a/docs/leocad.1 b/docs/leocad.1 index 2de0ad59..e8fa7215 100644 --- a/docs/leocad.1 +++ b/docs/leocad.1 @@ -90,11 +90,6 @@ of \fILeoCAD \fRuses /usr/share/leocad/ as the default. .BI "\-\-convert "srcpath dstpath Reads LDraw parts from \fIsrcpath\fR and generates a new LeoCAD Pieces Library in \fIdstpath\fR. -.TP -.BI "\-\-libgl "library -Sets the name of the OpenGL dynamic library used by the program to \fIlibrary\fR. -The default library names searched are libGL.so and libMesaGL.so. - .SH ENVIRONMENT ``LEOCAD_LIB'' may be set to the path of the pieces library. diff --git a/leocad.pro b/leocad.pro index 6cbb488d..a6462244 100644 --- a/leocad.pro +++ b/leocad.pro @@ -16,6 +16,9 @@ win32 { QMAKE_LFLAGS += /INCREMENTAL PRECOMPILED_SOURCE = common/lc_global.cpp RC_FILE = qt/leocad.rc + QMAKE_CFLAGS_DEBUG += /O0 + QMAKE_CFLAGS_RELEASE += /Zi + QMAKE_LFLAGS_RELEASE += /map /debug /opt:ref } else { LIBS += -lz QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter diff --git a/qt/lc_qmainwindow.cpp b/qt/lc_qmainwindow.cpp index 4a159d60..299b9395 100644 --- a/qt/lc_qmainwindow.cpp +++ b/qt/lc_qmainwindow.cpp @@ -50,6 +50,19 @@ lcQMainWindow::lcQMainWindow(QWidget *parent) lcPiecesLibrary* Library = lcGetPiecesLibrary(); PieceInfo* Info = Library->FindPiece("3005", false); + GL_EnableVertexBufferObject(); + + if (lcGetActiveProject()->m_pPieces) + { + for (int PieceIdx = 0; PieceIdx < Library->mPieces.GetSize(); PieceIdx++) + { + lcMesh* Mesh = Library->mPieces[PieceIdx]->mMesh; + + if (Mesh) + Mesh->UpdateBuffers(); + } + } + if (!Info) Info = Library->mPieces[0];