0030364: Visualization, TKOpenGl - allow initializing a Surface-less EGL context
[occt.git] / src / OpenGl / OpenGl_StencilTest.cxx
1 // Created on: 2013-09-26
2 // Created by: Dmitry BOBYLEV
3 // Copyright (c) 2013-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <OpenGl_GlCore11.hxx>
17 #include <OpenGl_StencilTest.hxx>
18
19 OpenGl_StencilTest::OpenGl_StencilTest()
20 {
21   //
22 }
23
24 // =======================================================================
25 // function : Render
26 // purpose  :
27 // =======================================================================
28 void OpenGl_StencilTest::Render (const Handle(OpenGl_Workspace)&) const
29 {
30   if (myIsEnabled)
31   {
32     glEnable (GL_STENCIL_TEST);
33     glStencilFunc (GL_NOTEQUAL, 1, 0xFF);
34   }
35   else
36   {
37     glDisable (GL_STENCIL_TEST);
38   }
39 }
40
41 // =======================================================================
42 // function : Release
43 // purpose  :
44 // =======================================================================
45 void OpenGl_StencilTest::Release (OpenGl_Context*)
46 {
47   //
48 }
49
50 // =======================================================================
51 // function : SetStencilTestState
52 // purpose  :
53 // =======================================================================
54 void OpenGl_StencilTest::SetOptions (const Standard_Boolean theIsEnabled)
55 {
56   myIsEnabled = theIsEnabled;
57 }
58
59 // =======================================================================
60 // function : ~OpenGl_StencilTest
61 // purpose  :
62 // =======================================================================
63 OpenGl_StencilTest::~OpenGl_StencilTest()
64 {
65   //
66 }