////////////////////////////////////////////////////////////////////////////////
// RenderToTexture.h
// Manages rendering to texture for OpenGL
// Copyright Björn Ganster 
// Developed since 2020
////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "Texture.h"

class RenderToTexture: public Texture {
public:
	// Default constructor
	RenderToTexture (GLenum _format = GL_BGR, const char* newname = "Texture");

	// Destructor
	~RenderToTexture() OVERRIDE;

	// Prepare for next frame
	void prepare(TextureDim sizex, TextureDim sizey, bool zBuffer);

	// Call this to stop rendering to texture
	void stopRenderingToTexture(bool getDepthBuffer);

	// Query if rendering to texture is possible
	bool canRenderToTexture() const;
private:
	GLuint mFrameBufferName, mDepthBufferName, mRenderedTextureName;
	bool mCanRenderToTexture;
};
