Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ESC key binding #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions 00skeleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 01shader_vbo1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 01shader_vbo2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 02indexed_vbo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 03texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 04perspective.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 05fbo_fxaa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 06instancing1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 06instancing2_buffer_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 06instancing3_uniform_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 07geometry_shader_blending.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 08map_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 09transform_feedback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 10queries_conditional_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 11tesselation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 12shader_image_load_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
7 changes: 7 additions & 0 deletions 13compute_shader_nbody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ int main() {

glfwMakeContextCurrent(window);

// Bind ESC key press to close the application
glfwSetKeyCallback(window, [](GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS and key == GLFW_KEY_ESCAPE) {
glfwSetWindowShouldClose(window, true);
};
});

if(glxwInit()) {
std::cerr << "failed to init GL3W" << std::endl;
glfwDestroyWindow(window);
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 2.6)

project(OPENGLEXAMPLES)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

option(BUILD_OGL43 "Bild OpenGL 4.3 examples" OFF)
mark_as_advanced(BUILD_OGL43)

Expand Down