OpenSubdiv: CpuGLVertexBuffer Class Reference

| OpenSubdiv

Loading...
Searching...
No Matches
CpuGLVertexBuffer Class Reference

Concrete vertex buffer class for cpu subdivision and OpenGL drawing. More...

`#include <cpuGLVertexBuffer.h>`

## Public Types
using | ID = unsigned int

## Public Member Functions
| ~CpuGLVertexBuffer ()
| Destructor.
void | UpdateData (const float *src, int startVertex, int numVertices, void *deviceContext=NULL)
int | GetNumElements () const
| Returns how many elements defined in this vertex buffer.
int | GetNumVertices () const
| Returns how many vertices allocated in this vertex buffer.
float * | BindCpuBuffer ()
ID | BindVBO (void *deviceContext=NULL)

## Static Public Member Functions
static CpuGLVertexBuffer * | Create (int numElements, int numVertices, void *deviceContext=NULL)
| Creator. Returns NULL if error.

## Protected Member Functions
| CpuGLVertexBuffer (int numElements, int numVertices)
| Constructor.
bool | allocate ()
| Allocates VBO for this buffer. Returns true if success.

## Detailed Description

Concrete vertex buffer class for cpu subdivision and OpenGL drawing.

CpuGLVertexBuffer implements CpuVertexBufferInterface and GLVertexBufferInterface.

The buffer interop between Cpu and GL is handled automatically when a client calls BindCpuBuffer and BindVBO methods.

Definition at line 29 of file cpuGLVertexBuffer.h.

## Member Typedef Documentation

## ◆ ID

using ID = unsigned int

Definition at line 31 of file cpuGLVertexBuffer.h.

## Constructor & Destructor Documentation

## ◆ ~CpuGLVertexBuffer()

~CpuGLVertexBuffer | ( |  | ) |

Destructor.

## ◆ CpuGLVertexBuffer()

CpuGLVertexBuffer | ( | int | numElements,
|  | int | numVertices )
| protected

Constructor.

## Member Function Documentation

## ◆ allocate()

bool allocate | ( |  | ) |
| protected

Allocates VBO for this buffer. Returns true if success.

## ◆ BindCpuBuffer()

float * BindCpuBuffer | ( |  | ) |

Returns cpu memory. GL buffer will be mapped to cpu address if necessary.

## ◆ BindVBO()

ID BindVBO | ( | void * | deviceContext = NULL | ) |

Returns the name of GL buffer object. If the buffer is mapped to cpu address, it will be unmapped back to GL.

## ◆ Create()

CpuGLVertexBuffer * Create | ( | int | numElements,
|  | int | numVertices,
|  | void * | deviceContext = NULL )
| static

Creator. Returns NULL if error.

## ◆ GetNumElements()

int GetNumElements | ( |  | ) | const

Returns how many elements defined in this vertex buffer.

## ◆ GetNumVertices()

int GetNumVertices | ( |  | ) | const

Returns how many vertices allocated in this vertex buffer.

## ◆ UpdateData()

void UpdateData | ( | const float * | src,
|  | int | startVertex,
|  | int | numVertices,
|  | void * | deviceContext = NULL )

This method is meant to be used in client code in order to provide coarse vertices data to Osd.

The documentation for this class was generated from the following file:

- opensubdiv/osd/cpuGLVertexBuffer.h