0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / OpenGl / OpenGl_Sampler.hxx
CommitLineData
25ef750e 1// Created on: 2014-10-08
2// Created by: Denis BOGOLEPOV
3// Copyright (c) 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#ifndef OPENGL_SAMPLER_H
17#define OPENGL_SAMPLER_H
18
19#include <OpenGl_Context.hxx>
25ef750e 20
c04c30b3 21class OpenGl_Sampler;
22DEFINE_STANDARD_HANDLE(OpenGl_Sampler, OpenGl_Resource)
23
25ef750e 24//! Class implements OpenGL sampler object resource that
25//! stores the sampling parameters for a texture access.
26class OpenGl_Sampler : public OpenGl_Resource
27{
28public:
29
30 //! Helpful constant defining invalid sampler identifier
31 static const GLuint NO_SAMPLER = 0;
32
33public:
34
35 //! Creates new sampler object.
36 Standard_EXPORT OpenGl_Sampler();
37
38 //! Releases resources of sampler object.
39 Standard_EXPORT virtual ~OpenGl_Sampler();
40
41 //! Destroys object - will release GPU memory if any.
79104795 42 Standard_EXPORT virtual void Release (OpenGl_Context* theContext) Standard_OVERRIDE;
25ef750e 43
44 //! Initializes sampler object.
45 Standard_EXPORT Standard_Boolean Init (OpenGl_Context& theContext);
46
47 //! Returns true if current object was initialized.
48 Standard_Boolean IsValid() const
49 {
50 return isValidSampler();
51 }
52
53 //! Binds sampler object to the given texture unit.
54 Standard_EXPORT void Bind (OpenGl_Context& theContext, const GLuint theUnit = 0);
55
56 //! Unbinds sampler object from the given texture unit.
57 Standard_EXPORT void Unbind (OpenGl_Context& theContext, const GLuint theUnit = 0);
58
59 //! Sets specific sampler parameter.
60 Standard_EXPORT void SetParameter (OpenGl_Context& theContext, const GLenum theParam, const GLint theValue);
61
62 //! Returns OpenGL sampler ID.
63 GLuint SamplerID() const
64 {
65 return mySamplerID;
66 }
67
68protected:
69
70 //! Checks if sampler object is valid.
71 Standard_Boolean isValidSampler() const
72 {
73 return mySamplerID != NO_SAMPLER;
74 }
75
76protected:
77
78 GLuint mySamplerID; //!< OpenGL sampler object ID
79
80public:
81
92efcf78 82 DEFINE_STANDARD_RTTIEXT(OpenGl_Sampler,OpenGl_Resource)
25ef750e 83
84};
85
86#endif // OPENGL_SAMPLER_H