Join Pablo Colapinto for an in-depth discussion in this video Using indices of vertex buffers, part of Learning OpenGL.
So far, we've been drawing triangles.…What if we want to draw some more complex geometry?…In this lesson, we will learn how to draw a cube…and how to use glDrawElements instead of…glDrawArray to index into a list of…vertices that we've sent to the GPU.…We're going to include the same headers as before.…And our shaded code is the same as in the…previous section on matrices.…We have a Vertex with a position and a color as before.…Here, we've added a new GLuint called elementID,…which we are going to use in a little bit.…
On line 100, we specify the 8 vertices of a cube.…And we have a little graphic here that shows us…the order in which we've added them.…So here we have a vertex at 1, negative 1, 1.…That's 1 in the positive X direction,…negative 1 in the Y direction,…and plus 1 in the Z direction.…We've also attached to that vertex color of red.…We've done the same for the next vertex…at 1, 1, 1 and so on, making the front side of the…cube and then the back side of the cube in this order.…
Next, we've made an array of indices.…
- 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" ..