Code style improvements
This commit is contained in:
parent
009ffeafdd
commit
28aef55a81
1 changed files with 15 additions and 14 deletions
29
main.c
29
main.c
|
@ -9,12 +9,11 @@
|
|||
#include <GLFW/glfw3.h>
|
||||
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();
|
||||
|
|
Loading…
Reference in a new issue