colobot/colobot-base/graphics/opengl33/glframebuffer.h

130 lines
3.1 KiB
C
Raw Permalink Normal View History

2015-06-21 16:48:31 +00:00
/*
* This file is part of the Colobot: Gold Edition source code
2023-08-06 21:15:48 +00:00
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
2015-08-22 14:40:02 +00:00
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
2015-06-21 16:48:31 +00:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://gnu.org/licenses
*/
#pragma once
#include "graphics/core/framebuffer.h"
#include "graphics/opengl33/glutil.h"
2015-06-21 16:48:31 +00:00
2015-08-02 09:40:47 +00:00
namespace Gfx
{
2015-06-21 16:48:31 +00:00
/**
* \class CGLFramebuffer
* \brief Implementation of CFramebuffer interface in OpenGL 3.0+
2015-08-02 06:45:02 +00:00
*
2015-06-21 16:48:31 +00:00
* Provides the concrete implementation of core framebuffers.
* Can be used in OpenGL 3.0+ and with ARB_framebuffer_object supported.
*/
class CGLFramebuffer : public CFramebuffer
{
protected:
FramebufferParams m_params;
int m_width, m_height, m_depth, m_samples;
GLuint m_fbo;
GLuint m_colorRenderbuffer;
GLuint m_colorTexture;
GLuint m_depthRenderbuffer;
GLuint m_depthTexture;
static GLuint m_currentFBO;
public:
CGLFramebuffer(const FramebufferParams& params);
bool Create() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
void Destroy() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
bool IsDefault() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetWidth() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetHeight() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetDepth() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetSamples() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetColorTexture() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetDepthTexture() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
void Bind() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
void Unbind() override;
2015-06-21 22:56:47 +00:00
2015-08-17 19:53:28 +00:00
void CopyToScreen(int fromX, int fromY, int fromWidth, int fromHeight, int toX, int toY, int toWidth, int toHeight) override;
2015-06-21 16:48:31 +00:00
};
/**
* \class CGLFramebuffer
* \brief Implementation of CFramebuffer interface in legacy OpenGL
*
* Provides the concrete implementation of extension framebuffers.
* Can be used with EXT_framebuffer_object supported.
*/
class CGLFramebufferEXT : public CFramebuffer
{
protected:
FramebufferParams m_params;
int m_width, m_height, m_depth, m_samples;
GLuint m_fbo;
GLuint m_colorRenderbuffer;
GLuint m_colorTexture;
GLuint m_depthRenderbuffer;
GLuint m_depthTexture;
static GLuint m_currentFBO;
public:
CGLFramebufferEXT(const FramebufferParams& params);
bool Create() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
void Destroy() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
bool IsDefault() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetWidth() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetHeight() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetDepth() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetSamples() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetColorTexture() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
int GetDepthTexture() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
void Bind() override;
2015-06-21 16:48:31 +00:00
2015-08-17 19:53:28 +00:00
void Unbind() override;
2015-06-21 22:56:47 +00:00
2015-08-17 19:53:28 +00:00
void CopyToScreen(int fromX, int fromY, int fromWidth, int fromHeight, int toX, int toY, int toWidth, int toHeight) override;
2015-06-21 16:48:31 +00:00
};
} // end of Gfx