glBufferData Function
GL_APICALL void GL_APIENTRY glBufferData(
GLenum target,
GLsizeiptr size,
const void * data,
GLenum usage
);
| Name | Description | |
|---|---|---|
| in | target | Target |
| in | size | Vertex data size. |
| in | data |
Pointer to the vertex data. |
| in | usage | Vertex buffer usage. |
Loads vertex data into the current vertex buffer object.
Set target equal to GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER.
To specify the region that is accessed by the GPU, set target to a bitwise OR of the aforementioned and the following values.
NN_GX_MEM_FCRAM | The GPU accesses main memory. |
|---|---|
NN_GX_MEM_VRAMA | The GPU accesses VRAMA. |
NN_GX_MEM_VRAMB | The GPU accesses VRAMB. By also specifying the following bitwise OR, you can specify whether to copy data to main memory. |
GL_COPY_FCRAM_DMP | Create data copy in main memory. |
GL_NO_COPY_FCRAM_DMP | Do not create data copy in main memory. |
These combinations cause data to be transferred as follows.
(NN_GX_MEM_FCRAM | GL_NO_COPY_FCRAM_DMP) | The GPU directly accesses the region specified by data. |
|---|---|
(NN_GX_MEM_VRAMA | GL_NO_COPY_FCRAM_DMP) | A region is allocated in VRAMA; data is transferred to VRAMA via DMA; and then the GPU accesses VRAMA. |
(NN_GX_MEM_VRAMB | GL_NO_COPY_FCRAM_DMP) | A region is allocated in VRAMB; data is transferred to VRAMB via DMA; and then the GPU accesses VRAMB. |
(NN_GX_MEM_FCRAM | GL_COPY_FCRAM_DMP) | A region is allocated in main memory; data is copied to main memory by the CPU; and then the GPU accesses main memory. |
(NN_GX_MEM_VRAMA | GL_COPY_FCRAM_DMP) | A region is allocated in main memory and VRAMA; data is copied to main memory by the CPU; data is transferred via DMA from main memory to VRAMA, and then the GPU accesses VRAMA. |
(NN_GX_MEM_VRAMB | GL_COPY_FCRAM_DMP) | A region is allocated in main memory and VRAMB; data is copied to main memory by the CPU; data is transferred via DMA from main memory to VRAMB, and then the GPU accesses VRAMB. |
If not specifying any GPU access region or copying to main memory, then (NN_GX_MEM_FCRAM | GL_COPY_FCRAM_DMP) are applied. Set size equal to the vertex data size. You can only set usage to GL_STATIC_DRAW. When data is set to NULL, this function simply allocates a region as large as the data size.
The following errors occur in this function.
GL_INVALID_OPERATION | This function was called without any command-list objects bound. |
|---|---|
GL_INVALID_ENUM | target was set to an invalid value. |
GL_OUT_OF_MEMORY | Failed to allocate the management region or the region for the vertex buffer data. |
GL_INVALID_OPERATION | target was set to an invalid option for the GPU access region and main memory copying. |
GL_INVALID_OPERATION | Object 0 is bound to the current target. |
GL_INVALID_OPERATION | Either the values NN_GX_MEM_FCRAM | GL_NO_COPY_FCRAM_DMP or the values NN_GX_MEM_VRAMA (or VRAMB) | GL_COPY_FCRAM_DMP were specified, and data is 0. |
CONFIDENTIAL