|
||||
File indexing completed on 2025-01-18 10:04:35
0001 // Created on: 2011-03-18 0002 // Created by: Anton POLETAEV 0003 // Copyright (c) 2011-2014 OPEN CASCADE SAS 0004 // 0005 // This file is part of Open CASCADE Technology software library. 0006 // 0007 // This library is free software; you can redistribute it and/or modify it under 0008 // the terms of the GNU Lesser General Public License version 2.1 as published 0009 // by the Free Software Foundation, with special exception defined in the file 0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0011 // distribution for complete text of the license and disclaimer of any warranty. 0012 // 0013 // Alternatively, this file may be used under the terms of Open CASCADE 0014 // commercial license or contractual agreement. 0015 0016 #ifndef OpenGl_Resource_HeaderFile 0017 #define OpenGl_Resource_HeaderFile 0018 0019 #include <Standard_Type.hxx> 0020 0021 class OpenGl_Context; 0022 0023 //! Interface for OpenGl resource with following meaning: 0024 //! - object can be constructed at any time; 0025 //! - should be explicitly Initialized within active OpenGL context; 0026 //! - should be explicitly Released within active OpenGL context (virtual Release() method); 0027 //! - can be destroyed at any time. 0028 //! Destruction of object with unreleased GPU resources will cause leaks 0029 //! which will be ignored in release mode and will immediately stop program execution in debug mode using assert. 0030 class OpenGl_Resource : public Standard_Transient 0031 { 0032 0033 public: 0034 0035 //! Empty constructor 0036 Standard_EXPORT OpenGl_Resource(); 0037 0038 //! Destructor. Inheritors should call Clean (NULL) within it. 0039 Standard_EXPORT virtual ~OpenGl_Resource(); 0040 0041 //! Release GPU resources. 0042 //! Notice that implementation should be SAFE for several consecutive calls 0043 //! (thus should invalidate internal structures / ids to avoid multiple-free errors). 0044 //! @param theGlCtx - bound GL context, shouldn't be NULL. 0045 Standard_EXPORT virtual void Release (OpenGl_Context* theGlCtx) = 0; 0046 0047 //! Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules. 0048 virtual Standard_Size EstimatedDataSize() const = 0; 0049 0050 //! Dumps the content of me into the stream 0051 virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const 0052 { (void)theOStream; (void)theDepth; }; 0053 0054 private: 0055 0056 //! Copy should be performed only within Handles! 0057 OpenGl_Resource (const OpenGl_Resource& ); 0058 OpenGl_Resource& operator= (const OpenGl_Resource& ); 0059 0060 public: 0061 0062 DEFINE_STANDARD_RTTIEXT(OpenGl_Resource,Standard_Transient) // Type definition 0063 0064 }; 0065 0066 DEFINE_STANDARD_HANDLE(OpenGl_Resource, Standard_Transient) 0067 0068 #endif // _OpenGl_Resource_H__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |