Skip to content

OpenGL Rotation

Roan requested to merge opengl/rotation into develop

Called rotation, however it's a bit more than that.

Features in this PR:

  • View rotation
  • Key bindings
  • Transformation resetting
  • OpenGL transformation state fetching

The key bindings implemented are:

  • WSAD for moving around on the canvans (mouse: drag)
  • Q and W for rotating anti-clockwise and clockwise (mouse: scroll + hold)
  • R and F for zooming in and out (mouse: scroll)
  • T for resetting all transformations

Functions were added to the OpenGL class to reset the scale, rotation and translation separately, however these functions are not linked to anything as of right now.

Functions were also added to get the rotation and scale of the model view. This can later be used to implement #79 (closed)

As always, more details can be found in the updated documentation.

Functionally this PR is done, however I could not figure out how to make the key events register only for the canvas. I could not find any events that worked like the mouse events and the method currently used receives all the key events generated. Once we find a proper keyevent/handler to use or if we can handle the events only if the canvas has focus this can be considered done. Thus I'm looking for some input on that.

Mandatory screenshot: image

fixes #78 (closed)

I'm still looking into modifying zooming and rotating to work around the cursor if the action is performed with the mouse. However this is mathematically a bit challenging so that might take me a bit longer to figure out. I suggest that we merge this as is and that I make a different PR once I've had the time to figure out the math involved.

Merge request reports

Loading