void View::initWindow(){ glfwInit(); // init GLFW and open an OpenGL Window glfwOpenWindowHint(GLFW_WINDOW_NO_RESIZE, GL_TRUE); // disable resize glfwOpenWindow(windowWidth, windowHeight, 8, 8, 8, 8, 24, 0, GLFW_WINDOW); glfwSetWindowTitle("PolyFun"); // init viewport to canvassize glViewport( 0, 0, windowWidth, windowHeight); // projection matrix with clipping planes in three directions (same as window size and +- 1 in z) glMatrixMode( GL_PROJECTION); glLoadIdentity(); glOrtho( 0, windowWidth, windowHeight, 0, -1, 1); // modelview transform (identity) glMatrixMode( GL_MODELVIEW); glLoadIdentity(); // enable blending for soft lines glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glClearColor(1.0, 1.0, 1.0, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // display buttons and canvas displayBase(); glfwDisable(GLFW_AUTO_POLL_EVENTS); glfwSwapBuffers(); }
void View::updateWindow(void){ // clear canvas and set background color glClearColor(1.0, 1.0, 1.0, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); polygonM->drawPolygons(); try{ displayBase(); } catch(...){ throw eFileNotFoundException(); } glfwDisable(GLFW_AUTO_POLL_EVENTS); // disables glfwPollEvents which is called implicitly by glfwSwapBuffers, in order to swap the buffers faster while updating the window glfwSwapBuffers(); }
QString CharDataInformation::valueString(quint8 value) { QChar qchar = QChar::fromLatin1(value); qchar = qchar.isPrint() ? qchar : QChar(QChar::ReplacementCharacter); QString charStr = QLatin1Char('\'') + qchar + QLatin1Char('\''); if (Kasten2::StructViewPreferences::showCharNumericalValue()) { int base = displayBase(); QString num = QString::number(value, base); if (base == 16) num.prepend(QLatin1String("0x")); if (base == 10 && Kasten2::StructViewPreferences::localeAwareDecimalFormatting()) num = KGlobal::locale()->formatNumber(num, false, 0); charStr += QLatin1String(" (") + num + QLatin1Char(')'); } return charStr; }