0023544: Texture management in TKOpenGl should be redesigned
[occt.git] / src / OpenGl / OpenGl_GraphicDriver_9.cxx
CommitLineData
b311480e 1// Created on: 2011-10-20
2// Created by: Sergey ZERCHANINOV
3// Copyright (c) 2011-2012 OPEN CASCADE SAS
4//
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.
9//
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.
12//
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.
19
2166f0fa
SK
20#include <OpenGl_GraphicDriver.hxx>
21#include <OpenGl_CView.hxx>
22#include <OpenGl_Trihedron.hxx>
23#include <OpenGl_GraduatedTrihedron.hxx>
2166f0fa 24#include <OpenGl_tgl_funcs.hxx>
7fd59977 25
bf75be98 26void OpenGl_GraphicDriver::Environment(const Graphic3d_CView& theCView)
2166f0fa 27{
bf75be98 28 const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
29 if (aCView == NULL)
2166f0fa 30 {
bf75be98 31 return;
2166f0fa 32 }
bf75be98 33
34 aCView->View->SetTextureEnv (GetSharedContext(), theCView.Context.TextureEnv);
35 aCView->View->SetSurfaceDetail ((Visual3d_TypeOfSurfaceDetail)theCView.Context.SurfaceDetail);
2166f0fa 36}
7fd59977 37
2166f0fa
SK
38//
39// Triedron methods : the Triedron is a non-zoomable object.
40//
7fd59977 41
2166f0fa
SK
42void 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)
49{
50 OpenGl_Trihedron::Setup(XColor,YColor,ZColor,SizeRatio,AxisDiametr,NbFacettes);
51}
7fd59977 52
2166f0fa
SK
53void OpenGl_GraphicDriver::TriedronDisplay (
54 const Graphic3d_CView& ACView,
55 const Aspect_TypeOfTriedronPosition APosition,
3c3131a0 56 const Quantity_NameOfColor AColor,
2166f0fa
SK
57 const Standard_Real AScale,
58 const Standard_Boolean AsWireframe )
59{
60 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
61 if (aCView)
62 {
63 aCView->View->TriedronDisplay(APosition, AColor, AScale, AsWireframe);
2166f0fa
SK
64 }
65}
7fd59977 66
3c3131a0 67void OpenGl_GraphicDriver::TriedronErase (const Graphic3d_CView& ACView)
2166f0fa
SK
68{
69 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
70 if (aCView)
71 {
72 aCView->View->TriedronErase();
2166f0fa
SK
73 }
74}
7fd59977 75
2166f0fa
SK
76void OpenGl_GraphicDriver::TriedronEcho (const Graphic3d_CView& ACView,const Aspect_TypeOfTriedronEcho AType )
77{
78 // Do nothing
79}
7fd59977 80
3c3131a0 81void OpenGl_GraphicDriver::BackgroundImage( const Standard_CString FileName,
2166f0fa
SK
82 const Graphic3d_CView& ACView,
83 const Aspect_FillMethod FillStyle )
84{
85 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
86 if (aCView)
87 {
88 aCView->View->CreateBackgroundTexture( FileName, FillStyle );
2166f0fa
SK
89 }
90}
7fd59977 91
2166f0fa
SK
92void OpenGl_GraphicDriver::SetBgImageStyle( const Graphic3d_CView& ACView,
93 const Aspect_FillMethod FillStyle )
94{
95 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
96 if (aCView)
97 {
98 aCView->View->SetBackgroundTextureStyle( FillStyle );
2166f0fa
SK
99 }
100}
7fd59977 101
2166f0fa
SK
102void OpenGl_GraphicDriver::SetBgGradientStyle(const Graphic3d_CView& ACView,const Aspect_GradientFillMethod FillType)
103{
104 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
105 if (aCView)
106 {
107 aCView->View->SetBackgroundGradientType(FillType);
2166f0fa
SK
108 }
109}
7fd59977 110
2166f0fa
SK
111void OpenGl_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView& ACView, const Graphic3d_CGraduatedTrihedron& cubic)
112{
113 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
114 if (aCView)
115 {
116 aCView->View->GraduatedTrihedronDisplay(cubic);
2166f0fa
SK
117 }
118}
7fd59977 119
2166f0fa
SK
120void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& ACView)
121{
122 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
123 if (aCView)
124 {
125 aCView->View->GraduatedTrihedronErase();
2166f0fa
SK
126 }
127}
7fd59977 128
2166f0fa
SK
129void 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)
135{
136 OpenGl_GraduatedTrihedron::SetMinMax(xmin, ymin, zmin, xmax, ymax, zmax);
137}