Ocean
IndexBuffer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_PLATFORM_GL_INDEX_BUFFER_H
9 #define META_OCEAN_PLATFORM_GL_INDEX_BUFFER_H
10 
11 #include "ocean/platform/gl/GL.h"
13 
14 namespace Ocean
15 {
16 
17 namespace Platform
18 {
19 
20 namespace GL
21 {
22 
23 /**
24  * This class implements an OpenGL index buffer object.
25  * This buffer represents a GL_ELEMENT_ARRAY_BUFFER.
26  * @ingroup platformgl
27  */
28 class OCEAN_PLATFORM_GL_EXPORT IndexBuffer : public Buffer
29 {
30  public:
31 
32  /**
33  * Creates a new index buffer object.
34  */
35  inline IndexBuffer();
36 
37  /**
38  * Creates a new index buffer object with associated context.
39  * @param context The associated context of the new index buffer object
40  */
41  explicit inline IndexBuffer(Context& context);
42 
43  /**
44  * Sets or changes the data of this index buffer object.
45  * @param data The data to set
46  * @param size The number of elements to set
47  * @return True, if succeeded
48  */
49  bool setBufferData(const unsigned int* data, const size_t size);
50 
51  /**
52  * Binds this index buffer object.
53  * @return True, if succeeded
54  */
55  bool bind() const;
56 
57  /**
58  * Assign operator which does not create a new copy of an assocated OpenGL object.
59  * @param buffer Index buffer object to assign
60  * @return Reference to this object
61  */
63 };
64 
66  Buffer()
67 {
68  // nothing to do here
69 }
70 
72  Buffer(context)
73 {
74  // nothing to do here
75 }
76 
77 }
78 
79 }
80 
81 }
82 
83 #endif // META_OCEAN_PLATFORM_GL_INDEX_BUFFER_H
This class implements the base class for all buffers.
Definition: Buffer.h:28
This class encapsulates an OpenGL context.
Definition: platform/gl/Context.h:29
This class implements an OpenGL index buffer object.
Definition: IndexBuffer.h:29
IndexBuffer & operator=(const IndexBuffer &buffer)
Assign operator which does not create a new copy of an assocated OpenGL object.
bool bind() const
Binds this index buffer object.
bool setBufferData(const unsigned int *data, const size_t size)
Sets or changes the data of this index buffer object.
IndexBuffer()
Creates a new index buffer object.
Definition: IndexBuffer.h:65
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15