Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoGLBufferObject.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#if !defined SOGLBUFFEROBJECT_H
24#define SOGLBUFFEROBJECT_H
25
26#include <Inventor/devices/SoInteropBufferObject.h>
27#include <Inventor/sys/SoGLType.h>
28
29SO_PIMPL_PUBLIC_DECLARATION(SoGLBufferObject)
30class SbVec2i32;
31
228{
229 SO_TYPED_CLASS_HEADER();
230 SO_PIMPL_PUBLIC_HEADER(SoGLBufferObject)
231
232public:
233
269
344
351
357 static bool isAvailable();
358
368
375
387 virtual bool setSize( size_t size );
388
399 virtual void map( SoBufferObject* targetBufferObject, AccessMode accessMode, size_t startPosition = 0, size_t mappingSize = SO_BUFFER_SIZE_ALL );
400
404 virtual void unmap( SoBufferObject* bufferObject );
405
415 void bind();
416
426 void unbind();
427
441 virtual void* map( AccessMode accessMode, size_t offset = 0, size_t count = SO_BUFFER_SIZE_ALL );
442
446 virtual void unmap();
447
458 bool isValid();
459
463 GLuint getId() const;
464
471
479 virtual void clearInstance();
480
498 void memcpy(SoBufferObject* source, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL);
499
500private:
501
502 void copyToCpuBuffer( SoCpuBufferObject* targetBufferObject, size_t destOffset = 0, size_t sourceOffset = 0, size_t copySize = SO_BUFFER_SIZE_ALL );
503
505 bool isBindable();
506
508 void copyFromGLTexture(GLuint tex, const SbVec2i32& size, bool alpha);
509
510 struct Configuration
511 {
512 size_t size;
513 BufferObjectTarget target;
514 Usage usage;
515 };
516
517private:
521 virtual ~SoGLBufferObject();
522
525
526 bool checkContext();
527
528};
529
530#endif // SOGLBUFFEROBJECT_H
2D vector class.
Definition SbVec.h:517
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
AccessMode
This enum provides the possible access modes for a mapped buffer object.
#define SO_BUFFER_SIZE_ALL
Used to indicate that we want to use the whole buffer.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> CPU buffer objec...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> OpenGL buffer ob...
virtual void unmap(SoBufferObject *bufferObject)
Unmap the specified buffer object.
void bind()
Bind the current buffer to the specified target so it's usable by OpenGL operations.
Usage
This enum declares the possible usages of the memory allocated for the buffer.
@ STATIC_DRAW
The data store contents will be modified once and used many times.
@ DYNAMIC_READ
The data store contents will be modified repeatedly and used many times.
@ DYNAMIC_DRAW
The data store contents will be modified repeatedly and used many times.
@ STATIC_COPY
The data store contents will be modified once and used many times.
@ STATIC_READ
The data store contents will be modified once and used many times.
@ STREAM_COPY
The data store contents will be modified once and used at most a few times.
@ DYNAMIC_COPY
The data store contents will be modified repeatedly and used many times.
@ STREAM_DRAW
The data store contents will be modified once and used at most a few times.
@ STREAM_READ
The data store contents will be modified once and used at most a few times.
virtual void * map(AccessMode accessMode, size_t offset=0, size_t count=SO_BUFFER_SIZE_ALL)
This function extends the map(AccessMode) method by allowing the mapping of a sub part of the buffer ...
static bool isAvailable()
Query if SoGLBufferObjects are available on this system.
virtual void unmap()
Unmaps the buffer using the regular unmap function.
virtual bool setSize(size_t size)
Set the size of the buffer in bytes.
virtual void clearInstance()
Free the memory allocated in the buffer object.
BufferObjectTarget
This enum declares the possible targets of the buffer.
@ PIXEL_PACK_BUFFER
The buffer is used as a pixel pack buffer, it can be used as texture.
@ PIXEL_UNPACK_BUFFER
The buffer is used as a pixel unpack buffer, it can be used for readback operation.
@ SHADER_STORAGE_BUFFER
The buffer is used as a shader storage buffer, it can be used to perform random access reads,...
@ ARRAY_BUFFER
The buffer is used as an array buffer, it can be used for vertices, normals, colors.
@ ELEMENT_ARRAY_BUFFER
The buffer is used as a pixel pack buffer, it is used to specify the indices for indexed geometries.
virtual void map(SoBufferObject *targetBufferObject, AccessMode accessMode, size_t startPosition=0, size_t mappingSize=SO_BUFFER_SIZE_ALL)
Map the current buffer object into the specified buffer object.
virtual SoBufferObject * createInstance() const
Create a new buffer with the same properties as the current one.
bool isValid()
Query if the buffer is valid in the current context.
GLuint getId() const
Returns the OpenGL id of the buffer.
void unbind()
Unbind the buffer.
void setTarget(BufferObjectTarget target)
Specify the buffer target, which defines possible usage of the buffer.
void memcpy(SoBufferObject *source, size_t destOffset=0, size_t sourceOffset=0, size_t copySize=SO_BUFFER_SIZE_ALL)
Copy data from a buffer into this GL buffer.
SoGLBufferObject(Usage usage)
Constructor.
BufferObjectTarget getTarget() const
Returns the current buffer target.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
unsigned int GLuint
Definition SoGLType.h:31