Issue with AIS_RubberBand Visualization

Forums: 

I am currently using AIS_RubberBand to display a selection rectangle on the screen.

However, when the View's width is significantly longer than its height (approximately a 4:1 aspect ratio), the Rubber Band is visualized in the wrong position. This issue is also reproducible in the standard Sample when using the "Zoom to Window" functionality.

How can I resolve this?

gkv311 n's picture

The issue is a side effect of an attempt to automatically fit 2D objects into a center of view in VR headset (e.g. Aspect_OpenVRSession). You may see this behavior by displaying 2D objects like AIS_ViewCube, though this wasn't supposed to break AIS_RubberBand.

pload VISUALIZATION
vinit View1 -width 1900 -height 200
vviewcube vc
# default value
vcamera -fov2d 180
# override to avoid moving
vcamera -fov2d 1000

Set Graphic3d_Camera::SetFOV2d() property to something large enough to avoid this side effect (the camera object could be accessed from V3d_View::Camera()).

  //! Get Field Of View (FOV) restriction for 2D on-screen elements; 180 degrees by default.
  //! When 2D FOV is smaller than FOVy or FOVx, 2D elements defined within offset from view corner
  //! will be extended to fit into specified 2D FOV.
  //! This can be useful to make 2D elements sharply visible, like in case of HMD normally having extra large FOVy.
  Standard_Real FOV2d() const { return myFOV2d; }

  //! Set Field Of View (FOV) restriction for 2D on-screen elements.
  Standard_EXPORT void SetFOV2d (Standard_Real theFOV);