I am trying to correct the translation and rotation behavior of my model after I rotate the image. This seems to be a common issue. I've seen this asked before, but I have not seen it answered in such a way that I understand how to apply it to my code. I simply want the translation and rotation behavior to remain how it is before I rotate the image. After the first rotation the translations and rotations are forever skewed. Also, I am very green with OpenGL so please talk slowly.
Private Sub GlControl1_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles GlControl1.MouseMove
If _MouseButtonLeft Then
'
' get new position of mouse
_XposEnd = e.X - _Xpos
_YposEnd = _Ypos - e.Y
'
' reset the mouse start position
_Xpos = e.X
_Ypos = e.Y
'
' change projection
GL.MatrixMode(MatrixMode.Projection)
GL.Translate(_XposEnd * _MouseSpeed, _YposEnd * _MouseSpeed, 0)
GlControl1.Invalidate()
'
End If
'
If _MouseButtonRight Then
'
' get new position of mouse
_XposEnd = e.X - _Xpos
_YposEnd = _Ypos - e.Y
'
' reset the mouse start position
_Xpos = e.X
_Ypos = e.Y
'
' change projection
GL.MatrixMode(MatrixMode.Projection)
GL.Rotate(_XposEnd * _MouseSpeed, 1, 0, 0)
GL.Rotate(_YposEnd * _MouseSpeed, 0, 1, 0)
GlControl1.Invalidate()
'
End If
End Sub
EDIT 1:
My draw loop is:
GL.Clear(ClearBufferMask.ColorBufferBit)
GL.Clear(ClearBufferMask.DepthBufferBit)
GL.MatrixMode(MatrixMode.Modelview)
GL.LoadIdentity()
drawStuff()
GlControl1.SwapBuffers()
Projection Matrix: Let me back up for a second. I am drawing a CAD model with thousands of vertices in 3D space [Vertex3]. I am viewing them in 2D space [Ortho]. I modify the projection matrix to view the model from different perspectives. I thought that would be easier than redrawing the entire model and transforming all the vertices. In my mind moving the camera is easier than recalculating the position of thousands of vertices. I figured that was standard. If not, I'm all ears.