OpenRCT2/src/openrct2-ui/drawing/engines/opengl/OpenGLFramebuffer.h

65 lines
1.6 KiB
C
Raw Normal View History

2016-06-11 03:24:39 +02:00
/*****************************************************************************
* Copyright (c) 2014-2023 OpenRCT2 developers
2016-06-11 03:24:39 +02:00
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2016-06-11 03:24:39 +02:00
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
2016-06-11 03:24:39 +02:00
*****************************************************************************/
#pragma once
#include "OpenGLAPI.h"
2018-06-22 23:20:09 +02:00
#include <openrct2/common.h>
#include <openrct2/drawing/Drawing.h>
#include <vector>
2016-06-11 03:24:39 +02:00
struct SDL_Window;
class OpenGLFramebuffer
{
private:
GLuint _id;
GLuint _texture;
GLuint _depth;
int32_t _width;
int32_t _height;
2016-06-11 03:24:39 +02:00
public:
2018-06-22 23:20:09 +02:00
explicit OpenGLFramebuffer(SDL_Window* window);
2023-12-03 18:58:28 +01:00
OpenGLFramebuffer(int32_t width, int32_t height, bool depth = true, bool integer = true, bool word = false);
2016-06-11 03:24:39 +02:00
~OpenGLFramebuffer();
2018-06-22 23:20:09 +02:00
OpenGLFramebuffer(const OpenGLFramebuffer&) = delete;
OpenGLFramebuffer& operator=(const OpenGLFramebuffer&) = delete;
2017-10-22 04:04:24 +02:00
2018-06-22 23:20:09 +02:00
GLuint GetWidth() const
{
return _width;
}
GLuint GetHeight() const
{
return _height;
}
GLuint GetTexture() const
{
return _texture;
}
GLuint GetDepthTexture() const
{
return _depth;
}
2016-06-11 03:24:39 +02:00
2016-06-11 16:18:31 +02:00
void Bind() const;
void BindDraw() const;
void BindRead() const;
void GetPixels(DrawPixelInfo& dpi) const;
2017-10-22 04:04:24 +02:00
2018-06-22 23:20:09 +02:00
void SwapColourBuffer(OpenGLFramebuffer& other);
2017-10-22 04:04:24 +02:00
GLuint SwapDepthTexture(GLuint depth);
2018-06-22 23:20:09 +02:00
void Copy(OpenGLFramebuffer& src, GLenum filter);
2017-10-22 04:04:24 +02:00
static GLuint CreateDepthTexture(int32_t width, int32_t height);
2016-06-11 03:24:39 +02:00
};