From 28aef55a81dff03443f6d5fa3d28333f9c511c4e Mon Sep 17 00:00:00 2001 From: Marcel Plch Date: Wed, 7 Feb 2018 00:02:56 +0100 Subject: [PATCH] Code style improvements --- main.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index 5ee8699..2d6e478 100644 --- a/main.c +++ b/main.c @@ -9,12 +9,11 @@ #include GLFWwindow* window; -int main( void ) -{ +int main(void) { + // Initialise GLFW - if( !glfwInit() ) - { - fprintf( stderr, "Failed to initialize GLFW\n" ); + if(!glfwInit()) { + fprintf(stderr, "Failed to initialize GLFW\n"); getchar(); return -1; } @@ -26,13 +25,14 @@ int main( void ) glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context - window = glfwCreateWindow( 1024, 768, "Tutorial 01", NULL, NULL); - if( window == NULL ){ - fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" ); + window = glfwCreateWindow(1024, 768, "OpenGL Clock", NULL, NULL); + if (window == NULL) { + fprintf(stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n"); getchar(); glfwTerminate(); return -1; } + glfwMakeContextCurrent(window); // Initialize GLEW @@ -49,9 +49,10 @@ int main( void ) // Dark grey background glClearColor(0.15f, 0.15f, 0.15f, 0.0f); - do{ - // Clear the screen. It's not mentioned before Tutorial 02, but it can cause flickering, so it's there nonetheless. - glClear( GL_COLOR_BUFFER_BIT ); + do { + // Clear the screen. It's not mentioned before Tutorial 02, + // but it can cause flickering, so it's there nonetheless. + glClear(GL_COLOR_BUFFER_BIT); // Draw nothing, see you in tutorial 2 ! @@ -60,9 +61,9 @@ int main( void ) glfwSwapBuffers(window); glfwPollEvents(); - } // Check if the ESC key was pressed or the window was closed - while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS && - glfwWindowShouldClose(window) == 0 ); + // Check if the ESC key was pressed or the window was closed + } while(glfwGetKey(window, GLFW_KEY_ESCAPE) != GLFW_PRESS && + glfwWindowShouldClose(window) == 0); // Close OpenGL window and terminate GLFW glfwTerminate();