Beispiel #1
0
//----------------------------------------------------------
void ofTexture::allocateAsBufferTexture(const ofBufferObject & buffer, int glInternalFormat){
	texData.glInternalFormat = glInternalFormat;
	texData.textureTarget = GL_TEXTURE_BUFFER;
	texData.bufferId = buffer.getId();
	allocate(texData,0,0);
	buffer.bind(GL_TEXTURE_BUFFER);
}
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);
}