Ejemplo n.º 1
0
void UnmappableBuffer::resizeBuffer(GLsizeiptr size) {
    GLuint newBuffer;

    size = nextPowerOfTwo(size);

    glCreateBuffers(1, &newBuffer);
    glNamedBufferData(newBuffer, size, nullptr, mUsage);
    glCopyNamedBufferSubData(mId, newBuffer, 0, 0, mSize);
    glDeleteBuffers(1, &mId);

    mId = newBuffer;
    mSize = size;
}
Ejemplo n.º 2
0
void ofBufferObject::copyTo(ofBufferObject & dstBuffer, int readOffset, int writeOffset, size_t size) const{
#ifdef GLEW_VERSION_4_5
	if (GLEW_EXT_direct_state_access) {
		glCopyNamedBufferSubData(data->id,dstBuffer.getId(),readOffset,writeOffset,size);
		return;
	}
#endif
	bind(GL_COPY_READ_BUFFER);
	dstBuffer.bind(GL_COPY_WRITE_BUFFER);
	glCopyBufferSubData(GL_COPY_READ_BUFFER,GL_COPY_WRITE_BUFFER,readOffset,writeOffset,size);
	unbind(GL_COPY_READ_BUFFER);
	dstBuffer.unbind(GL_COPY_WRITE_BUFFER);
}
Ejemplo n.º 3
0
Buffer::Buffer(const Buffer & other) noexcept
  : gl::Object{other}
{

	glCreateBuffers(1, &m_name);

	if (other.isValid()) {

		GLuint otherSize {other.getByteSize()};

		glNamedBufferData(m_name, otherSize, nullptr, GL_STATIC_DRAW);
		glCopyNamedBufferSubData(other, m_name, 0, 0, otherSize);

	}

}
void BufferImplementation_DirectStateAccessARB::copySubData(const Buffer * buffer, Buffer * other, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) const
{
    glCopyNamedBufferSubData(buffer->id(), other->id(), readOffset, writeOffset, static_cast<GLsizei>(size));
}