File indexing completed on 2025-01-18 10:04:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef OpenGl_VertexBuffer_HeaderFile
0016 #define OpenGl_VertexBuffer_HeaderFile
0017
0018 #include <OpenGl_Buffer.hxx>
0019 #include <Graphic3d_Buffer.hxx>
0020
0021
0022
0023 class OpenGl_VertexBuffer : public OpenGl_Buffer
0024 {
0025 public:
0026
0027
0028 Standard_EXPORT OpenGl_VertexBuffer();
0029
0030
0031 Standard_EXPORT virtual ~OpenGl_VertexBuffer();
0032
0033
0034 Standard_EXPORT virtual unsigned int GetTarget() const Standard_OVERRIDE;
0035
0036
0037 Standard_EXPORT void BindVertexAttrib (const Handle(OpenGl_Context)& theGlCtx,
0038 const unsigned int theAttribLoc) const;
0039
0040
0041 Standard_EXPORT void UnbindVertexAttrib (const Handle(OpenGl_Context)& theGlCtx,
0042 const unsigned int theAttribLoc) const;
0043
0044
0045
0046
0047 void BindAttribute (const Handle(OpenGl_Context)& theCtx,
0048 const Graphic3d_TypeOfAttribute theMode) const
0049 {
0050 if (IsValid())
0051 {
0052 Bind (theCtx);
0053 bindAttribute (theCtx, theMode, static_cast<int> (myComponentsNb), myDataType, 0, myOffset);
0054 }
0055 }
0056
0057
0058
0059
0060 void UnbindAttribute (const Handle(OpenGl_Context)& theCtx,
0061 const Graphic3d_TypeOfAttribute theMode) const
0062 {
0063 if (IsValid())
0064 {
0065 Unbind (theCtx);
0066 unbindAttribute (theCtx, theMode);
0067 }
0068 }
0069
0070 public:
0071
0072
0073
0074 Standard_EXPORT static void bindAttribute (const Handle(OpenGl_Context)& theGlCtx,
0075 const Graphic3d_TypeOfAttribute theMode,
0076 const Standard_Integer theNbComp,
0077 const unsigned int theDataType,
0078 const Standard_Integer theStride,
0079 const void* theOffset);
0080
0081
0082
0083 Standard_EXPORT static void unbindAttribute (const Handle(OpenGl_Context)& theGlCtx,
0084 const Graphic3d_TypeOfAttribute theMode);
0085
0086 private:
0087
0088
0089 Standard_EXPORT static void bindFixed (const Handle(OpenGl_Context)& theGlCtx,
0090 const Graphic3d_TypeOfAttribute theMode,
0091 const Standard_Integer theNbComp,
0092 const unsigned int theDataType,
0093 const Standard_Integer theStride,
0094 const void* theOffset);
0095
0096
0097 Standard_EXPORT static void unbindFixed (const Handle(OpenGl_Context)& theGlCtx,
0098 const Graphic3d_TypeOfAttribute theMode);
0099
0100
0101 Standard_EXPORT static void unbindFixedColor (const Handle(OpenGl_Context)& theCtx);
0102
0103 public:
0104
0105
0106 Standard_EXPORT virtual bool HasColorAttribute() const;
0107
0108
0109 Standard_EXPORT virtual bool HasNormalAttribute() const;
0110
0111
0112
0113 Standard_EXPORT virtual void BindAllAttributes (const Handle(OpenGl_Context)& theGlCtx) const;
0114
0115
0116 Standard_EXPORT virtual void BindPositionAttribute (const Handle(OpenGl_Context)& theGlCtx) const;
0117
0118
0119 Standard_EXPORT virtual void UnbindAllAttributes (const Handle(OpenGl_Context)& theGlCtx) const;
0120
0121 public:
0122
0123 DEFINE_STANDARD_RTTIEXT(OpenGl_VertexBuffer, OpenGl_Buffer)
0124
0125 };
0126
0127 DEFINE_STANDARD_HANDLE(OpenGl_VertexBuffer, OpenGl_Buffer)
0128
0129 #endif