1 // Created on: 2011-10-20
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 #include <OpenGl_GraphicDriver.hxx>
21 #include <OpenGl_CView.hxx>
22 #include <OpenGl_Trihedron.hxx>
23 #include <OpenGl_GraduatedTrihedron.hxx>
24 #include <OpenGl_tgl_funcs.hxx>
26 void OpenGl_GraphicDriver::Environment(const Graphic3d_CView& theCView)
28 const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
34 aCView->View->SetTextureEnv (GetSharedContext(), theCView.Context.TextureEnv);
35 aCView->View->SetSurfaceDetail ((Visual3d_TypeOfSurfaceDetail)theCView.Context.SurfaceDetail);
39 // Triedron methods : the Triedron is a non-zoomable object.
42 void OpenGl_GraphicDriver::ZBufferTriedronSetup (
43 const Quantity_NameOfColor XColor,
44 const Quantity_NameOfColor YColor,
45 const Quantity_NameOfColor ZColor,
46 const Standard_Real SizeRatio,
47 const Standard_Real AxisDiametr,
48 const Standard_Integer NbFacettes)
50 OpenGl_Trihedron::Setup(XColor,YColor,ZColor,SizeRatio,AxisDiametr,NbFacettes);
53 void OpenGl_GraphicDriver::TriedronDisplay (
54 const Graphic3d_CView& ACView,
55 const Aspect_TypeOfTriedronPosition APosition,
56 const Quantity_NameOfColor AColor,
57 const Standard_Real AScale,
58 const Standard_Boolean AsWireframe )
60 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
63 aCView->View->TriedronDisplay(APosition, AColor, AScale, AsWireframe);
67 void OpenGl_GraphicDriver::TriedronErase (const Graphic3d_CView& ACView)
69 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
72 aCView->View->TriedronErase();
76 void OpenGl_GraphicDriver::TriedronEcho (const Graphic3d_CView& ACView,const Aspect_TypeOfTriedronEcho AType )
81 void OpenGl_GraphicDriver::BackgroundImage( const Standard_CString FileName,
82 const Graphic3d_CView& ACView,
83 const Aspect_FillMethod FillStyle )
85 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
88 aCView->View->CreateBackgroundTexture( FileName, FillStyle );
92 void OpenGl_GraphicDriver::SetBgImageStyle( const Graphic3d_CView& ACView,
93 const Aspect_FillMethod FillStyle )
95 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
98 aCView->View->SetBackgroundTextureStyle( FillStyle );
102 void OpenGl_GraphicDriver::SetBgGradientStyle(const Graphic3d_CView& ACView,const Aspect_GradientFillMethod FillType)
104 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
107 aCView->View->SetBackgroundGradientType(FillType);
111 void OpenGl_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView& ACView, const Graphic3d_CGraduatedTrihedron& cubic)
113 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
116 aCView->View->GraduatedTrihedronDisplay(cubic);
120 void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& ACView)
122 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
125 aCView->View->GraduatedTrihedronErase();
129 void OpenGl_GraphicDriver::GraduatedTrihedronMinMaxValues(const Standard_ShortReal xmin,
130 const Standard_ShortReal ymin,
131 const Standard_ShortReal zmin,
132 const Standard_ShortReal xmax,
133 const Standard_ShortReal ymax,
134 const Standard_ShortReal zmax)
136 OpenGl_GraduatedTrihedron::SetMinMax(xmin, ymin, zmin, xmax, ymax, zmax);