OpenGl_ShaderManager::GetBgCubeMapProgram() and OpenGl_BackgroundArray::createCubeMapArray()
have been corrected to draw cube in straightforward way instead of a screen-quad.
Graphic3d_Camera::SetCustomStereoProjection() now recieves decomposed projection + head-to-eye matrices.
Added method Graphic3d_Camera::StereoProjection() returning projection matrix without translation part.
OpenGl_BackgroundArray::Render() now applies stereoscopic projection matrix in case of VR output,
but keeps using mono projection matrix in case of common 3D displays.
const Graphic3d_Mat4d aPoseR = myXRSession->HeadToEyeTransform (Aspect_Eye_Right);
const Graphic3d_Mat4d aProjL = myXRSession->ProjectionMatrix (Aspect_Eye_Left, myCamera->ZNear(), myCamera->ZFar());
const Graphic3d_Mat4d aProjR = myXRSession->ProjectionMatrix (Aspect_Eye_Right, myCamera->ZNear(), myCamera->ZFar());
- myCamera->SetCustomStereoProjection (aProjL * aPoseL, aProjR * aPoseR);
+ myCamera->SetCustomStereoProjection (aProjL, aPoseL, aProjR, aPoseR);
}
myBaseXRCamera = myCamera;
if (myPosedXRCamera.IsNull())
ResetCustomProjection();
if (theOtherCamera->IsCustomStereoProjection())
{
- SetCustomStereoProjection (theOtherCamera->myCustomProjMatL, theOtherCamera->myCustomProjMatR);
+ SetCustomStereoProjection (theOtherCamera->myCustomProjMatL,
+ theOtherCamera->myCustomHeadToEyeMatL,
+ theOtherCamera->myCustomProjMatR,
+ theOtherCamera->myCustomHeadToEyeMatR);
}
else if (theOtherCamera->IsCustomStereoFrustum())
{
}
}
+// =======================================================================
+// function : StereoProjection
+// purpose :
+// =======================================================================
+void Graphic3d_Camera::StereoProjection (Graphic3d_Mat4d& theProjL,
+ Graphic3d_Mat4d& theHeadToEyeL,
+ Graphic3d_Mat4d& theProjR,
+ Graphic3d_Mat4d& theHeadToEyeR) const
+{
+ stereoProjection (theProjL, theHeadToEyeL, theProjR, theHeadToEyeR);
+}
+
+// =======================================================================
+// function : StereoProjectionF
+// purpose :
+// =======================================================================
+void Graphic3d_Camera::StereoProjectionF (Graphic3d_Mat4& theProjL,
+ Graphic3d_Mat4& theHeadToEyeL,
+ Graphic3d_Mat4& theProjR,
+ Graphic3d_Mat4& theHeadToEyeR) const
+{
+ stereoProjection (theProjL, theHeadToEyeL, theProjR, theHeadToEyeR);
+}
+
+// =======================================================================
+// function : stereoProjection
+// purpose :
+// =======================================================================
+template <typename Elem_t>
+void Graphic3d_Camera::stereoProjection (NCollection_Mat4<Elem_t>& theProjL,
+ NCollection_Mat4<Elem_t>& theHeadToEyeL,
+ NCollection_Mat4<Elem_t>& theProjR,
+ NCollection_Mat4<Elem_t>& theHeadToEyeR) const
+{
+ if (myIsCustomProjMatLR)
+ {
+ theProjL .ConvertFrom (myCustomProjMatL);
+ theHeadToEyeL.ConvertFrom (myCustomHeadToEyeMatL);
+ theProjR .ConvertFrom (myCustomProjMatR);
+ theHeadToEyeR.ConvertFrom (myCustomHeadToEyeMatR);
+ return;
+ }
+
+ NCollection_Mat4<Elem_t> aDummy;
+ computeProjection (aDummy, theProjL, theProjR, false);
+
+ const Standard_Real aIOD = myIODType == IODType_Relative
+ ? myIOD * Distance()
+ : myIOD;
+ if (aIOD != 0.0)
+ {
+ // X translation to cancel parallax
+ theHeadToEyeL.InitIdentity();
+ theHeadToEyeL.SetColumn (3, NCollection_Vec3<Elem_t> (Elem_t ( 0.5 * aIOD), Elem_t (0.0), Elem_t (0.0)));
+ theHeadToEyeR.InitIdentity();
+ theHeadToEyeR.SetColumn (3, NCollection_Vec3<Elem_t> (Elem_t (-0.5 * aIOD), Elem_t (0.0), Elem_t (0.0)));
+ }
+}
+
// =======================================================================
// function : SetCustomStereoFrustums
// purpose :
// purpose :
// =======================================================================
void Graphic3d_Camera::SetCustomStereoProjection (const Graphic3d_Mat4d& theProjL,
- const Graphic3d_Mat4d& theProjR)
+ const Graphic3d_Mat4d& theHeadToEyeL,
+ const Graphic3d_Mat4d& theProjR,
+ const Graphic3d_Mat4d& theHeadToEyeR)
{
myCustomProjMatL = theProjL;
myCustomProjMatR = theProjR;
+ myCustomHeadToEyeMatL = theHeadToEyeL;
+ myCustomHeadToEyeMatR = theHeadToEyeR;
myIsCustomProjMatLR = true;
myIsCustomFrustomLR = false;
InvalidateProjection();
}
// =======================================================================
-// function : UpdateProjection
+// function : computeProjection
// purpose :
// =======================================================================
template <typename Elem_t>
-Graphic3d_Camera::TransformMatrices<Elem_t>&
- Graphic3d_Camera::UpdateProjection (TransformMatrices<Elem_t>& theMatrices) const
+void Graphic3d_Camera::computeProjection (NCollection_Mat4<Elem_t>& theProjM,
+ NCollection_Mat4<Elem_t>& theProjL,
+ NCollection_Mat4<Elem_t>& theProjR,
+ bool theToAddHeadToEye) const
{
- if (theMatrices.IsProjectionValid())
- {
- return theMatrices; // for inline accessors
- }
-
- theMatrices.InitProjection();
+ theProjM.InitIdentity();
+ theProjL.InitIdentity();
+ theProjR.InitIdentity();
// sets top of frustum based on FOVy and near clipping plane
Elem_t aScale = static_cast<Elem_t> (myScale);
if (myIsCustomProjMatM)
{
- theMatrices.MProjection.ConvertFrom (myCustomProjMatM);
+ theProjM.ConvertFrom (myCustomProjMatM);
}
switch (myProjType)
{
{
if (!myIsCustomProjMatM)
{
- orthoProj (theMatrices.MProjection, anLRBT, aZNear, aZFar);
+ orthoProj (theProjM, anLRBT, aZNear, aZFar);
}
break;
}
{
if (!myIsCustomProjMatM)
{
- perspectiveProj (theMatrices.MProjection, anLRBT, aZNear, aZFar);
+ perspectiveProj (theProjM, anLRBT, aZNear, aZFar);
}
break;
}
{
if (!myIsCustomProjMatM)
{
- perspectiveProj (theMatrices.MProjection, anLRBT, aZNear, aZFar);
+ perspectiveProj (theProjM, anLRBT, aZNear, aZFar);
}
if (myIsCustomProjMatLR)
{
- theMatrices.LProjection.ConvertFrom (myCustomProjMatL);
- theMatrices.RProjection.ConvertFrom (myCustomProjMatR);
+ if (theToAddHeadToEye)
+ {
+ theProjL.ConvertFrom (myCustomProjMatL * myCustomHeadToEyeMatL);
+ theProjR.ConvertFrom (myCustomProjMatR * myCustomHeadToEyeMatR);
+ }
+ else
+ {
+ theProjL.ConvertFrom (myCustomProjMatL);
+ theProjR.ConvertFrom (myCustomProjMatR);
+ }
}
else if (myIsCustomFrustomLR)
{
anLRBT = Aspect_FrustumLRBT<Elem_t> (myCustomFrustumL).Multiplied (aZNear);
- perspectiveProj (theMatrices.LProjection, anLRBT, aZNear, aZFar);
- if (aIOD != Elem_t (0.0))
- {
- theMatrices.LProjection.Translate (NCollection_Vec3<Elem_t> (Elem_t (0.5) * aIOD, Elem_t (0.0), Elem_t (0.0)));
- }
+ perspectiveProj (theProjL, anLRBT, aZNear, aZFar);
anLRBT = Aspect_FrustumLRBT<Elem_t> (myCustomFrustumR).Multiplied (aZNear);
- perspectiveProj (theMatrices.RProjection, anLRBT, aZNear, aZFar);
- if (aIOD != Elem_t (0.0))
- {
- theMatrices.RProjection.Translate (NCollection_Vec3<Elem_t> (Elem_t (-0.5) * aIOD, Elem_t (0.0), Elem_t (0.0)));
- }
+ perspectiveProj (theProjR, anLRBT, aZNear, aZFar);
}
else
{
- stereoEyeProj (theMatrices.LProjection,
+ stereoEyeProj (theProjL,
anLRBT, aZNear, aZFar, aIOD, aFocus,
Aspect_Eye_Left);
- stereoEyeProj (theMatrices.RProjection,
+ stereoEyeProj (theProjR,
anLRBT, aZNear, aZFar, aIOD, aFocus,
Aspect_Eye_Right);
}
+
+ if (theToAddHeadToEye
+ && !myIsCustomProjMatLR
+ && aIOD != Elem_t (0.0))
+ {
+ // X translation to cancel parallax
+ theProjL.Translate (NCollection_Vec3<Elem_t> (Elem_t ( 0.5) * aIOD, Elem_t (0.0), Elem_t (0.0)));
+ theProjR.Translate (NCollection_Vec3<Elem_t> (Elem_t (-0.5) * aIOD, Elem_t (0.0), Elem_t (0.0)));
+ }
break;
}
}
if (myProjType == Projection_MonoLeftEye)
{
- theMatrices.MProjection = theMatrices.LProjection;
+ theProjM = theProjL;
}
else if (myProjType == Projection_MonoRightEye)
{
- theMatrices.MProjection = theMatrices.RProjection;
+ theProjM = theProjR;
}
-
- return theMatrices; // for inline accessors
}
// =======================================================================
aLRBT.Left = theLRBT.Left + aDXStereoShift;
aLRBT.Right = theLRBT.Right + aDXStereoShift;
perspectiveProj (theOutMx, aLRBT, theNear, theFar);
-
- if (theIOD != Elem_t (0.0))
- {
- // X translation to cancel parallax
- theOutMx.Translate (NCollection_Vec3<Elem_t> (aDx, Elem_t (0.0), Elem_t (0.0)));
- }
}
// =======================================================================
public:
+ //! Get stereo projection matrices.
+ //! @param theProjL [out] left eye projection matrix
+ //! @param theHeadToEyeL [out] left head to eye translation matrix
+ //! @param theProjR [out] right eye projection matrix
+ //! @param theHeadToEyeR [out] right head to eye translation matrix
+ Standard_EXPORT void StereoProjection (Graphic3d_Mat4d& theProjL,
+ Graphic3d_Mat4d& theHeadToEyeL,
+ Graphic3d_Mat4d& theProjR,
+ Graphic3d_Mat4d& theHeadToEyeR) const;
+
+ //! Get stereo projection matrices.
+ //! @param theProjL [out] left eye projection matrix
+ //! @param theHeadToEyeL [out] left head to eye translation matrix
+ //! @param theProjR [out] right eye projection matrix
+ //! @param theHeadToEyeR [out] right head to eye translation matrix
+ Standard_EXPORT void StereoProjectionF (Graphic3d_Mat4& theProjL,
+ Graphic3d_Mat4& theHeadToEyeL,
+ Graphic3d_Mat4& theProjR,
+ Graphic3d_Mat4& theHeadToEyeR) const;
+
//! Unset all custom frustums and projection matrices.
Standard_EXPORT void ResetCustomProjection();
bool IsCustomStereoProjection() const { return myIsCustomProjMatLR; }
//! Set custom stereo projection matrices.
+ //! @param theProjL [in] left eye projection matrix
+ //! @param theHeadToEyeL [in] left head to eye translation matrix
+ //! @param theProjR [in] right eye projection matrix
+ //! @param theHeadToEyeR [in] right head to eye translation matrix
Standard_EXPORT void SetCustomStereoProjection (const Graphic3d_Mat4d& theProjL,
- const Graphic3d_Mat4d& theProjR);
+ const Graphic3d_Mat4d& theHeadToEyeL,
+ const Graphic3d_Mat4d& theProjR,
+ const Graphic3d_Mat4d& theHeadToEyeR);
//! Return TRUE if custom projection matrix is set.
bool IsCustomMonoProjection() const { return myIsCustomProjMatM; }
//! @name Managing projection and orientation cache
private:
+ //! Get stereo projection matrices.
+ //! @param theProjL [out] left eye projection matrix
+ //! @param theHeadToEyeL [out] left head to eye translation matrix
+ //! @param theProjR [out] right eye projection matrix
+ //! @param theHeadToEyeR [out] right head to eye translation matrix
+ template <typename Elem_t>
+ Standard_EXPORT void stereoProjection (NCollection_Mat4<Elem_t>& theProjL,
+ NCollection_Mat4<Elem_t>& theHeadToEyeL,
+ NCollection_Mat4<Elem_t>& theProjR,
+ NCollection_Mat4<Elem_t>& theHeadToEyeR) const;
+
+ //! Compute projection matrices.
+ //! @param theProjM [out] mono projection matrix
+ //! @param theProjL [out] left eye projection matrix
+ //! @param theProjR [out] right eye projection matrix
+ //! @param theToAddHeadToEye [in] flag to pre-multiply head-to-eye translation
+ template <typename Elem_t>
+ Standard_EXPORT void computeProjection (NCollection_Mat4<Elem_t>& theProjM,
+ NCollection_Mat4<Elem_t>& theProjL,
+ NCollection_Mat4<Elem_t>& theProjR,
+ bool theToAddHeadToEye) const;
+
//! Compute projection matrices.
//! @param theMatrices [in] the matrices data container.
template <typename Elem_t>
- Standard_EXPORT
- TransformMatrices<Elem_t>& UpdateProjection (TransformMatrices<Elem_t>& theMatrices) const;
+ TransformMatrices<Elem_t>& UpdateProjection (TransformMatrices<Elem_t>& theMatrices) const
+ {
+ if (!theMatrices.IsProjectionValid())
+ {
+ theMatrices.InitProjection();
+ computeProjection (theMatrices.MProjection, theMatrices.LProjection, theMatrices.RProjection, true);
+ }
+ return theMatrices;
+ }
//! Compute orientation matrix.
//! @param theMatrices [in] the matrices data container.
Graphic3d_Mat4d myCustomProjMatM;
Graphic3d_Mat4d myCustomProjMatL;
Graphic3d_Mat4d myCustomProjMatR;
+ Graphic3d_Mat4d myCustomHeadToEyeMatL;
+ Graphic3d_Mat4d myCustomHeadToEyeMatR;
Aspect_FrustumLRBT<Standard_Real> myCustomFrustumL; //!< left custom frustum
Aspect_FrustumLRBT<Standard_Real> myCustomFrustumR; //!< right custom frustum
Standard_Boolean myIsCustomProjMatM; //!< flag indicating usage of custom projection matrix
// =======================================================================
OpenGl_BackgroundArray::OpenGl_BackgroundArray (const Graphic3d_TypeOfBackground theType)
: OpenGl_PrimitiveArray (NULL, Graphic3d_TOPA_TRIANGLESTRIPS, NULL, NULL, NULL),
- myTrsfPers (Graphic3d_TMF_2d, theType == Graphic3d_TOB_TEXTURE ? Aspect_TOTP_CENTER : Aspect_TOTP_LEFT_LOWER),
myType (theType),
myFillMethod (Aspect_FM_NONE),
myViewWidth (0),
// =======================================================================
Standard_Boolean OpenGl_BackgroundArray::createCubeMapArray() const
{
- Graphic3d_Attribute aCubeMapAttribInfo[] =
+ const Graphic3d_Attribute aCubeMapAttribInfo[] =
{
- { Graphic3d_TOA_POS, Graphic3d_TOD_VEC2}
+ { Graphic3d_TOA_POS, Graphic3d_TOD_VEC3 }
};
if (myAttribs.IsNull())
{
Handle(NCollection_AlignedAllocator) anAlloc = new NCollection_AlignedAllocator (16);
myAttribs = new Graphic3d_Buffer (anAlloc);
+ myIndices = new Graphic3d_IndexBuffer (anAlloc);
}
- if (!myAttribs->Init(4, aCubeMapAttribInfo, 1))
+ if (!myAttribs->Init (8, aCubeMapAttribInfo, 1)
+ || !myIndices->Init<unsigned short> (14))
{
return Standard_False;
}
- OpenGl_Vec2* aData = reinterpret_cast<OpenGl_Vec2*>(myAttribs->changeValue(0));
-
- for (unsigned int i = 0; i < 4; ++i)
{
- aData[i] = (OpenGl_Vec2(Standard_ShortReal(i / 2), Standard_ShortReal(i % 2)) - OpenGl_Vec2(0.5f)) * 2.f;
+ OpenGl_Vec3* aData = reinterpret_cast<OpenGl_Vec3*>(myAttribs->changeValue(0));
+ aData[0].SetValues (-1.0, -1.0, 1.0);
+ aData[1].SetValues ( 1.0, -1.0, 1.0);
+ aData[2].SetValues (-1.0, 1.0, 1.0);
+ aData[3].SetValues ( 1.0, 1.0, 1.0);
+ aData[4].SetValues (-1.0, -1.0, -1.0);
+ aData[5].SetValues ( 1.0, -1.0, -1.0);
+ aData[6].SetValues (-1.0, 1.0, -1.0);
+ aData[7].SetValues ( 1.0, 1.0, -1.0);
+ }
+ {
+ const unsigned short THE_BOX_TRISTRIP[14] = { 0, 1, 2, 3, 7, 1, 5, 4, 7, 6, 2, 4, 0, 1 };
+ for (unsigned int aVertIter = 0; aVertIter < 14; ++aVertIter)
+ {
+ myIndices->SetIndex (aVertIter, THE_BOX_TRISTRIP[aVertIter]);
+ }
}
return Standard_True;
// method : Render
// purpose :
// =======================================================================
-void OpenGl_BackgroundArray::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
+void OpenGl_BackgroundArray::Render (const Handle(OpenGl_Workspace)& theWorkspace,
+ Graphic3d_Camera::Projection theProjection) const
{
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
Standard_Integer aViewSizeX = aCtx->Viewport()[2];
OpenGl_Mat4 aProjection = aCtx->ProjectionState.Current();
OpenGl_Mat4 aWorldView = aCtx->WorldViewState.Current();
- if (myType != Graphic3d_TOB_CUBEMAP)
+ if (myType == Graphic3d_TOB_CUBEMAP)
+ {
+ Graphic3d_Camera aCamera (theWorkspace->View()->Camera());
+ aCamera.SetZRange (0.01, 1.0); // is needed to avoid perspective camera exception
+
+ // cancel translation
+ aCamera.MoveEyeTo (gp_Pnt (0.0, 0.0, 0.0));
+
+ // Handle projection matrix:
+ // - Cancel any head-to-eye translation for HMD display;
+ // - Ignore stereoscopic projection in case of non-HMD 3D display
+ // (ideally, we would need a stereoscopic cubemap image; adding a parallax makes no sense);
+ // - Force perspective projection when orthographic camera is active
+ // (orthographic projection makes no sense for cubemap).
+ const bool isCustomProj = aCamera.IsCustomStereoFrustum()
+ || aCamera.IsCustomStereoProjection();
+ aCamera.SetProjectionType (theProjection == Graphic3d_Camera::Projection_Orthographic || !isCustomProj
+ ? Graphic3d_Camera::Projection_Perspective
+ : theProjection);
+
+ aProjection = aCamera.ProjectionMatrixF();
+ aWorldView = aCamera.OrientationMatrixF();
+ if (isCustomProj)
+ {
+ // get projection matrix without pre-multiplied stereoscopic head-to-eye translation
+ if (theProjection == Graphic3d_Camera::Projection_MonoLeftEye)
+ {
+ Graphic3d_Mat4 aMatProjL, aMatHeadToEyeL, aMatProjR, aMatHeadToEyeR;
+ aCamera.StereoProjectionF (aMatProjL, aMatHeadToEyeL, aMatProjR, aMatHeadToEyeR);
+ aProjection = aMatProjL;
+ }
+ else if (theProjection == Graphic3d_Camera::Projection_MonoRightEye)
+ {
+ Graphic3d_Mat4 aMatProjL, aMatHeadToEyeL, aMatProjR, aMatHeadToEyeR;
+ aCamera.StereoProjectionF (aMatProjL, aMatHeadToEyeL, aMatProjR, aMatHeadToEyeR);
+ aProjection = aMatProjR;
+ }
+ }
+ }
+ else
{
aProjection.InitIdentity();
aWorldView.InitIdentity();
Standard_EXPORT OpenGl_BackgroundArray (const Graphic3d_TypeOfBackground theType);
//! Render primitives to the window
- Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const Standard_OVERRIDE;
+ Standard_EXPORT void Render (const Handle(OpenGl_Workspace)& theWorkspace,
+ Graphic3d_Camera::Projection theProjection) const;
//! Check if background parameters are set properly
Standard_EXPORT bool IsDefined() const;
//! on next rendering stage array data is to be updated.
Standard_EXPORT void invalidateData();
+ using OpenGl_PrimitiveArray::Render;
+
protected:
- Graphic3d_TransformPers myTrsfPers; //!< transformation persistence
Graphic3d_TypeOfBackground myType; //!< Type of background: texture or gradient.
Aspect_FillMethod myFillMethod; //!< Texture parameters
mutable OpenGl_GradientParameters myGradientParams; //!< Gradient parameters
+ THE_FUNC_cubemap_vector_transform
+ EOL"void main()"
EOL"{"
- EOL" vec4 aViewDirection = occProjectionMatrixInverse * vec4(occVertex.xy, 0.0, 1.0);"
- EOL" aViewDirection /= aViewDirection.w;"
- EOL" aViewDirection.w = 0.0;"
- EOL" ViewDirection = normalize((occWorldViewMatrixInverse * aViewDirection).xyz);"
- EOL" ViewDirection = cubemapVectorTransform (ViewDirection, uYCoeff, uZCoeff);"
- EOL" gl_Position = vec4(occVertex.xy, 0.0, 1.0);"
+ EOL" ViewDirection = cubemapVectorTransform (occVertex.xyz, uYCoeff, uZCoeff);"
+ EOL" vec4 aPos = occProjectionMatrix * occWorldViewMatrix * vec4(occVertex.xyz, 1.0);"
+ EOL" gl_Position = aPos.xyww;"
EOL"}";
TCollection_AsciiString aSrcFrag =
const Standard_Boolean theToDrawImmediate);
//! Draw background (gradient / image)
- Standard_EXPORT virtual void drawBackground (const Handle(OpenGl_Workspace)& theWorkspace);
+ Standard_EXPORT virtual void drawBackground (const Handle(OpenGl_Workspace)& theWorkspace,
+ Graphic3d_Camera::Projection theProjection);
//! Render set of structures presented in the view.
//! @param theProjection [in] the projection that is used for rendering.
//function : drawBackground
//purpose :
//=======================================================================
-void OpenGl_View::drawBackground (const Handle(OpenGl_Workspace)& theWorkspace)
+void OpenGl_View::drawBackground (const Handle(OpenGl_Workspace)& theWorkspace,
+ Graphic3d_Camera::Projection theProjection)
{
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
const Standard_Boolean wasUsedZBuffer = theWorkspace->SetUseZBuffer (Standard_False);
if (myBackgroundType == Graphic3d_TOB_CUBEMAP)
{
- Graphic3d_Camera aCamera (theWorkspace->View()->Camera());
- aCamera.SetZRange (0.01, 1.0); // is needed to avoid perspective camera exception
- aCamera.SetProjectionType (Graphic3d_Camera::Projection_Perspective);
-
- aCtx->ProjectionState.Push();
- aCtx->ProjectionState.SetCurrent (aCamera.ProjectionMatrixF());
-
myCubeMapParams->Aspect()->ShaderProgram()->PushVariableInt ("uZCoeff", myBackgroundCubeMap->ZIsInverted() ? -1 : 1);
myCubeMapParams->Aspect()->ShaderProgram()->PushVariableInt ("uYCoeff", myBackgroundCubeMap->IsTopDown() ? 1 : -1);
const OpenGl_Aspects* anOldAspectFace = theWorkspace->SetAspects (myCubeMapParams);
- myBackgrounds[Graphic3d_TOB_CUBEMAP]->Render (theWorkspace);
+ myBackgrounds[Graphic3d_TOB_CUBEMAP]->Render (theWorkspace, theProjection);
- aCtx->ProjectionState.Pop();
- aCtx->ApplyProjectionMatrix();
theWorkspace->SetAspects (anOldAspectFace);
}
else if (myBackgroundType == Graphic3d_TOB_GRADIENT
|| myBackgrounds[Graphic3d_TOB_TEXTURE]->TextureFillMethod() == Aspect_FM_CENTERED
|| myBackgrounds[Graphic3d_TOB_TEXTURE]->TextureFillMethod() == Aspect_FM_NONE))
{
- myBackgrounds[Graphic3d_TOB_GRADIENT]->Render(theWorkspace);
+ myBackgrounds[Graphic3d_TOB_GRADIENT]->Render(theWorkspace, theProjection);
}
// Drawing background image if it is defined
aCtx->core11fwd->glDisable (GL_BLEND);
const OpenGl_Aspects* anOldAspectFace = theWorkspace->SetAspects (myTextureParams);
- myBackgrounds[Graphic3d_TOB_TEXTURE]->Render (theWorkspace);
+ myBackgrounds[Graphic3d_TOB_TEXTURE]->Render (theWorkspace, theProjection);
theWorkspace->SetAspects (anOldAspectFace);
}
}
// Render background
if (!theToDrawImmediate)
{
- drawBackground (myWorkspace);
+ drawBackground (myWorkspace, theProjection);
}
#if !defined(GL_ES_VERSION_2_0)