SGCT
master (487fac4)
Simple Graphics Cluster Toolkit
Toggle main menu visibility
Loading...
Searching...
No Matches
screencapture.h
Go to the documentation of this file.
1
/*****************************************************************************************
2
* SGCT *
3
* Simple Graphics Cluster Toolkit *
4
* *
5
* Copyright (c) 2012-2026 *
6
* For conditions of distribution and use, see copyright notice in LICENSE.md *
7
****************************************************************************************/
8
9
#ifndef __SGCT__SCREENCAPTURE__H__
10
#define __SGCT__SCREENCAPTURE__H__
11
12
#include <sgct/sgctexports.h>
13
14
#include <
sgct/math.h
>
15
#include <cstdint>
16
#include <memory>
17
#include <mutex>
18
#include <string>
19
#include <thread>
20
#include <vector>
21
22
namespace
sgct
{
23
24
class
Image
;
25
class
Window
;
26
30
class
SGCT_EXPORT
ScreenCapture
{
31
public
:
35
enum class
CaptureSource
{ Texture, BackBuffer, LeftBackBuffer, RightBackBuffer };
36
enum class
EyeIndex
{
Mono
,
StereoLeft
,
StereoRight
};
37
38
struct
ScreenCaptureThreadInfo
{
39
std::string
filename
;
40
std::unique_ptr<Image>
frameBufferImage
;
41
std::unique_ptr<std::thread>
captureThread
;
42
std::mutex*
mutex
=
nullptr
;
43
bool
isRunning
=
false
;
// needed for test if running without join
44
};
45
46
ScreenCapture
(
const
Window
& window,
ScreenCapture::EyeIndex
ei,
int
bytesPerColor,
47
unsigned
int
colorDataType,
bool
addAlpha);
48
~ScreenCapture
();
49
55
void
resize
(
ivec2
resolution);
56
64
void
saveScreenCapture
(
unsigned
int
textureId,
65
CaptureSource
capSrc =
CaptureSource::Texture
);
66
67
private
:
68
std::string createFilename(uint64_t frameNumber);
69
int
availableCaptureThread();
70
Image
* prepareImage(
int
index, std::string file);
71
72
std::mutex _mutex;
73
std::vector<ScreenCaptureThreadInfo> _captureInfos;
74
75
const
unsigned
int
_nThreads;
76
unsigned
int
_pbo = 0;
77
const
unsigned
int
_downloadType;
78
int
_dataSize = 0;
79
ivec2
_resolution =
ivec2
{ 0, 0 };
80
const
int
_bytesPerColor;
81
const
bool
_addAlpha;
82
83
const
EyeIndex _eyeIndex;
84
const
Window
& _window;
85
};
86
87
}
// namespace sgct
88
89
#endif
// __SGCT__SCREENCAPTURE__H__
sgct::Image
Definition
image.h:19
sgct::ScreenCapture::EyeIndex
EyeIndex
Definition
screencapture.h:36
sgct::ScreenCapture::~ScreenCapture
~ScreenCapture()
sgct::ScreenCapture::ScreenCapture
ScreenCapture(const Window &window, ScreenCapture::EyeIndex ei, int bytesPerColor, unsigned int colorDataType, bool addAlpha)
sgct::ScreenCapture::saveScreenCapture
void saveScreenCapture(unsigned int textureId, CaptureSource capSrc=CaptureSource::Texture)
This function saves the images to disc.
sgct::ScreenCapture::resize
void resize(ivec2 resolution)
Initializes the PBO or re-sizes it if the frame buffer size have changed.
sgct::ScreenCapture::CaptureSource
CaptureSource
The different file formats supported.
Definition
screencapture.h:35
sgct::ScreenCapture::CaptureSource::Texture
@ Texture
Definition
screencapture.h:35
sgct::Window
Definition
window.h:46
math.h
sgct
Definition
actions.h:16
sgct::FrustumMode::Mono
@ Mono
Definition
definitions.h:24
sgct::FrustumMode::StereoRight
@ StereoRight
Definition
definitions.h:26
sgct::FrustumMode::StereoLeft
@ StereoLeft
Definition
definitions.h:25
sgct::ScreenCapture::ScreenCaptureThreadInfo
Definition
screencapture.h:38
sgct::ScreenCapture::ScreenCaptureThreadInfo::frameBufferImage
std::unique_ptr< Image > frameBufferImage
Definition
screencapture.h:40
sgct::ScreenCapture::ScreenCaptureThreadInfo::isRunning
bool isRunning
Definition
screencapture.h:43
sgct::ScreenCapture::ScreenCaptureThreadInfo::filename
std::string filename
Definition
screencapture.h:39
sgct::ScreenCapture::ScreenCaptureThreadInfo::mutex
std::mutex * mutex
Definition
screencapture.h:42
sgct::ScreenCapture::ScreenCaptureThreadInfo::captureThread
std::unique_ptr< std::thread > captureThread
Definition
screencapture.h:41
sgct::ivec2
Definition
math.h:17
sgct
screencapture.h
Generated by
1.18.0