diff --git a/common/shader.cpp b/common/shader.cpp index 1aac02614..86d40dc97 100644 --- a/common/shader.cpp +++ b/common/shader.cpp @@ -43,13 +43,10 @@ GLuint LoadShaders(const char * vertex_file_path,const char * fragment_file_path FragmentShaderStream.close(); } - - GLint Result = GL_FALSE; int InfoLogLength; - // Compile Vertex Shader printf("Compiling shader : %s\n", vertex_file_path); char const * VertexSourcePointer = VertexShaderCode.c_str(); @@ -100,6 +97,10 @@ GLuint LoadShaders(const char * vertex_file_path,const char * fragment_file_path printf("%s\n", &ProgramErrorMessage[0]); } + + glDetachShader(ProgramID, VertexShaderID); + glDetachShader(ProgramID, FragmentShaderID); + glDeleteShader(VertexShaderID); glDeleteShader(FragmentShaderID); diff --git a/misc04_building_your_own_app/playground2.cpp b/misc04_building_your_own_app/playground2.cpp index b8aa74908..074f2b700 100644 --- a/misc04_building_your_own_app/playground2.cpp +++ b/misc04_building_your_own_app/playground2.cpp @@ -25,6 +25,7 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } @@ -38,6 +39,7 @@ int main( void ) if( !glfwOpenWindow( 1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW ) ) { 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; } @@ -45,6 +47,8 @@ int main( void ) // Initialize GLEW if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } @@ -61,6 +65,7 @@ int main( void ) // Swap buffers glfwSwapBuffers(); + glfwPollEvents(); } // Check if the ESC key was pressed or the window was closed while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS && diff --git a/misc05_picking/StandardShading.fragmentshader b/misc05_picking/StandardShading.fragmentshader index aa893266f..8cf102c1f 100644 --- a/misc05_picking/StandardShading.fragmentshader +++ b/misc05_picking/StandardShading.fragmentshader @@ -23,7 +23,7 @@ void main(){ float LightPower = 50.0f; // Material properties - vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( myTextureSampler, UV ).rgb; vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor; vec3 MaterialSpecularColor = vec3(0.3,0.3,0.3); diff --git a/misc05_picking/misc05_picking_BulletPhysics.cpp b/misc05_picking/misc05_picking_BulletPhysics.cpp index ea6a89ac2..6f482cf36 100644 --- a/misc05_picking/misc05_picking_BulletPhysics.cpp +++ b/misc05_picking/misc05_picking_BulletPhysics.cpp @@ -90,6 +90,7 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } @@ -102,6 +103,7 @@ int main( void ) window = glfwCreateWindow( 1024, 768, "Misc 05 - Bullet version", 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; } @@ -111,6 +113,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } @@ -314,10 +318,10 @@ int main( void ) out_direction ); - out_direction = out_direction*1000.0f; + glm::vec3 out_end = out_origin + out_direction*1000.0f; - btCollisionWorld::ClosestRayResultCallback RayCallback(btVector3(out_origin.x, out_origin.y, out_origin.z), btVector3(out_direction.x, out_direction.y, out_direction.z)); - dynamicsWorld->rayTest(btVector3(out_origin.x, out_origin.y, out_origin.z), btVector3(out_direction.x, out_direction.y, out_direction.z), RayCallback); + btCollisionWorld::ClosestRayResultCallback RayCallback(btVector3(out_origin.x, out_origin.y, out_origin.z), btVector3(out_end.x, out_end.y, out_end.z)); + dynamicsWorld->rayTest(btVector3(out_origin.x, out_origin.y, out_origin.z), btVector3(out_end.x, out_end.y, out_end.z), RayCallback); if(RayCallback.hasHit()) { std::ostringstream oss; oss << "mesh " << (size_t)RayCallback.m_collisionObject->getUserPointer(); diff --git a/misc05_picking/misc05_picking_custom.cpp b/misc05_picking/misc05_picking_custom.cpp index afb273e67..0aab1e121 100644 --- a/misc05_picking/misc05_picking_custom.cpp +++ b/misc05_picking/misc05_picking_custom.cpp @@ -202,18 +202,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Misc 05 - version with custom Ray-OBB code", 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; } @@ -223,6 +226,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/misc05_picking/misc05_picking_slow_easy.cpp b/misc05_picking/misc05_picking_slow_easy.cpp index fd22bc12c..6a8078438 100644 --- a/misc05_picking/misc05_picking_slow_easy.cpp +++ b/misc05_picking/misc05_picking_slow_easy.cpp @@ -33,18 +33,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Misc 05 - Simple but slow version", 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; } @@ -54,6 +57,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/playground/playground.cpp b/playground/playground.cpp index eef292763..3b771f649 100644 --- a/playground/playground.cpp +++ b/playground/playground.cpp @@ -15,6 +15,7 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } @@ -22,12 +23,14 @@ int main( void ) glfwWindowHint(GLFW_RESIZABLE,GL_FALSE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Playground", 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; } @@ -36,6 +39,8 @@ int main( void ) // Initialize GLEW if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial01_first_window/tutorial01.cpp b/tutorial01_first_window/tutorial01.cpp index de4a4a58b..7ca449cc0 100644 --- a/tutorial01_first_window/tutorial01.cpp +++ b/tutorial01_first_window/tutorial01.cpp @@ -19,18 +19,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed 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" ); + getchar(); glfwTerminate(); return -1; } @@ -39,6 +42,8 @@ int main( void ) // Initialize GLEW if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } @@ -49,8 +54,12 @@ int main( void ) glClearColor(0.0f, 0.0f, 0.4f, 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 ); + // Draw nothing, see you in tutorial 2 ! + // Swap buffers glfwSwapBuffers(window); glfwPollEvents(); diff --git a/tutorial02_red_triangle/tutorial02.cpp b/tutorial02_red_triangle/tutorial02.cpp index 2154ba8e3..98f3b5417 100644 --- a/tutorial02_red_triangle/tutorial02.cpp +++ b/tutorial02_red_triangle/tutorial02.cpp @@ -21,18 +21,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 02 - Red triangle", 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; } @@ -42,6 +45,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial03_matrices/tutorial03.cpp b/tutorial03_matrices/tutorial03.cpp index 1e39e3b2e..3cc1eb863 100644 --- a/tutorial03_matrices/tutorial03.cpp +++ b/tutorial03_matrices/tutorial03.cpp @@ -22,18 +22,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //We don't want the old OpenGL // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 03 - Matrices", 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; } @@ -43,6 +46,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial04_colored_cube/tutorial04.cpp b/tutorial04_colored_cube/tutorial04.cpp index c18fd6263..454642eca 100644 --- a/tutorial04_colored_cube/tutorial04.cpp +++ b/tutorial04_colored_cube/tutorial04.cpp @@ -22,18 +22,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 04 - Colored Cube", 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; } @@ -43,6 +46,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial05_textured_cube/TextureFragmentShader.fragmentshader b/tutorial05_textured_cube/TextureFragmentShader.fragmentshader index 15e15ebd1..fb4e79dee 100644 --- a/tutorial05_textured_cube/TextureFragmentShader.fragmentshader +++ b/tutorial05_textured_cube/TextureFragmentShader.fragmentshader @@ -12,5 +12,5 @@ uniform sampler2D myTextureSampler; void main(){ // Output color = color of the texture at the specified UV - color = texture2D( myTextureSampler, UV ).rgb; + color = texture( myTextureSampler, UV ).rgb; } \ No newline at end of file diff --git a/tutorial05_textured_cube/tutorial05.cpp b/tutorial05_textured_cube/tutorial05.cpp index aeafeee78..05493a960 100644 --- a/tutorial05_textured_cube/tutorial05.cpp +++ b/tutorial05_textured_cube/tutorial05.cpp @@ -29,6 +29,7 @@ int main( void ) glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context diff --git a/tutorial06_keyboard_and_mouse/TextureFragmentShader.fragmentshader b/tutorial06_keyboard_and_mouse/TextureFragmentShader.fragmentshader index 15e15ebd1..fb4e79dee 100644 --- a/tutorial06_keyboard_and_mouse/TextureFragmentShader.fragmentshader +++ b/tutorial06_keyboard_and_mouse/TextureFragmentShader.fragmentshader @@ -12,5 +12,5 @@ uniform sampler2D myTextureSampler; void main(){ // Output color = color of the texture at the specified UV - color = texture2D( myTextureSampler, UV ).rgb; + color = texture( myTextureSampler, UV ).rgb; } \ No newline at end of file diff --git a/tutorial06_keyboard_and_mouse/tutorial06.cpp b/tutorial06_keyboard_and_mouse/tutorial06.cpp index a34e3dc9d..68f32fd3e 100644 --- a/tutorial06_keyboard_and_mouse/tutorial06.cpp +++ b/tutorial06_keyboard_and_mouse/tutorial06.cpp @@ -24,18 +24,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 0 - Keyboard and Mouse", 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; } @@ -45,6 +48,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial07_model_loading/TextureFragmentShader.fragmentshader b/tutorial07_model_loading/TextureFragmentShader.fragmentshader index 15e15ebd1..fb4e79dee 100644 --- a/tutorial07_model_loading/TextureFragmentShader.fragmentshader +++ b/tutorial07_model_loading/TextureFragmentShader.fragmentshader @@ -12,5 +12,5 @@ uniform sampler2D myTextureSampler; void main(){ // Output color = color of the texture at the specified UV - color = texture2D( myTextureSampler, UV ).rgb; + color = texture( myTextureSampler, UV ).rgb; } \ No newline at end of file diff --git a/tutorial07_model_loading/tutorial07.cpp b/tutorial07_model_loading/tutorial07.cpp index 6485dba63..ae1621972 100644 --- a/tutorial07_model_loading/tutorial07.cpp +++ b/tutorial07_model_loading/tutorial07.cpp @@ -26,18 +26,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 07 - Model Loading", 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; } @@ -47,6 +50,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial08_basic_shading/StandardShading.fragmentshader b/tutorial08_basic_shading/StandardShading.fragmentshader index aa893266f..8cf102c1f 100644 --- a/tutorial08_basic_shading/StandardShading.fragmentshader +++ b/tutorial08_basic_shading/StandardShading.fragmentshader @@ -23,7 +23,7 @@ void main(){ float LightPower = 50.0f; // Material properties - vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( myTextureSampler, UV ).rgb; vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor; vec3 MaterialSpecularColor = vec3(0.3,0.3,0.3); diff --git a/tutorial08_basic_shading/tutorial08.cpp b/tutorial08_basic_shading/tutorial08.cpp index 8a3d843ce..0c58b5d9a 100644 --- a/tutorial08_basic_shading/tutorial08.cpp +++ b/tutorial08_basic_shading/tutorial08.cpp @@ -27,18 +27,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 08 - Basic Shading", 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; } @@ -48,6 +51,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial09_vbo_indexing/StandardShading.fragmentshader b/tutorial09_vbo_indexing/StandardShading.fragmentshader index aa893266f..8cf102c1f 100644 --- a/tutorial09_vbo_indexing/StandardShading.fragmentshader +++ b/tutorial09_vbo_indexing/StandardShading.fragmentshader @@ -23,7 +23,7 @@ void main(){ float LightPower = 50.0f; // Material properties - vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( myTextureSampler, UV ).rgb; vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor; vec3 MaterialSpecularColor = vec3(0.3,0.3,0.3); diff --git a/tutorial09_vbo_indexing/tutorial09.cpp b/tutorial09_vbo_indexing/tutorial09.cpp index df5668d34..6f66650be 100644 --- a/tutorial09_vbo_indexing/tutorial09.cpp +++ b/tutorial09_vbo_indexing/tutorial09.cpp @@ -27,18 +27,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 09 - VBO Indexing", 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; } @@ -48,6 +51,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial09_vbo_indexing/tutorial09_AssImp.cpp b/tutorial09_vbo_indexing/tutorial09_AssImp.cpp index e8a31fce8..935e88926 100644 --- a/tutorial09_vbo_indexing/tutorial09_AssImp.cpp +++ b/tutorial09_vbo_indexing/tutorial09_AssImp.cpp @@ -27,18 +27,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 09 - Loading with AssImp", 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; } @@ -48,6 +51,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial09_vbo_indexing/tutorial09_several_objects.cpp b/tutorial09_vbo_indexing/tutorial09_several_objects.cpp index 870a664d9..a3e833bfc 100644 --- a/tutorial09_vbo_indexing/tutorial09_several_objects.cpp +++ b/tutorial09_vbo_indexing/tutorial09_several_objects.cpp @@ -27,18 +27,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 09 - Rendering several models", 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; } @@ -48,6 +51,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial10_transparency/StandardTransparentShading.fragmentshader b/tutorial10_transparency/StandardTransparentShading.fragmentshader index 1afd43d98..a9fd28cc8 100644 --- a/tutorial10_transparency/StandardTransparentShading.fragmentshader +++ b/tutorial10_transparency/StandardTransparentShading.fragmentshader @@ -23,7 +23,7 @@ void main(){ float LightPower = 50.0f; // Material properties - vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( myTextureSampler, UV ).rgb; vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor; vec3 MaterialSpecularColor = vec3(0.3,0.3,0.3); diff --git a/tutorial10_transparency/tutorial10.cpp b/tutorial10_transparency/tutorial10.cpp index 39035da56..bb09cabe1 100644 --- a/tutorial10_transparency/tutorial10.cpp +++ b/tutorial10_transparency/tutorial10.cpp @@ -27,18 +27,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 10 - Transparency", 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; } @@ -48,6 +51,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial11_2d_fonts/StandardShading.fragmentshader b/tutorial11_2d_fonts/StandardShading.fragmentshader index aa893266f..8cf102c1f 100644 --- a/tutorial11_2d_fonts/StandardShading.fragmentshader +++ b/tutorial11_2d_fonts/StandardShading.fragmentshader @@ -23,7 +23,7 @@ void main(){ float LightPower = 50.0f; // Material properties - vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( myTextureSampler, UV ).rgb; vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor; vec3 MaterialSpecularColor = vec3(0.3,0.3,0.3); diff --git a/tutorial11_2d_fonts/TextVertexShader.fragmentshader b/tutorial11_2d_fonts/TextVertexShader.fragmentshader index 2149a8213..8e1fc74b4 100644 --- a/tutorial11_2d_fonts/TextVertexShader.fragmentshader +++ b/tutorial11_2d_fonts/TextVertexShader.fragmentshader @@ -11,7 +11,7 @@ uniform sampler2D myTextureSampler; void main(){ - color = texture2D( myTextureSampler, UV ); + color = texture( myTextureSampler, UV ); } \ No newline at end of file diff --git a/tutorial11_2d_fonts/tutorial11.cpp b/tutorial11_2d_fonts/tutorial11.cpp index ba19e0de0..dd03da222 100644 --- a/tutorial11_2d_fonts/tutorial11.cpp +++ b/tutorial11_2d_fonts/tutorial11.cpp @@ -28,18 +28,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 11 - 2D Fonts", 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; } @@ -49,6 +52,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } @@ -228,6 +233,7 @@ int main( void ) // Swap buffers glfwSwapBuffers(window); + glfwPollEvents(); } // Check if the ESC key was pressed or the window was closed while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS && diff --git a/tutorial12_extensions/StandardShading_WithSyntaxErrors.fragmentshader b/tutorial12_extensions/StandardShading_WithSyntaxErrors.fragmentshader index 96660461a..ccfe9b0ee 100644 --- a/tutorial12_extensions/StandardShading_WithSyntaxErrors.fragmentshader +++ b/tutorial12_extensions/StandardShading_WithSyntaxErrors.fragmentshader @@ -26,7 +26,7 @@ void main(){ float LightPower = 50.0f; // Material properties - vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( myTextureSampler, UV ).rgb; vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor; vec3 MaterialSpecularColor = vec3(0.3,0.3,0.3); diff --git a/tutorial12_extensions/tutorial12.cpp b/tutorial12_extensions/tutorial12.cpp index d123f6322..8ddc4dc4d 100644 --- a/tutorial12_extensions/tutorial12.cpp +++ b/tutorial12_extensions/tutorial12.cpp @@ -69,18 +69,20 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // ARB_debug_output is a bit special, // it requires creating the OpenGL context // with paticular flags. - // GLFW expose it this way; if you use SDL, SFML, freeGLUT + // GLFW exposes it this way; if you use SDL, SFML, freeGLUT // or other, check the documentation. // If you use custom code, read the spec : // http://www.opengl.org/registry/specs/ARB/debug_output.txt @@ -90,6 +92,7 @@ int main( void ) window = glfwCreateWindow( 1024, 768, "Tutorial 12 - Extensions", 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; } @@ -99,6 +102,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial13_normal_mapping/NormalMapping.fragmentshader b/tutorial13_normal_mapping/NormalMapping.fragmentshader index 9900effca..6240618a5 100644 --- a/tutorial13_normal_mapping/NormalMapping.fragmentshader +++ b/tutorial13_normal_mapping/NormalMapping.fragmentshader @@ -29,12 +29,12 @@ void main(){ float LightPower = 40.0; // Material properties - vec3 MaterialDiffuseColor = texture2D( DiffuseTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( DiffuseTextureSampler, UV ).rgb; vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor; - vec3 MaterialSpecularColor = texture2D( SpecularTextureSampler, UV ).rgb * 0.3; + vec3 MaterialSpecularColor = texture( SpecularTextureSampler, UV ).rgb * 0.3; // Local normal, in tangent space. V tex coordinate is inverted because normal map is in TGA (not in DDS) for better quality - vec3 TextureNormal_tangentspace = normalize(texture2D( NormalTextureSampler, vec2(UV.x,-UV.y) ).rgb*2.0 - 1.0); + vec3 TextureNormal_tangentspace = normalize(texture( NormalTextureSampler, vec2(UV.x,-UV.y) ).rgb*2.0 - 1.0); // Distance to the light float distance = length( LightPosition_worldspace - Position_worldspace ); diff --git a/tutorial13_normal_mapping/tutorial13.cpp b/tutorial13_normal_mapping/tutorial13.cpp index f5ede5e96..b40488077 100644 --- a/tutorial13_normal_mapping/tutorial13.cpp +++ b/tutorial13_normal_mapping/tutorial13.cpp @@ -28,19 +28,22 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 1); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); - //glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + //glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE); // So that glBegin/glVertex/glEnd work // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 13 - Normal Mapping", 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; } @@ -50,6 +53,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial14_render_to_texture/StandardShadingRTT.fragmentshader b/tutorial14_render_to_texture/StandardShadingRTT.fragmentshader index c02e9d70c..267c45ae7 100644 --- a/tutorial14_render_to_texture/StandardShadingRTT.fragmentshader +++ b/tutorial14_render_to_texture/StandardShadingRTT.fragmentshader @@ -23,7 +23,7 @@ void main(){ float LightPower = 50.0f; // Material properties - vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( myTextureSampler, UV ).rgb; vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor; vec3 MaterialSpecularColor = vec3(0.3,0.3,0.3); diff --git a/tutorial14_render_to_texture/tutorial14.cpp b/tutorial14_render_to_texture/tutorial14.cpp index 88948e194..80809ce6e 100644 --- a/tutorial14_render_to_texture/tutorial14.cpp +++ b/tutorial14_render_to_texture/tutorial14.cpp @@ -27,18 +27,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 14 - Render To Texture", 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; } @@ -48,6 +51,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial15_lightmaps/TextureFragmentShaderLOD.fragmentshader b/tutorial15_lightmaps/TextureFragmentShaderLOD.fragmentshader index 026820b9d..cf2ddb625 100644 --- a/tutorial15_lightmaps/TextureFragmentShaderLOD.fragmentshader +++ b/tutorial15_lightmaps/TextureFragmentShaderLOD.fragmentshader @@ -12,5 +12,5 @@ uniform sampler2D myTextureSampler; void main(){ // Output color = color of the texture at the specified UV - color = texture2D( myTextureSampler, UV, -2.0 ).rgb; + color = texture( myTextureSampler, UV, -2.0 ).rgb; } \ No newline at end of file diff --git a/tutorial15_lightmaps/tutorial15.cpp b/tutorial15_lightmaps/tutorial15.cpp index 96b28ccf2..ddfcbd655 100644 --- a/tutorial15_lightmaps/tutorial15.cpp +++ b/tutorial15_lightmaps/tutorial15.cpp @@ -26,18 +26,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 15 - Lightmaps", 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; } @@ -47,6 +50,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial16_shadowmaps/ShadowMapping.fragmentshader b/tutorial16_shadowmaps/ShadowMapping.fragmentshader index befc85a2d..e07a56d30 100644 --- a/tutorial16_shadowmaps/ShadowMapping.fragmentshader +++ b/tutorial16_shadowmaps/ShadowMapping.fragmentshader @@ -50,7 +50,7 @@ void main(){ float LightPower = 1.0f; // Material properties - vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( myTextureSampler, UV ).rgb; vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor; vec3 MaterialSpecularColor = vec3(0.3,0.3,0.3); diff --git a/tutorial16_shadowmaps/ShadowMapping_SimpleVersion.fragmentshader b/tutorial16_shadowmaps/ShadowMapping_SimpleVersion.fragmentshader index e7fbf309c..a6cb62ed6 100644 --- a/tutorial16_shadowmaps/ShadowMapping_SimpleVersion.fragmentshader +++ b/tutorial16_shadowmaps/ShadowMapping_SimpleVersion.fragmentshader @@ -17,7 +17,7 @@ void main(){ vec3 LightColor = vec3(1,1,1); // Material properties - vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( myTextureSampler, UV ).rgb; float visibility = texture( shadowMap, vec3(ShadowCoord.xy, (ShadowCoord.z)/ShadowCoord.w) ); diff --git a/tutorial16_shadowmaps/SimpleTexture.fragmentshader b/tutorial16_shadowmaps/SimpleTexture.fragmentshader index cfbb4ad13..4ba468dcf 100644 --- a/tutorial16_shadowmaps/SimpleTexture.fragmentshader +++ b/tutorial16_shadowmaps/SimpleTexture.fragmentshader @@ -8,5 +8,5 @@ uniform sampler2D texture; in vec2 UV; void main(){ - color = texture2D(texture, UV); + color = texture(texture, UV); } \ No newline at end of file diff --git a/tutorial16_shadowmaps/tutorial16.cpp b/tutorial16_shadowmaps/tutorial16.cpp index 94c44f48a..805edfa17 100644 --- a/tutorial16_shadowmaps/tutorial16.cpp +++ b/tutorial16_shadowmaps/tutorial16.cpp @@ -27,18 +27,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 16 - Shadows", 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; } @@ -48,6 +51,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial16_shadowmaps/tutorial16_SimpleVersion.cpp b/tutorial16_shadowmaps/tutorial16_SimpleVersion.cpp index b3abdfeaf..793b23393 100644 --- a/tutorial16_shadowmaps/tutorial16_SimpleVersion.cpp +++ b/tutorial16_shadowmaps/tutorial16_SimpleVersion.cpp @@ -27,18 +27,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 16 - Shadows, Simple version", 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; } @@ -48,6 +51,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial17_rotations/StandardShading.fragmentshader b/tutorial17_rotations/StandardShading.fragmentshader index aa893266f..8cf102c1f 100644 --- a/tutorial17_rotations/StandardShading.fragmentshader +++ b/tutorial17_rotations/StandardShading.fragmentshader @@ -23,7 +23,7 @@ void main(){ float LightPower = 50.0f; // Material properties - vec3 MaterialDiffuseColor = texture2D( myTextureSampler, UV ).rgb; + vec3 MaterialDiffuseColor = texture( myTextureSampler, UV ).rgb; vec3 MaterialAmbientColor = vec3(0.1,0.1,0.1) * MaterialDiffuseColor; vec3 MaterialSpecularColor = vec3(0.3,0.3,0.3); diff --git a/tutorial17_rotations/tutorial17.cpp b/tutorial17_rotations/tutorial17.cpp index b05f5ca7d..a764fc9f5 100644 --- a/tutorial17_rotations/tutorial17.cpp +++ b/tutorial17_rotations/tutorial17.cpp @@ -46,18 +46,21 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 17 - Rotations", 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; } @@ -67,6 +70,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial18_billboards_and_particles/Billboard.fragmentshader b/tutorial18_billboards_and_particles/Billboard.fragmentshader index 646a0d39e..ae55b52ba 100644 --- a/tutorial18_billboards_and_particles/Billboard.fragmentshader +++ b/tutorial18_billboards_and_particles/Billboard.fragmentshader @@ -12,7 +12,7 @@ uniform float LifeLevel; void main(){ // Output color = color of the texture at the specified UV - color = texture2D( myTextureSampler, UV ); + color = texture( myTextureSampler, UV ); // Hardcoded life level, should be in a separate texture. if (UV.x < LifeLevel && UV.y > 0.3 && UV.y < 0.7 && UV.x > 0.04 ) diff --git a/tutorial18_billboards_and_particles/Particle.fragmentshader b/tutorial18_billboards_and_particles/Particle.fragmentshader index 093177643..fc9e7c4fd 100644 --- a/tutorial18_billboards_and_particles/Particle.fragmentshader +++ b/tutorial18_billboards_and_particles/Particle.fragmentshader @@ -11,6 +11,6 @@ uniform sampler2D myTextureSampler; void main(){ // Output color = color of the texture at the specified UV - color = texture2D( myTextureSampler, UV ) * particlecolor; + color = texture( myTextureSampler, UV ) * particlecolor; } \ No newline at end of file diff --git a/tutorial18_billboards_and_particles/tutorial18_billboards.cpp b/tutorial18_billboards_and_particles/tutorial18_billboards.cpp index d4792d537..d1ccfe86b 100644 --- a/tutorial18_billboards_and_particles/tutorial18_billboards.cpp +++ b/tutorial18_billboards_and_particles/tutorial18_billboards.cpp @@ -27,6 +27,7 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } @@ -34,12 +35,14 @@ int main( void ) glfwWindowHint(GLFW_RESIZABLE,GL_FALSE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 18 - Billboards", 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; } @@ -52,6 +55,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; } diff --git a/tutorial18_billboards_and_particles/tutorial18_particles.cpp b/tutorial18_billboards_and_particles/tutorial18_particles.cpp index f6b241815..d217be6e2 100644 --- a/tutorial18_billboards_and_particles/tutorial18_particles.cpp +++ b/tutorial18_billboards_and_particles/tutorial18_particles.cpp @@ -68,6 +68,7 @@ int main( void ) if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); + getchar(); return -1; } @@ -75,12 +76,14 @@ int main( void ) glfwWindowHint(GLFW_RESIZABLE,GL_FALSE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 18 - Particules", 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; } @@ -93,6 +96,8 @@ int main( void ) glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); + getchar(); + glfwTerminate(); return -1; }