Guest User

Untitled

a guest
May 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1. int checkGlew()
  2. {
  3.     GLenum err = glewInit();
  4.  
  5.     if (err != GLEW_OK) {
  6.         std::cout << "OpenGL/GLEW error while initializing!" << std::endl;
  7.         std::cout << glewGetErrorString(err) << std::endl;
  8.         std::cout << (char*)glGetString( GL_VERSION ) << std::endl;
  9.         std::getchar();
  10.         return 1;
  11.     }
  12.  
  13.  
  14.     if (!glewIsSupported("GL_VERSION_2_0")) {
  15.         std::cout << "OpenGL 2.0 found, shaders not supported" << std::endl;
  16.         std::getchar();
  17.         return 1;
  18.     }
  19. }
  20.  
  21. int main( int argc, char **argv )
  22. {
  23.         glutInit (&argc, argv);
  24.         glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
  25.         glutInitWindowPosition (100, 100);
  26.         glutInitWindowSize (windowWidth, windowHeight);
  27.         glutCreateWindow ("Deferred Shading");
  28.        
  29.     int err = checkGlew();
  30.     if (err == 1)
  31.         return 0;
  32.  
  33.     glShadeModel (GL_FLAT); // probably want GL_SMOOTH here unless you like your renders looking like hairy mens asses
  34.     init();
  35.  
  36.         glutDisplayFunc (display);
  37.         glutReshapeFunc (windowReshape);
  38.         glutSpecialFunc (HandleSpecialKeyboard);
  39.        
  40.         glutMainLoop ();
  41. }
Add Comment
Please, Sign In to add comment