void SetInteractionMode( int InteractionMode );



Specifies the interaction mode to be set. The parameter can be one of the following values:


No interaction with the user’s mouse & keyboard actions


Select mode. The mouse clicks in the window are responded by calling the callback functions passed by the SetSelectProcedure and SetSelectObjectCallback methods. Both callback must be set in order to support this mode. If CTRL key is pressed while selecting an object, then also reference point is moved to object’s center point.


Zoom to window interaction. It allows specification of the window area by the mouse. According to the state of the key specified by the ZoomOutModifierKey item of ControlInfo structure, the projection is set to zoom the specified area to the whole window (zoom in, ZoomOutModifierKey key not pressed) or to zoom the current window extent to the specified area (zoom out, ZoomOutModifierKey key pressed)


Panning interaction. It moves the current reference point according to the mouse drag actions in the object window.


Rotation. The user’s mouse move actions are responded by the eye point rotation around the current reference point. The interaction mode is also called the ‘space ball’ mode.


In this interaction mode the mouse cursor is hidden, mouse left and right movements are translated to look left and right view changes, mouse forward and back movements are translated to look up and down view changes. If ControlInfo’s MouseBankModifier key is pressed, the left mouse movement is translated to bank view to left, right mouse movement to bank view to right. In contrast with IM_ROTATE mode, during the view rotation in IM_FLY mode, the eye point remain fixed, and reference point is changing. This mode can be used to simulate plane or space ship like navigation through the scene.


This interaction mode is about the same as Free Look mode in Quake (and some other) games. This mode is similar to IM_FLY mode, except that in IM_FREE_LOOK mode it is not possible to look up/down beyond a fixed “gravity vector”, and that axis used to look left and right is always parallel with the “gravity vector”. This simulates human perception of space in “environments with ground and gravity”. The “gravity vector” is fixed opposite to up direction, which was current when IM_FREE_LOOK mode started. You can alter the “gravity vector” while in IM_FREE_LOOK mode by setting up the up direction by SetUpDirection method.


This is internal mode only, not recommended for use.


The SetInteractionMode method function sets the current COpenGL object’s interaction mode to the required interaction mode. You need to pass keyboard and mouse events to the OnKeyDown, OnKeyUp, OnLButtonDown, OnLButtonUp and OnMouseMove method functions to properly provide the object’s interaction modes.

The default interaction mode set at the time of object initialization is IM_NONE.

If SelectionProcedure and SelectObject callbacks are provided to COpenGL object then ClassGL first tries to select object on the coordinates where mouse button was pressed. If the callback select an object, ClassGL pans or rotates selected object, otherwise the eye point and/or reference point is moved or rotated. You can suppress the selection mode by holding Left CTRL key while pressing the mouse button.

Selection is available from ClassGL version 3.0


class COglSampleView : public CView
  // specify operations or attributes as desired …

  COpenGL     m_OpenGL;
  // specify operations or attributes as desired …

void COglSampleView::OnZoomWindow() 
  // set OpenGL object interaction mode to IM_ZOOM_WINDOW
  m_OpenGL.SetInteractionMode( m_OpenGL.GetInteractionMode() == IM_ZOOM_WINDOW ? IM_NONE : IM_ZOOM_WINDOW );

See Also

interaction modes, GetInteractionMode