From 891fe7ddeed74765eeae1ffa8c2ca4f43148f032 Mon Sep 17 00:00:00 2001 From: milek7 Date: Sun, 31 Mar 2019 14:02:43 +0200 Subject: [PATCH] pbo changes, trainingcard remarks --- gl/buffer.h | 2 +- gl/fence.h | 2 ++ gl/pbo.cpp | 13 +++++++++++++ gl/pbo.h | 7 ++++++- widgets/trainingcard.cpp | 4 ---- widgets/trainingcard.h | 2 +- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/gl/buffer.h b/gl/buffer.h index b07b6e7b..c8ff232e 100644 --- a/gl/buffer.h +++ b/gl/buffer.h @@ -27,7 +27,7 @@ namespace gl UNIFORM_BUFFER }; - private: + protected: static GLenum glenum_target(targets target); public: diff --git a/gl/fence.h b/gl/fence.h index 0d53e1a4..50564163 100644 --- a/gl/fence.h +++ b/gl/fence.h @@ -1,3 +1,5 @@ +#pragma once + #include "object.h" namespace gl diff --git a/gl/pbo.cpp b/gl/pbo.cpp index 18c2f8b3..56c77766 100644 --- a/gl/pbo.cpp +++ b/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(); +} diff --git a/gl/pbo.h b/gl/pbo.h index be7bf9bf..ba804404 100644 --- a/gl/pbo.h +++ b/gl/pbo.h @@ -1,9 +1,11 @@ +#pragma once + #include "buffer.h" #include "fence.h" #include namespace gl { - class pbo : private buffer + class pbo : public buffer { std::optional 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); }; } diff --git a/widgets/trainingcard.cpp b/widgets/trainingcard.cpp index f2ec5ce2..769f29c6 100644 --- a/widgets/trainingcard.cpp +++ b/widgets/trainingcard.cpp @@ -59,8 +59,6 @@ void trainingcard_panel::render_contents() ImGui::TextUnformatted(u8"Proszę czekać, trwa archiwizacja nagrania..."); ImGui::EndPopup(); - - return; } if (start_time_wall) { @@ -82,10 +80,8 @@ void trainingcard_panel::render_contents() ImGui::SameLine(); ImGui::InputText("##instructor", &instructor_name[0], instructor_name.size()); - /* ImGui::TextUnformatted("Uwagi"); ImGui::InputTextMultiline("##remarks", &remarks[0], remarks.size(), ImVec2(-1.0f, 200.0f)); - */ if (!start_time_wall) { if (ImGui::Button("Rozpocznij szkolenie")) { diff --git a/widgets/trainingcard.h b/widgets/trainingcard.h index 5b7890e1..dc38ca5d 100644 --- a/widgets/trainingcard.h +++ b/widgets/trainingcard.h @@ -19,7 +19,7 @@ class trainingcard_panel : public ui_panel return 1; } virtual int EndRecording( std::string training_identifier ) { - std::this_thread::sleep_for(std::chrono::duration(5.0f)); + std::this_thread::sleep_for(std::chrono::duration(1.0f)); return 1; }