16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 11:19:19 +02:00

use pbo for picking buffers, restore picking for scenery nodes

This commit is contained in:
milek7
2018-10-23 17:04:04 +02:00
parent cdd79e605c
commit 0c460e9e0d
10 changed files with 165 additions and 53 deletions

View File

@@ -64,4 +64,19 @@ void gl::buffer::upload(targets target, const void *data, int offset, int size)
glBufferSubData(glenum_target(target), offset, size, data);
}
void gl::buffer::download(targets target, void *data, int offset, int size)
{
bind(target);
if (GLAD_GL_VERSION_3_3)
{
glGetBufferSubData(glenum_target(target), offset, size, data);
}
else
{
void *glbuf = glMapBufferRange(glenum_target(target), offset, size, GL_MAP_READ_BIT);
memcpy(data, glbuf, size);
glUnmapBuffer(glenum_target(target));
}
}
GLuint gl::buffer::binding_points[13];