book
OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition
by Dave Shreiner, Graham Sellers, John M. Kessenich, Bill M. Licea-Kane
March 2013
Intermediate to advanced
984 pages
26h 18m
English
Content preview from OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth EditionBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
Start your free trial



Entering main()
Starting at the beginning, of how our program would execute, we first look at what’s going on in main(). The first six lines use the OpenGL Utility Toolkit to configure and open window for us. While the details of each of these routines is covered in Appendix A, we’ll discuss the flow of the commands here.
int main(int argc, char** argv){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA); glutInitWindowSize(512, 512); glutInitContextVersion(4, 3); glutInitContextProfile(GLUT_CORE_PROFILE); glutCreateWindow(argv[0]); if (glewInit()) { cerr << "Unable to initialize GLEW ... exiting" << endl; exit(EXIT_FAILURE); } init(); glutDisplayFunc(display); glutMainLoop(); ...