Join Pablo Colapinto for an in-depth discussion in this video Adding keyboard input, part of Learning OpenGL.
-In this lesson, we'll examine a way to use…keyboard input to navigate through our scene.…On lines 93, 94 and 95, we've defined a few…member variables that we're going to use.…One will store our key code, which is the key…that was pressed, the other our eye position,…or camera position, and the last the direction…in which we're looking.…This is the meat of our navigation code…and we're going to get back to it in a second.…
Let's scroll down to lines 234 to 241.…Here we've overloaded our application's…on key down method.…It takes in as a parameter the key that…was pressed and the action taken.…We ask if the action was a press.…If it was, then we set our key code…to whatever key was pressed and print out "key pressed."…If the action was a release, we set the key code…to negative one and print out "key released."…The on key down is called whenever a key is pressed.…
However, we want to be able to navigate every frame.…We check to see whether the last key…event was a release.…If it wasn't, then we can check to see…whether the key code is a key up, key down, or key left,…
- What is OpenGL?
- Setting up an OpenGL workflow
- Creating a window with GLFW
- Working with geometric primitives
- Rotating, translating, and scaling
- Understanding matrix transformations
- Creating mesh data structures
- Buffering mesh data
- Getting mouse and keyboard input
Skill Level Intermediate
Q: Why am I getting errors saying I don’t have GLEW installed when I try to create the Xcode projects with Cmake?
1) Download, Install, and Run Xcode
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew install glew
./bootstrap && make && make install
brew install cmake
cd Exercise Filesmkdir xcodecd xcodecmake -G "Xcode" ..