// Created on: 2011-09-20
// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-2012 OPEN CASCADE SAS
+// Copyright (c) 2011-2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
#ifndef _OpenGl_Workspace_Header
#define _OpenGl_Workspace_Header
#include <TColStd_Array2OfReal.hxx>
#include <Quantity_Color.hxx>
+#include <Graphic3d_CView.hxx>
#include <Graphic3d_TypeOfComposition.hxx>
+#include <Graphic3d_TypeOfTexture.hxx>
+#include <Graphic3d_PtrFrameBuffer.hxx>
+#include <Graphic3d_BufferType.hxx>
+#include <Handle_Graphic3d_TextureParams.hxx>
-#include <Graphic3d_CView.hxx>
#include <Aspect_CLayer2d.hxx>
#include <Aspect_Handle.hxx>
#include <Aspect_PrintAlgo.hxx>
-#include <Graphic3d_PtrFrameBuffer.hxx>
-#include <Image_CRawBufferData.hxx>
#include <InterfaceGraphic_Graphic3d.hxx>
#include <InterfaceGraphic_Visual3d.hxx>
+#include <NCollection_Sequence.hxx>
+
#include <OpenGl_tsm.hxx>
+#include <OpenGl_AspectFace.hxx>
#include <OpenGl_Display.hxx>
#include <OpenGl_Matrix.hxx>
#include <OpenGl_NamedStatus.hxx>
#include <OpenGl_TextParam.hxx>
#include <Handle_OpenGl_View.hxx>
+#include <Handle_OpenGl_Texture.hxx>
class OpenGl_AspectLine;
-class OpenGl_AspectFace;
class OpenGl_AspectMarker;
class OpenGl_AspectText;
class OpenGl_FrameBuffer;
class OpenGl_Structure;
+class Image_PixMap;
//! Reprepsents window with GL context.
//! Provides methods to render primitives and maintan GL state.
//! Main constructor - prepare GL context for specified window.
OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay,
const CALL_DEF_WINDOW& theCWindow,
- Aspect_RenderingContext theGContext);
+ Aspect_RenderingContext theGContext,
+ const Handle(OpenGl_Context)& theShareCtx);
//! Destructor
virtual ~OpenGl_Workspace();
//! Special method to perform printing.
//! System-specific and currently only Win platform implemented.
- Standard_Boolean Print (const Graphic3d_CView& theCView,
- const Aspect_CLayer2d& theCUnderLayer,
+ Standard_Boolean Print (const Graphic3d_CView& theCView,
+ const Aspect_CLayer2d& theCUnderLayer,
const Aspect_CLayer2d& theCOverLayer,
const Aspect_Handle theHPrintDC,
const Standard_Boolean theToShowBackground,
// szvgl: defined in OpenGl_Workspace_1.cxx
void BeginAnimation (const Standard_Boolean theUseDegeneration,
- const Standard_Boolean theUpdateAM);
+ const Standard_Boolean theUpdateAM);
void EndAnimation();
void EraseAnimation();
+ Standard_Boolean SetImmediateModeDrawToFront (const Standard_Boolean theDrawToFrontBuffer);
Standard_Boolean BeginAddMode();
void EndAddMode();
void ClearImmediatMode (const Graphic3d_CView& theCView,
const Standard_Boolean theUseDepthTest,
const Standard_Boolean theRetainMode);
void EndImmediatMode();
- void Transform (const TColStd_Array2OfReal& theMatrix, const Graphic3d_TypeOfComposition theType);
void DrawStructure (const OpenGl_Structure* theStructure);
- void BeginPolyline();
- void EndPolyline();
- void Draw (const Standard_ShortReal theX, const Standard_ShortReal theY, const Standard_ShortReal theZ);
- void Move (const Standard_ShortReal theX, const Standard_ShortReal theY, const Standard_ShortReal theZ);
- void SetLineColor (const Standard_ShortReal theR, const Standard_ShortReal theG, const Standard_ShortReal theB);
- void SetLineType (const Standard_Integer theType);
- void SetLineWidth (const Standard_ShortReal theWidth);
- void SetMinMax (const Standard_ShortReal X1, const Standard_ShortReal Y1, const Standard_ShortReal Z1,
- const Standard_ShortReal X2, const Standard_ShortReal Y2, const Standard_ShortReal Z2);
Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight);
void FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr);
- Standard_Boolean BufferDump (OpenGl_FrameBuffer *theFBOPtr, Image_CRawBufferData& theBuffer);
+ Standard_Boolean BufferDump (OpenGl_FrameBuffer* theFBOPtr,
+ Image_PixMap& theImage,
+ const Graphic3d_BufferType& theBufferType);
void UseTransparency (const Standard_Boolean theFlag);
Standard_Boolean& UseZBuffer() { return myUseZBuffer; }
//! Clear the applied aspect state.
void ResetAppliedAspect();
+ Standard_EXPORT Handle(OpenGl_Texture) DisableTexture();
+ Standard_EXPORT Handle(OpenGl_Texture) EnableTexture (const Handle(OpenGl_Texture)& theTexture,
+ const Handle(Graphic3d_TextureParams)& theParams = NULL);
+
//// RELATED TO FONTS ////
- int FindFont (const char* theFontName,
- const OSD_FontAspect theFontAspect,
- const int theBestSize = -1,
- const float theXScale = 1.0f,
- const float theYScale = 1.0f)
+ int FindFont (const char* theFontName,
+ const Font_FontAspect theFontAspect,
+ const int theBestSize = -1,
+ const float theXScale = 1.0f,
+ const float theYScale = 1.0f)
{
return myDisplay->FindFont (theFontName, theFontAspect, theBestSize, theXScale, theYScale);
}
protected:
- void CopyBuffers (Tint vid, int FrontToBack,
- Tfloat xm, Tfloat ym, Tfloat zm,
- Tfloat XM, Tfloat YM, Tfloat ZM,
- Tint flag);
+ void CopyBuffers (const Standard_Boolean theFrontToBack);
virtual Standard_Boolean Activate();
// TEMPORARY!!!
- void Redraw1 (const Graphic3d_CView& theCView,
- const Aspect_CLayer2d& theCUnderLayer,
+ void Redraw1 (const Graphic3d_CView& theCView,
+ const Aspect_CLayer2d& theCUnderLayer,
const Aspect_CLayer2d& theCOverLayer,
const int theToSwap);
-protected:
+ void UpdateMaterial (const int flag);
- Handle(OpenGl_View) myView; // WSViews - now just one view is supported
- Tint myTransientList; // WSTransient
- Standard_Boolean myIsTransientOpen; // transientOpen
- Tint myRetainMode; // WSRetainMode
+ void setTextureParams (Handle(OpenGl_Texture)& theTexture,
+ const Handle(Graphic3d_TextureParams)& theParams);
- Standard_Boolean myUseTransparency;
- Standard_Boolean myUseZBuffer;
- Standard_Boolean myUseDepthTest;
- Standard_Boolean myUseGLLight;
- Standard_Boolean myBackBufferRestored;
+protected: //! @name protected fields
- //// RELATED TO STATUS ////
+ Handle(OpenGl_View) myView; // WSViews - now just one view is supported
+ Standard_Boolean myIsTransientOpen; // transientOpen
+ Standard_Boolean myRetainMode;
+ Standard_Boolean myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
- void UpdateMaterial (const int flag);
+ NCollection_Sequence<const OpenGl_Structure*> myTransientList;
+
+ Standard_Boolean myUseTransparency;
+ Standard_Boolean myUseZBuffer;
+ Standard_Boolean myUseDepthTest;
+ Standard_Boolean myUseGLLight;
+ Standard_Boolean myBackBufferRestored;
+protected: //! @name fields related to status
+
+ Handle(OpenGl_Texture) myTextureBound; //!< currently bound texture (managed by OpenGl_AspectFace and OpenGl_View environment texture)
const OpenGl_AspectLine *AspectLine_set, *AspectLine_applied;
const OpenGl_AspectFace *AspectFace_set, *AspectFace_applied;
const OpenGl_AspectMarker *AspectMarker_set, *AspectMarker_applied;
const TEL_POFFSET_PARAM* PolygonOffset_applied;
-public:
+ OpenGl_AspectFace myAspectFaceHl; // Hiddenline aspect
+
+public: //! @name type definition
- DEFINE_STANDARD_RTTI(OpenGl_Workspace) // Type definition
+ DEFINE_STANDARD_RTTI(OpenGl_Workspace)
DEFINE_STANDARD_ALLOC
};
-#endif //_OpenGl_Workspace_Header
+#endif // _OpenGl_Workspace_Header