int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutCreateWindow("Project 4: Inverse Kinematics"); GLenum err = glewInit() ; if (GLEW_OK != err) { std::cerr << "Error: " << glewGetString(err) << std::endl; } initShading(); initShapes(); createTwoTentacles(); /*createNTentacles(2, glm::vec3(0, 1, 0), glm::vec3(0, 0, 90), 1); createNTentacles(3, glm::vec3(-1, 0, 0), glm::vec3(0, 0, -180), 1); createNTentacles(4, glm::vec3(0, -1, 0), glm::vec3(0, 0, -90), 1); createNTentacles(5, glm::vec3(0, 0, 1), glm::vec3(0, -90, 0), 1); createNTentacles(6, glm::vec3(0, 0, -1), glm::vec3(0, 90, 0), 1);*/ glutDisplayFunc(display); glutSpecialFunc(specialKey); glutKeyboardFunc(keyboard); glutReshapeFunc(reshape); glutMouseFunc(mouse) ; glutMotionFunc(mousedrag) ; glutReshapeWindow(800, 800); glutMainLoop(); return 0; }
//------------------------------------------------------------------------------ int main(int argc, char ** argv) { int levels=5, total=0; for (int i=1; i<argc; ++i) { if ((not strcmp(argv[i],"-s")) or (not strcmp(argv[i],"-strict"))) { g_allowWeakRegression=false; } else if ((not strcmp(argv[i],"-v")) or (not strcmp(argv[i],"-verbose"))) { g_verbose=true; } else { usage( argv[1] ); return 1; } } initShapes(); printf("Baseline Path : \"%s\"\n", g_baseline_path.c_str()); for (int i=0; i<(int)g_shapes.size(); ++i) total+=checkMesh( g_shapes[i], levels ); if (total==0) { printf("All tests passed.\n"); if(g_strictRegressionFailure) printf("Some tests were not bit-wise accurate.\n" "Rerun with -s for strict regression\n"); } else printf("Total failures : %d\n", total); }
ClientCodingWindow::ClientCodingWindow( ) : window_id(0) { initShapes(); EM_log(CK_LOG_SYSTEM, "client code win constructor" ); _content = _textcontent = new ClientTextContent(); _content->containerDirty() = true; }
void SetupGL(){ ReshapeWindow(windowWidth,windowHeight); glEnable(GL_DEPTH_TEST); glClearColor(0.0f,0.0f,0.0f,1); initShapes(); //cat.loadFromFile("grumpy.png"); }
ConsoleWindow::ConsoleWindow() : DisplayWindow(), _time_start( 0 ), _time_span ( 0 ), _active ( 0 ), m_time ( 0 ) { setContent( new ShellContent() ); initShapes(); _id = IDManager::instance()->getPickID(); }
//------------------------------------------------------------------------- // Set OpenGL program initial state. //------------------------------------------------------------------------- void init () { // Set the frame buffer clear color to black. glClearColor (0.0, 0.0, 0.0, 0.0); // Initialize shapes' attributes initShapes (); // Display Help Message displayHelp (); }
CodeWindow::CodeWindow(CodeRevision * r ) : DisplayWindow(), _current(NULL), _textcontent(new TextContent()) { initShapes(); //need a TextContent constructor with buf arguments _content = _textcontent; //create for existing revision setRevision(r); }
CodeWindow::CodeWindow() : DisplayWindow(), _current(NULL), _textcontent(new TextContent()) { EM_log( CK_LOG_FINER, "(audicle) CodeWindow base ctor..."); initShapes(); //a new window _content = _textcontent; setRevision(new CodeRevision()); }
ClientCodingWindow::ClientCodingWindow ( ClientCodeBuffer * b ) : CodeWindow(b), window_id(0) { EM_log(CK_LOG_SYSTEM, "client win w buffer constructor" ); initShapes(); //need a TextContent constructor with buf arguments _content = _textcontent = new ClientTextContent(); _content->containerDirty() = true; //create for existing revision setClientCodeBuffer(b); }
//------------------------------------------------------------------------------ int main(int argc, char ** argv) { int levels=5; initShapes(); parseArgs(argc, argv); if ( g_objfile.size() ) { FILE * handle = fopen( g_objfile.c_str(), "rt" ); if (not handle) { printf("Could not open \"%s\" - aborting.\n", g_objfile.c_str()); exit(0); } fseek( handle, 0, SEEK_END ); size_t size = ftell(handle); fseek( handle, 0, SEEK_SET ); char * shapeStr = new char[size]; if ( fread( shapeStr, size, 1, handle)!=1 ) { printf("Error reading \"%s\" - aborting.\n", g_objfile.c_str()); exit(0); } fclose(handle); generate( shapeStr, g_objfile.c_str(), levels, g_scheme ); delete [] shapeStr; } else if (g_shapeindex>=0) { if (g_shapeindex==(int)g_shapes.size()) { for (int i=0; i<(int)g_shapes.size(); ++i) generate( g_shapes[i].data.c_str(), g_shapes[i].name.c_str(), levels, g_shapes[i].scheme); } else generate( g_shapes[g_shapeindex].data.c_str(), g_shapes[g_shapeindex].name.c_str(), levels, g_shapes[g_shapeindex].scheme); } }
//------------------------------------------------------------------------------ /// Program entry point /// Initialize then start rendering int main( int argc, char** argv ) { initShapes( ); // initialize OpenGL glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_ALPHA ); glutInitWindowSize( Width, Height ); glutInitWindowPosition( 100, 100 ); glutCreateWindow( title.c_str() ); init( ); // Register OpenGL callback functions glutDisplayFunc( display ); glutReshapeFunc( reshape ); glutKeyboardFunc( keyboard ); glutIdleFunc( idle ); // Start the simulation glutMainLoop( ); return 0; }
//------------------------------------------------------------------------------ int main(int argc, char ** argv) { bool fullscreen = false; std::string str; for (int i = 1; i < argc; ++i) { if (!strcmp(argv[i], "-d")) g_level = atoi(argv[++i]); else if (!strcmp(argv[i], "-c")) g_repeatCount = atoi(argv[++i]); else if (!strcmp(argv[i], "-f")) fullscreen = true; else { std::ifstream ifs(argv[1]); if (ifs) { std::stringstream ss; ss << ifs.rdbuf(); ifs.close(); str = ss.str(); g_shapes.push_back(ShapeDesc(argv[1], str.c_str(), kCatmark)); } } } initShapes(); if (not glfwInit()) { printf("Failed to initialize GLFW\n"); return 1; } static const char windowTitle[] = "OpenSubdiv vtrViewer"; #define CORE_PROFILE #ifdef CORE_PROFILE setGLCoreProfile(); #endif if (fullscreen) { g_primary = glfwGetPrimaryMonitor(); // apparently glfwGetPrimaryMonitor fails under linux : if no primary, // settle for the first one in the list if (not g_primary) { int count=0; GLFWmonitor ** monitors = glfwGetMonitors(&count); if (count) g_primary = monitors[0]; } if (g_primary) { GLFWvidmode const * vidmode = glfwGetVideoMode(g_primary); g_width = vidmode->width; g_height = vidmode->height; } } if (not (g_window=glfwCreateWindow(g_width, g_height, windowTitle, fullscreen and g_primary ? g_primary : NULL, NULL))) { printf("Failed to open window.\n"); glfwTerminate(); return 1; } glfwMakeContextCurrent(g_window); // accommocate high DPI displays (e.g. mac retina displays) glfwGetFramebufferSize(g_window, &g_width, &g_height); glfwSetFramebufferSizeCallback(g_window, reshape); glfwSetKeyCallback(g_window, keyboard); glfwSetCursorPosCallback(g_window, motion); glfwSetMouseButtonCallback(g_window, mouse); glfwSetWindowCloseCallback(g_window, windowClose); #if defined(OSD_USES_GLEW) #ifdef CORE_PROFILE // this is the only way to initialize glew correctly under core profile context. glewExperimental = true; #endif if (GLenum r = glewInit() != GLEW_OK) { printf("Failed to initialize glew. Error = %s\n", glewGetErrorString(r)); exit(1); } #ifdef CORE_PROFILE // clear GL errors which was generated during glewInit() glGetError(); #endif #endif initGL(); glfwSwapInterval(0); initHUD(); rebuildOsdMeshes(); checkGLErrors("before loop"); while (g_running) { idle(); display(); glfwPollEvents(); glfwSwapBuffers(g_window); glFinish(); } uninitGL(); glfwTerminate(); }
void StyleManager::setDefaultShape(propertyId_t type,AbstractShape * f){ if(type>=shapeRegistry.size()) initShapes(type+1); shapeRegistry[type][0]=f; }
void StyleManager::pushShape(propertyId_t type,AbstractShape * s){ if(type>=shapeRegistry.size()) initShapes(type+1); shapeRegistry[type].push_back(s); }