Code style improvements

This commit is contained in:
Marcel Plch 2018-02-07 00:02:56 +01:00
parent 009ffeafdd
commit 28aef55a81

17
main.c
View file

@ -9,11 +9,10 @@
#include <GLFW/glfw3.h>
GLFWwindow* window;
int main( void )
{
int main(void) {
// Initialise GLFW
if( !glfwInit() )
{
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);
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
@ -50,7 +50,8 @@ int main( void )
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.
// 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,8 +61,8 @@ 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 &&
// 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