1 // Copyright (c) 2019 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _OpenGl_AspectsProgram_Header
15 #define _OpenGl_AspectsProgram_Header
17 #include <Graphic3d_ShaderProgram.hxx>
19 class Graphic3d_Aspects;
21 class OpenGl_ShaderProgram;
23 //! OpenGl resources for custom shading program.
24 class OpenGl_AspectsProgram
29 //! Empty constructor.
30 OpenGl_AspectsProgram() : myIsShaderReady (false) {}
32 //! Return shading program.
33 const Handle(OpenGl_ShaderProgram)& ShaderProgram (const Handle(OpenGl_Context)& theCtx,
34 const Handle(Graphic3d_ShaderProgram)& theShader)
38 build (theCtx, theShader);
39 myIsShaderReady = true;
41 return myShaderProgram;
44 //! Update shader resource up-to-date state.
45 Standard_EXPORT void UpdateRediness (const Handle(Graphic3d_Aspects)& theAspect);
48 Standard_EXPORT void Release (OpenGl_Context* theCtx);
52 //! Build shader resource.
53 Standard_EXPORT void build (const Handle(OpenGl_Context)& theCtx,
54 const Handle(Graphic3d_ShaderProgram)& theShader);
58 Handle(OpenGl_ShaderProgram) myShaderProgram;
59 TCollection_AsciiString myShaderProgramId;
60 Standard_Boolean myIsShaderReady;
63 #endif // _OpenGl_Aspects_Header