Join Pablo Colapinto for an in-depth discussion in this video Detecting errors, part of Learning OpenGL.
With all the binding and unbinding…we're doing with the GPU.…Errors can emerge.…This can happen, for instance, if we try…to call glBufferData before we bind an actual buffer.…To help catch these kinds of errors,…sometimes it's useful to use the glGetError command.…glGetError will return the last reported error from OpenGL.…In gl_error.hpp we have a utility function…that can help report these kinds of errors.…We can use the GL Error function included in this file…to catch any current OpenGL errors,…and report on the current state.…
If OpenGL catches any invalid states,…it will report this message to our console.…So we can use this, for instance,…in TriangleBuffer.cpp if we include gl_error.hpp.…And for instance try to call glBufferData…without actually binding the buffer.…When we compile this code, our program will crash.…But at least we'll some information…in our console about where it crashed.…Here it reports that during the buffering data phase,…the specified operation was not allowed.…
So we can look in our code,…
- 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" ..