2016-06-11 03:24:39 +02:00
|
|
|
/*****************************************************************************
|
2023-01-01 11:58:01 +01:00
|
|
|
* Copyright (c) 2014-2023 OpenRCT2 developers
|
2016-06-11 03:24:39 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +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
|
|
|
*
|
2018-06-15 14:07:34 +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>
|
2017-09-24 04:51:40 +02:00
|
|
|
#include <vector>
|
|
|
|
|
2016-06-11 03:24:39 +02:00
|
|
|
struct SDL_Window;
|
|
|
|
|
|
|
|
class OpenGLFramebuffer
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
GLuint _id;
|
|
|
|
GLuint _texture;
|
2017-10-20 01:49:26 +02:00
|
|
|
GLuint _depth;
|
2018-06-20 17:28:51 +02:00
|
|
|
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;
|
2017-09-24 04:51:40 +02:00
|
|
|
void BindDraw() const;
|
|
|
|
void BindRead() const;
|
2023-01-19 09:16:44 +01:00
|
|
|
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
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
static GLuint CreateDepthTexture(int32_t width, int32_t height);
|
2016-06-11 03:24:39 +02:00
|
|
|
};
|