Implement spritebatch properly.
This commit is contained in:
@@ -21,9 +21,10 @@ errorret_t meshInitGL(
|
||||
|
||||
mesh->primitiveType = primitiveType;
|
||||
mesh->vertexCount = vertexCount;
|
||||
mesh->vertices = vertices;
|
||||
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
mesh->vertices = vertices;
|
||||
// Nothing needed.
|
||||
#else
|
||||
// Generate Vertex Buffer Object
|
||||
glGenBuffers(1, &mesh->vboId);
|
||||
@@ -34,7 +35,7 @@ errorret_t meshInitGL(
|
||||
GL_ARRAY_BUFFER,
|
||||
vertexCount * sizeof(meshvertex_t),
|
||||
vertices,
|
||||
GL_STATIC_DRAW
|
||||
GL_DYNAMIC_DRAW
|
||||
);
|
||||
errorChain(errorGLCheck());
|
||||
|
||||
@@ -93,6 +94,27 @@ errorret_t meshInitGL(
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t meshFlushGL(
|
||||
meshgl_t *mesh,
|
||||
const int32_t vertOffset,
|
||||
const int32_t vertCount
|
||||
) {
|
||||
#ifdef DUSK_OPENGL_LEGACY
|
||||
// Nothing doing, we use the glClientState stuff.
|
||||
#else
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mesh->vboId);
|
||||
errorChain(errorGLCheck());
|
||||
glBufferData(
|
||||
GL_ARRAY_BUFFER,
|
||||
vertCount * sizeof(meshvertex_t),
|
||||
&mesh->vertices[vertOffset],
|
||||
GL_DYNAMIC_DRAW
|
||||
);
|
||||
errorChain(errorGLCheck());
|
||||
#endif
|
||||
errorOk();
|
||||
}
|
||||
|
||||
errorret_t meshDrawGL(
|
||||
const meshgl_t *mesh,
|
||||
const int32_t offset,
|
||||
|
||||
Reference in New Issue
Block a user