mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
pbo changes, trainingcard remarks
This commit is contained in:
@@ -27,7 +27,7 @@ namespace gl
|
||||
UNIFORM_BUFFER
|
||||
};
|
||||
|
||||
private:
|
||||
protected:
|
||||
static GLenum glenum_target(targets target);
|
||||
|
||||
public:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "object.h"
|
||||
|
||||
namespace gl
|
||||
|
||||
13
gl/pbo.cpp
13
gl/pbo.cpp
@@ -49,3 +49,16 @@ bool gl::pbo::is_busy()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void* gl::pbo::map(GLuint mode, targets target)
|
||||
{
|
||||
bind(target);
|
||||
return glMapBuffer(buffer::glenum_target(target), mode);
|
||||
}
|
||||
|
||||
void gl::pbo::unmap(targets target)
|
||||
{
|
||||
bind(target);
|
||||
glUnmapBuffer(buffer::glenum_target(target));
|
||||
sync.emplace();
|
||||
}
|
||||
|
||||
7
gl/pbo.h
7
gl/pbo.h
@@ -1,9 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "buffer.h"
|
||||
#include "fence.h"
|
||||
#include <optional>
|
||||
|
||||
namespace gl {
|
||||
class pbo : private buffer
|
||||
class pbo : public buffer
|
||||
{
|
||||
std::optional<fence> sync;
|
||||
int size = 0;
|
||||
@@ -13,5 +15,8 @@ namespace gl {
|
||||
void request_read(int x, int y, int lx, int ly, int pixsize = 4, GLenum format = GL_RGBA, GLenum type = GL_UNSIGNED_BYTE);
|
||||
bool read_data(int lx, int ly, void *data, int pixsize = 4);
|
||||
bool is_busy();
|
||||
|
||||
void* map(GLuint mode, targets target = PIXEL_UNPACK_BUFFER);
|
||||
void unmap(targets target = PIXEL_UNPACK_BUFFER);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user