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
- 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.