OXYGENHUB
◆ main openmsx / src / video / OffScreenSurface.cc
925 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#include "OffScreenSurface.hh"
2
3
#include "GLUtil.hh"
4
#include "VisibleSurface.hh"
5
6
namespace openmsx {
7
8
OffScreenSurface::OffScreenSurface(const OutputSurface& output)
9
	: fboTex(true) // enable interpolation   TODO why?
10
{
11
	calculateViewPort(output.getLogicalSize(), output.getPhysicalSize());
12
	auto [w, h] = getPhysicalSize();
13
	fboTex.bind();
14
	glTexImage2D(GL_TEXTURE_2D,    // target
15
	             0,                // level
16
	             GL_RGB,           // internal format
17
	             w,                // width
18
	             h,                // height
19
	             0,                // border
20
	             GL_RGB,           // format
21
	             GL_UNSIGNED_BYTE, // type
22
	             nullptr);         // data
23
	fbo = gl::FrameBufferObject(fboTex);
24
	fbo.push();
25
}
26
27
void OffScreenSurface::saveScreenshot(const std::string& filename)
28
{
29
	VisibleSurface::saveScreenshotGL(*this, filename);
30
}
31
32
} // namespace openmsx