From the course: Learning OpenGL

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Adding mouse input

Adding mouse input - OpenGL Tutorial

From the course: Learning OpenGL

Start my 1-month free trial

Adding mouse input

- In this lesson, we'll take a look at using some mouse interactions to manipulate our model matrix. We're including some of the encapsulated functionality that we've been discussing. So we have GL texture, which is gonna handle making and buffering data to our texture sampler and GL mesh, which handles buffering vertex data and binding it as well. Our shader code hasn't changed. We have a mouse struct, which contains some information about whether the mouse is down, its current X and Y position and screen coordinates, these are relative to the top left hand corner of the screen, and how much its moved since the last time we've clicked it. In our app class we have a mesh, a texture, and a shader. We have a mouse and we have a GLM quat. This is the GLM quaternion which we're calling temp rote for temporary rotation. We'll use that in a second. Here we make a cylindrical mesh. We don't need to discuss exactly how we do this but basically, we're going to be pushing the vertices of the…

Contents