int main(int argc, char **argv) { colorcube(); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutInitContextVersion( 3, 2 ); glutInitContextProfile( GLUT_CORE_PROFILE ); glutCreateWindow("colorcube"); glewExperimental = GL_TRUE; glewInit(); program = InitShader("vshader72.glsl", "fshader72.glsl"); init(); glutReshapeFunc(myReshape); glutDisplayFunc(display); glutIdleFunc(spinCube); glutMouseFunc(mouse); glutKeyboardFunc(key); glutMainLoop(); return 0; }
void DarkenManager::setupGL(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowPosition(20, 20); glutInitWindowSize(WINDOW_SIZE_WIDTH, WINDOW_SIZE_HEIGHT); glutInitContextVersion (3, 2); glutInitContextFlags(GLUT_FORWARD_COMPATIBLE | GLUT_DEBUG); glutCreateWindow( argv[0] ); glewInit(); glewExperimental = GL_TRUE; // Required in openGL 3.1 forward compatible contexts because // GL_EXTENSIONS is deprecated argument for glGetString GLenum glewErr = glewInit(); if(glewErr != GLEW_OK) { std::stringstream err; err << "Error initializing GLEW: " << glewGetErrorString(glewErr); throw std::runtime_error(err.str()); } glGetError(); // glewInit finner ikke extension stringen // men setter funksjonspekere for core funksjoner }
void InitWindow(int argc, char* argv[]) { glutInit(&argc, argv); glutInitContextVersion(4, 0); glutInitContextFlags(GLUT_FORWARD_COMPATIBLE); glutInitContextProfile(GLUT_CORE_PROFILE); glutSetOption( GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS ); glutInitWindowSize(CurrentWidth, CurrentHeight); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); WindowHandle = glutCreateWindow(WINDOW_TITLE_PREFIX); if(WindowHandle < 1) { fprintf( stderr, "ERROR: Could not create a new rendering window.\n" ); exit(EXIT_FAILURE); } glutReshapeFunc(ResizeFunction); glutDisplayFunc(RenderFunction); glutIdleFunc(IdleFunction); glutTimerFunc(0, TimerFunction, 0); glutCloseFunc(Cleanup); }
uint GraphicsCore::Initialize(int argc, char** argv) { // initialise freeGLUT glutInit(&argc, argv); // create Window on O/S using freeGLUT glutInitWindowSize(windowWidth, windowHeight); // specify size of window glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); // create window with freeGLUT int windowHandle = glutCreateWindow(windowTitle); if (windowHandle < 1) { printf("ERROR: creating window\n"); exit(1); } // get version info and print it to the console (have a look to see what version you can support) const GLubyte* renderer = glGetString(GL_RENDERER); // get renderer string const GLubyte* vendor = glGetString(GL_VENDOR); // vendor const GLubyte* version = glGetString(GL_VERSION); // version as a string const GLubyte* glslVersion = glGetString(GL_SHADING_LANGUAGE_VERSION); // glsl version string GLint major, minor; glGetIntegerv(GL_MAJOR_VERSION, &major); // get integer (only if gl version > 3) glGetIntegerv(GL_MINOR_VERSION, &minor); // get dot integer (only if gl version > 3) printf("OpenGL on %s %s\n", vendor, renderer); printf("OpenGL version supported %s\n", version); printf("GLSL version supported %s\n", glslVersion); printf("Will now set GL to version %i.%i\n", major, minor); // force GL to use a specific version glutInitContextVersion(major, minor); // set version of gl to 4.1 glutInitContextFlags(GLUT_FORWARD_COMPATIBLE); // do not allow deprecated glutInitContextProfile(GLUT_CORE_PROFILE); // force current version of spec glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); // start GLEW (that's it! - we could also use GLEW to check for driver support of all GL extensions) GLenum glErr = glGetError(); while (glErr != GL_NO_ERROR) { printf("glError: %s\n", gluErrorString(glErr)); } // set-up callbacks. we can also do a keyboard and mouse input callback, and various others (see freeGLUT website) //glutDisplayFunc(renderCallback); // register rendering callback glutReshapeFunc(resizeCallback); // register callback for reshape // set colour to clear screen buffer to glClearColor(0.1f, 0.1f, 0.1f, 1.0f); // enable some useful GL behaviours glEnable(GL_DEPTH_TEST); // enable depth-testing glDepthFunc(GL_LESS); // set depth-testing function type glEnable(GL_CULL_FACE); // enable culling of back-faces glCullFace(GL_BACK); // enable culling of back-faces glFrontFace(GL_CCW); // use clock-wise 'winding' to define order used to make fronts of polygons // start GLEW (that's it! - we could also use GLEW to check for driver support of all GL extensions) GLenum err = glewInit(); if (GLEW_OK != err) { printf("ERROR starting GLEW: %s\n", glewGetErrorString(err)); } return 1; }
/////////////////////////////////////////////////////////////////////////////// // Main entry point for GLUT based programs int main(int argc, char* argv[]) { gltSetWorkingDirectory(argv[0]); glutInit(&argc, argv); // We're using compatibility profile here because GLUT generates GL errors on // a core context. This application DOES NOT require a compatibility context. glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE); glutInitContextVersion(3, 3); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowSize(800, 600); glutCreateWindow("Instancing"); glutReshapeFunc(ChangeSize); glutKeyboardFunc(Keyboard); glutDisplayFunc(RenderScene); GLenum err = glewInit(); if (GLEW_OK != err) { /* Problem: glewInit failed, something is seriously wrong. */ fprintf(stderr, "Error: %s\n", glewGetErrorString(err)); } SetupRC(); glutMainLoop(); ShutdownRC(); return 0; }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitContextVersion(4, 0); glutInitContextFlags(GLUT_FORWARD_COMPATIBLE); glutInitContextProfile(GLUT_CORE_PROFILE); glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); glutInitWindowSize(winw, winh); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); if (glutCreateWindow("Waiting for framerate data...") < 1) { fprintf(stderr, "ERROR: Could not create a window.\n"); return EXIT_FAILURE; } GLenum result = glewInit(); if (result != GLEW_OK) { fprintf(stderr, "ERROR: %s\n", glewGetErrorString(result)); return EXIT_FAILURE; } createshaders(); createvbo(); glClearColor(0.0f, 0.0f, 1.0f, 1.0f); glutDisplayFunc(display); glutIdleFunc(idle); glutReshapeFunc(resize); glutTimerFunc(0, timer, 0); fprintf(stdout, "INFO: OpenGL Version: %s\n", glGetString(GL_VERSION)); glutMainLoop(); return EXIT_SUCCESS; }
int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(400, 350); glutInitContextVersion(3, 3); glutInitContextProfile(GLUT_CORE_PROFILE); glutCreateWindow("465 Raw Texture {b, f, t} : front view"); // initialize and verify glew glewExperimental = GL_TRUE; // needed my home system GLenum err = glewInit(); if (GLEW_OK != err) printf("GLEW Error: %s \n", glewGetErrorString(err)); else { printf("Using GLEW %s \n", glewGetString(GLEW_VERSION)); printf("OpenGL %s, GLSL %s\n", glGetString(GL_VERSION), glGetString(GL_SHADING_LANGUAGE_VERSION)); } // initialize scene init(); // set glut callback functions glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutTimerFunc(40, spin, 1); glutCloseFunc(cleanUp); // freeglut only // Note: glutSetOption is only available with freeglut glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); glutMainLoop(); printf("exit main() \n"); return 0; }
int main(int argc, char** argv) { glutInit(&argc, argv); glutInitContextVersion(4, 3); glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE); glewInit(); opengl_scene::initGLScene(); // opengl_scene::drawScene(); glutMainLoop(); ///-----stepsimulation_end----- //cleanup in the reverse order of creation/initialization ///-----cleanup_start----- ///-----cleanup_end----- printf("Press a key to exit\n"); getchar(); }
int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitWindowSize(WinWidth, WinHeight); #ifdef HAVE_FREEGLUT glutInitContextVersion(3, 2); glutInitContextProfile(GLUT_CORE_PROFILE); glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); #elif defined __APPLE__ glutInitDisplayMode(GLUT_3_2_CORE_PROFILE | GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); #else glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); #endif Win = glutCreateWindow(argv[0]); /* glewInit requires glewExperimentel set to true for core profiles. * Depending on the glew version it also generates a GL_INVALID_ENUM. */ glewExperimental = GL_TRUE; glewInit(); glGetError(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutDisplayFunc(Redisplay); glutMotionFunc(MouseMotion); glutMouseFunc(MouseButton); if (Anim) glutIdleFunc(Idle); Init(); glutMainLoop(); return 0; }
int main(int argc, char* args[]) { //Initialize FreeGLUT glutInit(&argc, args); //Create OpenGL 2.1 context glutInitContextVersion(3, 0); lastTime = glutGet(GLUT_ELAPSED_TIME); //Create Double Buffered Window glutInitDisplayMode(GLUT_DOUBLE); glutInitWindowSize(SCREEN_WIDTH, SCREEN_HEIGHT); glutCreateWindow("Collision Test FPS: 0"); //Do post window/context creation initialization if (mode) { if (!initGL()) { printf("Unable to initialize graphics library!\n"); return 1; } } else { if (!initGL2D()) { printf("Unable to initialize graphics library!\n"); return 1; } } //Set rendering function if (mode) { glutDisplayFunc(render); glutReshapeFunc(reshape); glutKeyboardFunc(Keyboard); glutKeyboardUpFunc(KeyboardUp); glutMouseFunc(mouseButton); glutMotionFunc(mouseMove); glutSpecialFunc(processSpecialKeys); } else { glutDisplayFunc(render2D); glutReshapeFunc(reshape2D); glutKeyboardFunc(Keyboard); glutKeyboardUpFunc(KeyboardUp); glutMouseFunc(mouseButton); glutMotionFunc(mouseMove); glutSpecialFunc(processSpecialKeys); } //Set main loop glutTimerFunc(1000 / SCREEN_FPS, runMainLoop, 0); //Start GLUT main loop glutMainLoop(); return 0; }
int main( int argc, char ** argv ) { // Размеры окна по-умолчанию size_t const default_width = 800; size_t const default_height = 800; glutInit (&argc, argv); glutInitWindowSize (default_width, default_height); // Указание формата буфера экрана: // - GLUT_DOUBLE - двойная буферизация // - GLUT_RGB - 3-ёх компонентный цвет // - GLUT_DEPTH - будет использоваться буфер глубины glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); // Создаем контекст версии 3.2 glutInitContextVersion (3, 0); // Контекст будет поддерживать отладку и "устаревшую" функциональность, которой, например, может пользоваться библиотека AntTweakBar // glutInitContextFlags (GLUT_FORWARD_COMPATIBLE | GLUT_DEBUG); // Указание либо на core либо на compatibility профил //glutInitContextProfile (GLUT_COMPATIBILITY_PROFILE ); int window_handle = glutCreateWindow("OpenGL basic sample"); // Инициализация указателей на функции OpenGL if (glewInit() != GLEW_OK) { cerr << "GLEW init failed" << endl; return 1; } // Проверка созданности контекста той версии, какой мы запрашивали if (!GLEW_VERSION_3_0) { cerr << "OpenGL 3.0 not supported" << endl; return 1; } // подписываемся на оконные события glutReshapeFunc(reshape_func); glutDisplayFunc(display_func); glutIdleFunc (idle_func ); glutCloseFunc (close_func ); glutKeyboardFunc(keyboard_func); // подписываемся на события для AntTweakBar'а glutMouseFunc ((GLUTmousebuttonfun)TwEventMouseButtonGLUT); glutMotionFunc ((GLUTmousemotionfun)TwEventMouseMotionGLUT); glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT); glutSpecialFunc ((GLUTspecialfun )TwEventSpecialGLUT ); TwGLUTModifiersFunc (glutGetModifiers); try { // Создание класса-примера prog_state_ptr.reset(new prog_state()); // Вход в главный цикл приложения glutMainLoop(); } catch( std::exception const & except ) { std::cout << except.what() << endl; return 1; } return 0; }
void CGame::Init(int argc, char **argv) { srand(time(0)); glutInit(&argc, argv); glutInitContextVersion(3, 0); //if (data->fullscreen) //{ //glutInitWindowSize(glutGet(GLUT_SCREEN_WIDTH), glutGet(GLUT_SCREEN_HEIGHT)); //glutInitWindowPosition(0, 0); //} //else //{ glutInitWindowSize(1, 1); glutInitWindowPosition(1, 1); //glutInitWindowSize(data->window->size.x, data->window->size.y); //glutInitWindowPosition(data->window->pos.x, data->window->pos.y); //} glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutCreateWindow("Space Explorer"); std::cout << glGetString(GL_VENDOR) << std::endl; std::cout << glGetString(GL_RENDERER) << std::endl; std::cout << "OpenGL " << glGetString(GL_VERSION) << std::endl; GLenum err = glewInit(); if (GLEW_OK != err) { MessageBox(0, (LPCSTR)glewGetErrorString(err), "GLEW Error", MB_ICONERROR | MB_OK); exit(1); } if (GLEW_VERSION_3_0 == false) { MessageBox(0, "To run a game, OpenGL 3.0 or higher is required", "Error", MB_ICONERROR | MB_OK); exit(1); } std::cout << "Using GLEW " << glewGetString(GLEW_VERSION) << std::endl; data->audioDevice = audiere::OpenDevice(); //glutTimerFunc(1000, callbackDrawFPS, 0); //glutTimerFunc(15, callbackRedisplay, 0); //glutRedisplayFunc(callbackRedisplay); setMouse(); loadData(); setGlutCallbacks(); glutFullScreen(); glutMainLoop(); }
int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitContextVersion(3, 2); glutCreateWindow ("GL3 textured quad example"); glutDisplayFunc(display); init (); glutMainLoop(); }
void callback() { unsigned int displayMode = GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL; glutInitDisplayMode (displayMode); glutInitWindowSize(400, 400); glutInitContextVersion (3, 3); glutInitContextProfile(GLUT_CORE_PROFILE); result = glutCreateWindow(name); waiting = false; }
int main( int argc, char* args[] ) { strcpy(quote[0],"Luke, I am your father!."); strcpy(quote[1],"Obi-Wan has taught you well. "); strcpy(quote[2],"The force is strong with this one. "); strcpy(quote[3],"Alert all commands. Calculate every possible destination along their last known trajectory. "); strcpy(quote[4],"The force is with you, young Skywalker, but you are not a Jedi yet."); numberOfQuotes=5; //Initialize FreeGLUT glutInit( &argc, args ); //Create OpenGL 2.1 context glutInitContextVersion( 2, 1 ); //Create Double Buffered Window glutInitDisplayMode( GLUT_DOUBLE ); glutInitWindowSize( SCREEN_WIDTH, SCREEN_HEIGHT ); glutCreateWindow( "OpenGL" ); //Do post window/context creation initialization if( !initGL() ) { printf( "Unable to initialize graphics library!\n" ); return 1; } if( FT_Init_FreeType(&library)) exit(101); //load the font if(FT_New_Face( library, "8bitoperator.ttf", 0, &face ) ) exit(102); //set font attributes if(FT_Set_Char_Size( face, /* handle to face object */ 0, /* char_width in 1/64th of points */ 16*64, /* char_height in 1/64th of points */ 300, /* horizontal device resolution */ 300 ) ) exit(103); FT_RenderText(); glutSwapBuffers(); Sleep(3000); //Set rendering function glutDisplayFunc( render ); //Set main loop glutTimerFunc( 1000 / SCREEN_FPS, runMainLoop, 0 ); //Start GLUT main loop glutMainLoop(); return 0; }
int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitContextVersion(3, 2); glutCreateWindow ("GL3 color cube example"); glutDisplayFunc(display); glutTimerFunc(20, timer, 0); init (); glutMainLoop(); }
int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitContextVersion(3, 2); glutCreateWindow("Bunny"); glutDisplayFunc(display); init (); OnTimer(0); glutMainLoop(); }
int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitContextVersion(3, 2); glutCreateWindow ("GL3 white triangle example"); glutDisplayFunc(display); init (); OnTimer(0); glutMainLoop(); }
int main(int argc, char **argv) { // GLUT initialization glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH|GLUT_DOUBLE|GLUT_RGBA|GLUT_MULTISAMPLE); glutInitContextVersion (4, 2); glutInitContextProfile (GLUT_CORE_PROFILE ); glutInitContextFlags(GLUT_DEBUG); glutInitWindowPosition(100,100); glutInitWindowSize(640,360); glutCreateWindow("Lighthouse3D - Simplest Demo"); // Callback Registration glutDisplayFunc(renderScene); glutReshapeFunc(changeSize); glutIdleFunc(renderScene); // return from main loop glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); // Init GLEW glewExperimental = GL_TRUE; glewInit(); if (glewIsSupported("GL_VERSION_4_2")) printf("Ready for OpenGL 4.2\n"); else { printf("OpenGL 4.2 not supported\n"); exit(1); } printf ("Vendor: %s\n", glGetString (GL_VENDOR)); printf ("Renderer: %s\n", glGetString (GL_RENDERER)); printf ("Version: %s\n", glGetString (GL_VERSION)); printf ("GLSL: %s\n", glGetString (GL_SHADING_LANGUAGE_VERSION)); int param; glGetIntegerv(GL_CONTEXT_PROFILE_MASK, ¶m); if (param == GL_CONTEXT_CORE_PROFILE_BIT) printf("Context Profile: Core\n"); else printf("Context Profile: Compatibility\n"); glGetIntegerv(GL_CONTEXT_FLAGS, ¶m); setupShaders(); initGL(); // GLUT main loop glutMainLoop(); return(1); }
void RunExample(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutInitWindowSize(G_WIN_W, G_WIN_H); glutInitWindowPosition(100, 100); glutInitContextVersion (3,3); glutInitContextProfile (GLUT_CORE_PROFILE); glewExperimental=TRUE; glutCreateWindow("OGLplus"); assert (glewInit() == GLEW_OK); glGetError(); static bool gFailed = false; static ExBase *gEx; EX_OGLPLUS_ERROR_WRAP_START(); { gEx = new ExType(); } EX_OGLPLUS_ERROR_WRAP_MIDDLE(); { throw; } EX_OGLPLUS_ERROR_WRAP_END(); /* Cannot pass exceptions through FreeGlut, have to workaround with error flags and FreeGlut API / Option flags. */ auto dispfunc = []() { EX_OGLPLUS_ERROR_WRAP_START(); { Ctx::ClearColor(0.2f, 0.2f, 0.2f, 0.0f); Ctx::Clear().ColorBuffer().DepthBuffer(); gEx->Display(); glutSwapBuffers(); } EX_OGLPLUS_ERROR_WRAP_MIDDLE(); { gFailed = true; glutLeaveMainLoop(); } EX_OGLPLUS_ERROR_WRAP_END(); }; glutDisplayFunc(dispfunc); glutTimerFunc(33, timerfunc, 33); glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); glutMainLoop(); if (gFailed) throw exception("Failed"); }
void initGLUT(const int &argc, char** args) { glutInit(const_cast<int*>(&argc), args); glutInitContextVersion(3, 1); glutInitWindowSize(SCREEN_WIDTH, SCREEN_HEIGHT); glutCreateWindow("Pretty Colors"); vfp_handleKeys = &handleKeys; vfp_render = &render; vfp_mainLoop = &runMainLoop; }
void initGlut(int argc, char ** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA ); glutInitContextVersion(3, 3); glutInitContextFlags(GLUT_CORE_PROFILE | GLUT_DEBUG); glutInitContextProfile(GLUT_FORWARD_COMPATIBLE); glutInitWindowSize(WIDTH, HEIGHT); windowHandler = glutCreateWindow("Graphic Engine 0.001"); }
/*----------------------------------------------------------------------------------------------- Description: Program start and end. Parameters: argc The number of strings in argv. argv A pointer to an array of null-terminated, C-style strings. Returns: 0 if program ended well, which it always does or it crashes outright, so returning 0 is fine Exception: Safe Creator: John Cox (2-13-2016) -----------------------------------------------------------------------------------------------*/ int main(int argc, char *argv[]) { glutInit(&argc, argv); int width = 500; int height = 500; unsigned int displayMode = GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH | GLUT_STENCIL; displayMode = Defaults(displayMode, width, height); glutInitDisplayMode(displayMode); glutInitContextVersion(4, 4); glutInitContextProfile(GLUT_CORE_PROFILE); // enable this for automatic message reporting (see OpenGlErrorHandling.cpp) #define DEBUG #ifdef DEBUG glutInitContextFlags(GLUT_DEBUG); #endif glutInitWindowSize(width, height); glutInitWindowPosition(300, 200); int window = glutCreateWindow(argv[0]); glload::LoadTest glLoadGood = glload::LoadFunctions(); // ??check return value?? glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION); if (!glload::IsVersionGEQ(3, 3)) { printf("Your OpenGL version is %i, %i. You must have at least OpenGL 3.3 to run this tutorial.\n", glload::GetMajorVersion(), glload::GetMinorVersion()); glutDestroyWindow(window); return 0; } if (glext_ARB_debug_output) { glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); glDebugMessageCallbackARB(DebugFunc, (void*)15); } Init(); glutDisplayFunc(Display); glutReshapeFunc(Reshape); glutKeyboardFunc(Keyboard); glutMainLoop(); CleanupAll(); return 0; }
int main(int argc, char** argv) { glutInit(&argc, argv); int width = 500; int height = 500; unsigned int displayMode = GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH | GLUT_STENCIL; displayMode = defaults(displayMode, width, height); glutInitDisplayMode (displayMode); glutInitContextVersion (3, 3); glutInitContextFlags(GLUT_FORWARD_COMPATIBLE); glutInitContextProfile(GLUT_CORE_PROFILE); #ifdef DEBUG glutInitContextFlags(GLUT_DEBUG); #endif glutInitWindowSize (width, height); glutInitWindowPosition (300, 200); int window = glutCreateWindow (argv[0]); glload::LoadFunctions(); glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION); if(!glload::IsVersionGEQ(3, 3)) { printf("Your OpenGL version is %i, %i. You must have at least OpenGL 3.3 to run this tutorial.\n", glload::GetMajorVersion(), glload::GetMinorVersion()); glutDestroyWindow(window); return 0; } if(glext_ARB_debug_output) { glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); glDebugMessageCallbackARB(DebugFunc, (void*)15); } init(); UserListener listener; Leap::Controller controller; controller.addListener(listener); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutMainLoop(); controller.removeListener(listener); return 0; }
int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitContextVersion(3, 2); glutCreateWindow ("GL3 white triangle example"); glutDisplayFunc(display); glutTimerFunc(20, &OnTimer, 0); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); init (); glutMainLoop(); }
int main(int argc, char* args[]){ //Argumentos posibles para iniciar freeglut glutInit( &argc, args ); //Create OpenGL 2.1 context glutInitContextVersion( 2, 1 ); //Create Double Buffered Window glutInitDisplayMode( GLUT_DOUBLE ); glutInitWindowSize( SCREEN_WIDTH, SCREEN_HEIGHT ); glutCreateWindow( "Dos Discos en un Circulo" ); //Do post window/context creation initialization if( !initGL() ) { printf( "Tienes panchos con GLUT!\n" ); return 1; }; /*por el momento sin datos en el disco duro Bueno, no si.*/ ofstream puntos1, puntos2; puntos1.open("Qspace01.dat"); puntos2.open("Qspace02.dat"); //Primeros puntos centro discos puntos1<<uno.qx<<"\t"<<uno.qy<<endl; puntos2<<dos.qx<<"\t"<<dos.qy<<endl; tiempodechoque=dinamicaunchoque(uno, dos); puntos1<<uno.qx<<"\t"<<uno.qy<<endl; puntos2<<dos.qx<<"\t"<<dos.qy<<endl; cout<<tiempodechoque<<endl; //Inicializar las cosas que va hacer freeglut. //Set keyboard handler glutKeyboardFunc( handleKeys ); //Set rendering function glutDisplayFunc( render ); //Set main loop glutTimerFunc( 1000 / SCREEN_FPS, runMainLoop, 0 ); //Start GLUT main loop glutMainLoop(); return 0; };
bool initGUI( int argc, char* argv[] ) { //Initialize the FreeGLUT window library bool success = true; glutInit( &argc, argv ); glutInitContextVersion( 2, 1 ); glutInitDisplayMode( GLUT_DOUBLE | GLUT_MULTISAMPLE ); glutInitWindowSize( SCREEN_WIDTH, SCREEN_HEIGHT ); glutCreateWindow( WINDOW_TITLE ); glutKeyboardFunc( keyPressed ); glutKeyboardUpFunc( keyReleased ); glutSpecialFunc( specialPressed ); glutSpecialUpFunc( specialReleased ); glutMouseFunc( mouseClicked ); glutMotionFunc( mouseDragged ); glutPassiveMotionFunc( mouseMoved ); glutDisplayFunc( render ); glutTimerFunc( 1000/SCREEN_FPS, runMainLoop, 0 ); if ( initGL() ) { printf("initGL() is good.\n"); if ( initIL() ) { printf("initIL() is good.\n"); if ( initFreeType() ) { printf("initFreeType() is good.\n"); } else { printf("initFreeType() failed!\n"); success = false; } } else { printf("initIL() failed!\n"); success = false; } } else { printf("initGL() failed!\n"); success = false; } return success; }
Window::Window(int argc, char* args[], Game* game, Camera* camera, HUD* hud): m_window(0){ Window::m_game = game; Window::m_camera = camera; Window::m_hud = hud; //Initialize FreeGLUT glutInit( &argc, args ); //Create OpenGL 2.1 context glutInitContextVersion( 2, 1 ); //Create Double Buffered Window glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH ); glutInitWindowSize( SCREEN_WIDTH, SCREEN_HEIGHT ); this->m_window = glutCreateWindow( "Simple Particle Systems" ); //Initialize Projection Matrix glMatrixMode( GL_PROJECTION ); glLoadIdentity(); //Enable Texturizing glEnable( GL_TEXTURE_2D ); glEnable( GL_DEPTH_TEST ); glFrontFace(GL_CW); //Initialize Modelview Matrix glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); //Initialize clear color glClearColor( 0.f, 0.f, 0.f, 1.f ); //Check for error GLenum error = glGetError(); if( error != GL_NO_ERROR ) { throw error; } //Set rendering function glutDisplayFunc( Window::display ); //Set reshape callback glutReshapeFunc (reshape); currentDelta = glutGet(GLUT_ELAPSED_TIME); //Set the run-callback for the mainloop glutTimerFunc( 1000 / Window::SCREEN_FPS, Window::run, 0 ); }
//////////////////////////////////////////////////////////////////////////////// // Main // //////////////////////////////////////////////////////////////////////////////// int main(int argc, char** argv) { const GLuint CONTEXT_MAJOR = 4; const GLuint CONTEXT_MINOR = 2; // init glut glutInit(&argc, argv); glutInitContextVersion(CONTEXT_MAJOR ,CONTEXT_MINOR); glutInitContextFlags(GLUT_DEBUG); glutInitContextProfile(GLUT_CORE_PROFILE); // glutInitContextFlags(GLUT_DEBUG | GLUT_FORWARD_COMPATIBLE); // glutInitContextProfile(GLUT_CORE_PROFILE); // build window glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitWindowSize(800, 600); glutInitWindowPosition(0, 0); glutCreateWindow("OpenGL"); // init glew glewExperimental = GL_TRUE; GLenum err = glewInit(); if(GLEW_OK != err) { std::stringstream ss; ss << err; std::cerr << "glewInit() gave error " << ss.str() << std::endl; return 1; } // glewInit generates an INVALID_ENUM error for some reason... glGetError(); // set callbacks glutCloseFunc(&on_clean); glutReshapeFunc(&on_resize); glutDisplayFunc(&on_update); glutKeyboardFunc(&on_key_down); glutMouseFunc(&on_mouse_button); glutPassiveMotionFunc(&on_mouse_motion); glutMotionFunc(&on_mouse_motion); glutMouseWheelFunc(&on_mouse_wheel); // run on_init(); // glutMainLoop(); return 0; }
void CreateGlutWindow() { glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutInitContextVersion (3, 1); //for OpenGL 3.1 context glutInitWindowSize (640, 640); win = glutCreateWindow ("Transform Feedback Demo"); //print system info printf("Vendor: %s\n", glGetString(GL_VENDOR)); printf("Renderer: %s\n", glGetString(GL_RENDERER)); printf("Version: %s\n", glGetString(GL_VERSION)); //printf("Extensions: %s\n", glGetString(GL_EXTENSIONS)); }