0025442: Visualization, TKOpenGl - prevent inclusion of system header glxext.h
[occt.git] / src / OpenGl / OpenGl_GraphicDriver_7.cxx
CommitLineData
b311480e 1// Created on: 2011-10-20
2// Created by: Sergey ZERCHANINOV
973c2be1 3// Copyright (c) 2011-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
2166f0fa 16#include <OpenGl_GraphicDriver.hxx>
7fd59977 17
7fd59977 18#include <OpenGl_FrameBuffer.hxx>
19
2166f0fa
SK
20#include <OpenGl_Structure.hxx>
21#include <OpenGl_CView.hxx>
eb4320f2 22#include <OpenGl_Text.hxx>
7fd59977 23
2166f0fa 24/*----------------------------------------------------------------------*/
7fd59977 25
2166f0fa
SK
26void OpenGl_GraphicDriver::ActivateView (const Graphic3d_CView& ACView)
27{
28 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
29 if (aCView)
30 aCView->WS->SetActiveView(aCView->View);
7fd59977 31}
32
2166f0fa
SK
33void OpenGl_GraphicDriver::AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
34{
35 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
36 if (aCView)
37 aCView->View->SetAntiAliasing(AFlag);
7fd59977 38}
39
2166f0fa
SK
40void OpenGl_GraphicDriver::Background (const Graphic3d_CView& ACView)
41{
42 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
43 if (aCView)
44 {
45 aCView->WS->SetBackgroundColor(ACView.DefWindow.Background.r,ACView.DefWindow.Background.g,ACView.DefWindow.Background.b);
7fd59977 46 }
7fd59977 47}
48
2166f0fa 49void OpenGl_GraphicDriver::GradientBackground (const Graphic3d_CView& ACView,
7fd59977 50 const Quantity_Color& AColor1,
51 const Quantity_Color& AColor2,
2166f0fa
SK
52 const Aspect_GradientFillMethod AType)
53{
54 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
55 if (aCView)
56 {
57 aCView->View->SetBackgroundGradient(AColor1,AColor2,AType);
7fd59977 58 }
7fd59977 59}
60
2166f0fa
SK
61void OpenGl_GraphicDriver::ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait)
62{
63 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
64 if (aCView)
65 {
66 aCView->View->SetClipLimit(ACView);
529afc1a 67 if (!AWait)
2166f0fa
SK
68 {
69 aCView->WS->Resize(ACView.DefWindow);
2166f0fa 70 }
7fd59977 71 }
7fd59977 72}
73
2166f0fa
SK
74void OpenGl_GraphicDriver::DeactivateView (const Graphic3d_CView& ACView)
75{
76 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
77 if (aCView)
78 {
79 const Handle(OpenGl_View) aDummyView;
80 aCView->WS->SetActiveView(aDummyView);
7fd59977 81 }
7fd59977 82}
83
2166f0fa
SK
84void OpenGl_GraphicDriver::DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
85{
86 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
87 if (aCView)
88 aCView->View->SetFog(ACView, AFlag);
7fd59977 89}
90
529afc1a 91void OpenGl_GraphicDriver::RatioWindow (const Graphic3d_CView& theCView)
2166f0fa 92{
529afc1a
K
93 const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
94 if (aCView != NULL)
95 aCView->WS->Resize (theCView.DefWindow);
2166f0fa 96}
7fd59977 97
ca3c13d1 98void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView,
99 const Aspect_CLayer2d& ACUnderLayer,
100 const Aspect_CLayer2d& ACOverLayer,
101 const Standard_Integer /*x*/,
102 const Standard_Integer /*y*/,
103 const Standard_Integer /*width*/,
35e08fe8 104 const Standard_Integer /*height*/)
2166f0fa 105{
a89742cf 106 if (ACView.RenderParams.Method == Graphic3d_RM_RAYTRACING
107 && !myCaps->vboDisable
108 && !myCaps->keepArrayData)
e276548b 109 {
110 if (ACView.WasRedrawnGL)
111 {
112 myDeviceLostFlag = Standard_True;
113 }
114
115 myCaps->keepArrayData = Standard_True;
116 }
117
2166f0fa
SK
118 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
119 if (aCView)
120 {
121 /*if( width <= 0 || height <= 0 )
122 aCView->WS->Redraw(ACView, ACUnderLayer, ACOverLayer);
123 else
124 aCView->WS->RedrawArea(ACView, ACUnderLayer, ACOverLayer, x, y, width, height);*/
125 // Always do full redraw
126 aCView->WS->Redraw(ACView, ACUnderLayer, ACOverLayer);
7fd59977 127 }
7fd59977 128}
129
679ecdee 130void OpenGl_GraphicDriver::RedrawImmediate (const Graphic3d_CView& theCView,
131 const Aspect_CLayer2d& theCUnderLayer,
132 const Aspect_CLayer2d& theCOverLayer)
133{
134 const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
135 if (aCView != NULL)
136 {
137 aCView->WS->RedrawImmediate (theCView, theCUnderLayer, theCOverLayer);
138 }
139}
140
141void OpenGl_GraphicDriver::Invalidate (const Graphic3d_CView& theCView)
142{
143 const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
144 if (aCView != NULL)
145 {
146 aCView->WS->Invalidate (theCView);
147 }
148}
149
2166f0fa
SK
150Graphic3d_PtrFrameBuffer OpenGl_GraphicDriver::FBOCreate (const Graphic3d_CView& ACView, const Standard_Integer theWidth, const Standard_Integer theHeight)
151{
152 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
153 if (aCView)
154 return aCView->WS->FBOCreate(theWidth, theHeight);
155 return (Graphic3d_PtrFrameBuffer)NULL;
7fd59977 156}
157
fd4a6963 158Graphic3d_PtrFrameBuffer OpenGl_Workspace::FBOCreate (const Standard_Integer theWidth,
159 const Standard_Integer theHeight)
2166f0fa 160{
7fd59977 161 // activate OpenGL context
2166f0fa 162 if (!Activate())
7fd59977 163 return NULL;
2166f0fa 164
7fd59977 165 // create the FBO
fd4a6963 166 const Handle(OpenGl_Context)& aCtx = GetGlContext();
7fd59977 167 OpenGl_FrameBuffer* aFrameBuffer = new OpenGl_FrameBuffer();
fd4a6963 168 if (!aFrameBuffer->Init (aCtx, theWidth, theHeight))
7fd59977 169 {
fd4a6963 170 aFrameBuffer->Release (aCtx.operator->());
7fd59977 171 delete aFrameBuffer;
172 return NULL;
173 }
174 return (Graphic3d_PtrFrameBuffer )aFrameBuffer;
175}
176
2166f0fa 177void OpenGl_GraphicDriver::FBORelease (const Graphic3d_CView& ACView, Graphic3d_PtrFrameBuffer& theFBOPtr)
7fd59977 178{
179 if (theFBOPtr == NULL)
7fd59977 180 return;
2166f0fa
SK
181 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
182 if (aCView)
183 {
184 aCView->WS->FBORelease(theFBOPtr);
185 theFBOPtr = NULL;
7fd59977 186 }
2166f0fa
SK
187}
188
189void OpenGl_Workspace::FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr)
190{
7fd59977 191 // activate OpenGL context
fd4a6963 192 if (!Activate()
193 || theFBOPtr == NULL)
194 {
7fd59977 195 return;
fd4a6963 196 }
2166f0fa 197
7fd59977 198 // release the object
2166f0fa 199 OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer*)theFBOPtr;
fd4a6963 200 if (aFrameBuffer != NULL)
201 {
202 aFrameBuffer->Release (GetGlContext().operator->());
203 }
7fd59977 204 delete aFrameBuffer;
7fd59977 205}
206
207void OpenGl_GraphicDriver::FBOGetDimensions (const Graphic3d_CView& ,
208 const Graphic3d_PtrFrameBuffer theFBOPtr,
209 Standard_Integer& theWidth, Standard_Integer& theHeight,
210 Standard_Integer& theWidthMax, Standard_Integer& theHeightMax)
211{
212 if (theFBOPtr == NULL)
213 {
214 return;
215 }
216 const OpenGl_FrameBuffer* aFrameBuffer = (const OpenGl_FrameBuffer* )theFBOPtr;
217 theWidth = aFrameBuffer->GetVPSizeX(); // current viewport size
218 theHeight = aFrameBuffer->GetVPSizeY();
219 theWidthMax = aFrameBuffer->GetSizeX(); // texture size
220 theHeightMax = aFrameBuffer->GetSizeY();
221}
222
223void OpenGl_GraphicDriver::FBOChangeViewport (const Graphic3d_CView& ,
224 Graphic3d_PtrFrameBuffer& theFBOPtr,
225 const Standard_Integer theWidth, const Standard_Integer theHeight)
226{
227 if (theFBOPtr == NULL)
228 {
229 return;
230 }
231 OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )theFBOPtr;
232 aFrameBuffer->ChangeViewport (theWidth, theHeight);
233}
234
692613e5 235inline bool getDataFormat (const Image_PixMap& theData,
236 GLenum& thePixelFormat,
237 GLenum& theDataType)
7fd59977 238{
692613e5 239 thePixelFormat = GL_RGB;
240 theDataType = GL_UNSIGNED_BYTE;
241 switch (theData.Format())
7fd59977 242 {
ca3c13d1 243 #if !defined(GL_ES_VERSION_2_0)
692613e5 244 case Image_PixMap::ImgGray:
245 thePixelFormat = GL_DEPTH_COMPONENT;
246 theDataType = GL_UNSIGNED_BYTE;
247 return true;
ca3c13d1 248 case Image_PixMap::ImgGrayF:
249 thePixelFormat = GL_DEPTH_COMPONENT;
250 theDataType = GL_FLOAT;
692613e5 251 return true;
252 case Image_PixMap::ImgBGR:
253 thePixelFormat = GL_BGR;
254 theDataType = GL_UNSIGNED_BYTE;
255 return true;
692613e5 256 case Image_PixMap::ImgBGRA:
257 case Image_PixMap::ImgBGR32:
258 thePixelFormat = GL_BGRA;
259 theDataType = GL_UNSIGNED_BYTE;
260 return true;
ca3c13d1 261 case Image_PixMap::ImgBGRF:
262 thePixelFormat = GL_BGR;
692613e5 263 theDataType = GL_FLOAT;
264 return true;
ca3c13d1 265 case Image_PixMap::ImgBGRAF:
266 thePixelFormat = GL_BGRA;
692613e5 267 theDataType = GL_FLOAT;
268 return true;
ca3c13d1 269 #endif
270 case Image_PixMap::ImgRGB:
271 thePixelFormat = GL_RGB;
272 theDataType = GL_UNSIGNED_BYTE;
692613e5 273 return true;
ca3c13d1 274 case Image_PixMap::ImgRGBA:
275 case Image_PixMap::ImgRGB32:
692613e5 276 thePixelFormat = GL_RGBA;
ca3c13d1 277 theDataType = GL_UNSIGNED_BYTE;
278 return true;
279 case Image_PixMap::ImgRGBF:
280 thePixelFormat = GL_RGB;
692613e5 281 theDataType = GL_FLOAT;
282 return true;
ca3c13d1 283 case Image_PixMap::ImgRGBAF:
284 thePixelFormat = GL_RGBA;
692613e5 285 theDataType = GL_FLOAT;
286 return true;
287 default:
288 return false;
7fd59977 289 }
290}
291
692613e5 292Standard_Boolean OpenGl_GraphicDriver::BufferDump (const Graphic3d_CView& theCView,
293 Image_PixMap& theImage,
294 const Graphic3d_BufferType& theBufferType)
7fd59977 295{
692613e5 296 const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
297 return (aCView != NULL) && aCView->WS->BufferDump ((OpenGl_FrameBuffer* )theCView.ptrFBO, theImage, theBufferType);
2166f0fa
SK
298}
299
692613e5 300Standard_Boolean OpenGl_Workspace::BufferDump (OpenGl_FrameBuffer* theFBOPtr,
301 Image_PixMap& theImage,
302 const Graphic3d_BufferType& theBufferType)
7fd59977 303{
692613e5 304 GLenum aFormat, aType;
305 if (theImage.IsEmpty()
306 || !getDataFormat (theImage, aFormat, aType)
692613e5 307 || !Activate())
7fd59977 308 {
309 return Standard_False;
310 }
ca3c13d1 311#if !defined(GL_ES_VERSION_2_0)
312 GLint aReadBufferPrev = GL_BACK;
313 if (theBufferType == Graphic3d_BT_Depth
314 && aFormat != GL_DEPTH_COMPONENT)
315 {
316 return Standard_False;
317 }
318#endif
7fd59977 319
7fd59977 320 // bind FBO if used
692613e5 321 if (theFBOPtr != NULL && theFBOPtr->IsValid())
7fd59977 322 {
692613e5 323 theFBOPtr->BindBuffer (GetGlContext());
7fd59977 324 }
325 else
326 {
ca3c13d1 327 #if !defined(GL_ES_VERSION_2_0)
7fd59977 328 glGetIntegerv (GL_READ_BUFFER, &aReadBufferPrev);
329 GLint aDrawBufferPrev = GL_BACK;
330 glGetIntegerv (GL_DRAW_BUFFER, &aDrawBufferPrev);
331 glReadBuffer (aDrawBufferPrev);
ca3c13d1 332 #endif
7fd59977 333 }
334
74706083 335 // setup alignment
74706083 336 const GLint anAligment = Min (GLint(theImage.MaxRowAligmentBytes()), 8); // limit to 8 bytes for OpenGL
692613e5 337 glPixelStorei (GL_PACK_ALIGNMENT, anAligment);
338
ca3c13d1 339#if !defined(GL_ES_VERSION_2_0)
340 const GLint anExtraBytes = (GLint )theImage.RowExtraBytes();
74706083 341 const GLint aPixelsWidth = GLint(theImage.SizeRowBytes() / theImage.SizePixelBytes());
342 glPixelStorei (GL_PACK_ROW_LENGTH, (anExtraBytes >= anAligment) ? aPixelsWidth : 0);
ca3c13d1 343#endif
74706083 344
345 if (theImage.IsTopDown())
692613e5 346 {
347 // copy row by row
348 for (Standard_Size aRow = 0; aRow < theImage.SizeY(); ++aRow)
349 {
74706083 350 // Image_PixMap rows indexation always starts from the upper corner
351 // while order in memory depends on the flag and processed by ChangeRow() method
352 glReadPixels (0, GLint(theImage.SizeY() - aRow - 1), GLsizei (theImage.SizeX()), 1, aFormat, aType, theImage.ChangeRow (aRow));
692613e5 353 }
354 }
355 else
7fd59977 356 {
692613e5 357 glReadPixels (0, 0, GLsizei (theImage.SizeX()), GLsizei (theImage.SizeY()), aFormat, aType, theImage.ChangeData());
7fd59977 358 }
7fd59977 359
74706083 360 glPixelStorei (GL_PACK_ALIGNMENT, 1);
ca3c13d1 361#if !defined(GL_ES_VERSION_2_0)
74706083 362 glPixelStorei (GL_PACK_ROW_LENGTH, 0);
ca3c13d1 363#endif
7fd59977 364
692613e5 365 if (theFBOPtr != NULL && theFBOPtr->IsValid())
7fd59977 366 {
692613e5 367 theFBOPtr->UnbindBuffer (GetGlContext());
7fd59977 368 }
369 else
370 {
ca3c13d1 371 #if !defined(GL_ES_VERSION_2_0)
7fd59977 372 glReadBuffer (aReadBufferPrev);
ca3c13d1 373 #endif
7fd59977 374 }
375 return Standard_True;
376}
377
dd8a4ce9 378void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& theCView)
2166f0fa 379{
fd4a6963 380 Handle(OpenGl_Context) aCtx = GetSharedContext();
381 Handle(OpenGl_View) aView;
382 Handle(OpenGl_Workspace) aWindow;
383 if (myMapOfWS.Find (theCView.WsId, aWindow))
384 {
dd8a4ce9 385 myMapOfWS.UnBind (theCView.WsId);
fd4a6963 386 }
387 if (!aWindow.IsNull())
388 {
389 if (aWindow->GetGlContext()->MakeCurrent())
390 {
391 aCtx = aWindow->GetGlContext();
392 }
393 else
394 {
395 // try to hijack another context if any
396 const Handle(OpenGl_Context)& anOtherCtx = GetSharedContext();
397 if (!anOtherCtx.IsNull()
398 && anOtherCtx != aWindow->GetGlContext())
399 {
400 aCtx = anOtherCtx;
401 aCtx->MakeCurrent();
402 }
403 }
404 }
405 if (myMapOfView.Find (theCView.ViewId, aView))
406 {
407 aView->ReleaseGlResources (aCtx);
408 myMapOfView.UnBind (theCView.ViewId);
409 }
7fd59977 410
fd4a6963 411 if (myMapOfWS.IsEmpty())
dd8a4ce9 412 {
413 // The last view removed but some objects still present.
414 // Release GL resources now without object destruction.
415 for (NCollection_DataMap<Standard_Integer, OpenGl_Structure*>::Iterator aStructIt (myMapOfStructure);
416 aStructIt.More (); aStructIt.Next())
417 {
418 OpenGl_Structure* aStruct = aStructIt.ChangeValue();
fd4a6963 419 aStruct->ReleaseGlResources (aCtx);
dd8a4ce9 420 }
10b9c7df 421 myTempText->Release (aCtx.operator->());
fd4a6963 422 myDeviceLostFlag = !myMapOfStructure.IsEmpty();
dd8a4ce9 423 }
424
bf75be98 425 OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
2166f0fa 426 delete aCView;
dd8a4ce9 427 ((Graphic3d_CView *)&theCView)->ptrView = NULL;
fd4a6963 428
429 aCtx.Nullify();
430 aView.Nullify();
431 aWindow.Nullify();
7fd59977 432}
433
2166f0fa
SK
434void OpenGl_GraphicDriver::SetLight (const Graphic3d_CView& ACView)
435{
436 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
437 if (aCView)
438 aCView->View->SetLights(ACView.Context);
7fd59977 439}
440
4269bd1b 441void OpenGl_GraphicDriver::SetClipPlanes (const Graphic3d_CView& theCView)
2166f0fa 442{
4269bd1b 443 const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
2166f0fa 444 if (aCView)
4269bd1b 445 {
446 aCView->View->SetClipPlanes (theCView.Context.ClipPlanes);
447 }
448}
449
b5ac8292 450//=======================================================================
451//function : SetCamera
452//purpose :
453//=======================================================================
454void OpenGl_GraphicDriver::SetCamera (const Graphic3d_CView& theCView)
455{
456 const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
457 if (aCView)
458 {
459 aCView->View->SetCamera (theCView.Context.Camera);
460 }
461}
462
2166f0fa
SK
463void OpenGl_GraphicDriver::SetVisualisation (const Graphic3d_CView& ACView)
464{
465 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
466 if (aCView)
467 {
468 aCView->View->SetVisualisation(ACView.Context);
469 aCView->WS->UseZBuffer() = ( ACView.Context.Visualization == 0? (ACView.Context.ZBufferActivity == 1) : (ACView.Context.ZBufferActivity != 0) );
7fd59977 470 }
7fd59977 471}
472
2166f0fa
SK
473void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
474{
475 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
476 if (aCView)
477 aCView->WS->UseTransparency(AFlag);
478}
7fd59977 479
b7cd4ba7 480// =======================================================================
481// function : InvalidateBVHData
482// purpose :
483// =======================================================================
484void OpenGl_GraphicDriver::InvalidateBVHData (Graphic3d_CView& theCView, const Standard_Integer theLayerId)
485{
486 OpenGl_CView *aCView = (OpenGl_CView *)theCView.ptrView;
487 if(aCView)
488 {
489 aCView->View->InvalidateBVHData (theLayerId);
490 }
491}
492
5e27df78 493Standard_Boolean OpenGl_GraphicDriver::View (Graphic3d_CView& theCView)
2166f0fa 494{
05e2200b 495 Handle(OpenGl_Context) aShareCtx = GetSharedContext();
496 if (myMapOfView.IsBound (theCView.ViewId))
2166f0fa 497 {
05e2200b 498 OpenGl_CView* aCView = (OpenGl_CView* )theCView.ptrView;
499 if (!myMapOfWS.IsBound (theCView.WsId)
500 || aCView == NULL)
501 {
502 return Standard_False;
503 }
504
505 Handle(OpenGl_Workspace) aWS = new OpenGl_Workspace (this, theCView.DefWindow, theCView.GContext, myCaps, aShareCtx);
506 aCView->WS = aWS;
507 aWS->SetActiveView (aCView->View);
508
509 myMapOfWS.UnBind (theCView.WsId);
510 myMapOfWS.Bind (theCView.WsId, aWS);
511 return Standard_True;
7fd59977 512 }
513
25b97fac 514 Handle(OpenGl_Workspace) aWS = new OpenGl_Workspace (this, theCView.DefWindow, theCView.GContext, myCaps, aShareCtx);
392ac980 515 Handle(OpenGl_View) aView = new OpenGl_View (theCView.Context, &myStateCounter);
fd4a6963 516 myMapOfWS .Bind (theCView.WsId, aWS);
5e27df78 517 myMapOfView.Bind (theCView.ViewId, aView);
7fd59977 518
5e27df78 519 OpenGl_CView* aCView = new OpenGl_CView();
2166f0fa 520 aCView->View = aView;
fd4a6963 521 aCView->WS = aWS;
5e27df78 522 theCView.ptrView = aCView;
05e2200b 523 aWS->SetActiveView (aCView->View);
7fd59977 524
2166f0fa
SK
525 return Standard_True;
526}
7fd59977 527
2166f0fa
SK
528void OpenGl_GraphicDriver::SetBackFacingModel (const Graphic3d_CView& ACView)
529{
530 const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
531 if (aCView)
532 aCView->View->SetBackfacing(ACView.Backfacing);
533}
59f45b7c 534
535//=======================================================================
536//function : AddZLayer
bf75be98 537//purpose :
59f45b7c 538//=======================================================================
539
540void OpenGl_GraphicDriver::AddZLayer (const Graphic3d_CView& theCView,
541 const Standard_Integer theLayerId)
542{
543 const OpenGl_CView *aCView = (const OpenGl_CView *)theCView.ptrView;
544 if (aCView)
545 aCView->View->AddZLayer (theLayerId);
546}
547
548//=======================================================================
549//function : RemoveZLayer
550//purpose :
551//=======================================================================
59f45b7c 552void OpenGl_GraphicDriver::RemoveZLayer (const Graphic3d_CView& theCView,
553 const Standard_Integer theLayerId)
554{
555 const OpenGl_CView* aCView = (const OpenGl_CView *)theCView.ptrView;
556 if (aCView)
557 aCView->View->RemoveZLayer (theLayerId);
558}
c5751993 559
560//=======================================================================
561//function : SetZLayerSettings
562//purpose :
563//=======================================================================
564Standard_EXPORT void OpenGl_GraphicDriver::SetZLayerSettings (const Graphic3d_CView& theCView,
565 const Standard_Integer theLayerId,
566 const Graphic3d_ZLayerSettings& theSettings)
567{
568 const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
569 if (aCView)
570 aCView->View->SetZLayerSettings (theLayerId, theSettings);
571}