#ifndef ABSTRACTRENDER_H
#define ABSTRACTRENDER_H

#include "./../../lib/GLee/GLee.h"	



#include <QGLWidget>
#include <QGLContext>
#include "./context/Context.h"
using namespace std;


///Auxiliary viewport data - start position and size of the viewport where to render.
struct Viewport
{
	unsigned int fromX, fromY, sizeX, sizeY;
};



///Provides basic render interface.
class AbstractRender
{
protected:
	Context &context;
	void swapBuffer(void);

public:
	Viewport viewport;

	AbstractRender( Context &context);
	virtual ~AbstractRender(void);

	virtual void bind(void);			/**< Bind render */
	virtual void beginFrame(void);		/**< Bind render and clear buffers */

	virtual void endFrame(bool swapBuffer=true);	/**< Make sure that all OpenGL statements were done. */

	void clearFramebuffer(void);		/**< Clear framebuffer */
	void clearDepthbuffer(void);		/**< Clear depthbuffer */

	void setViewport(unsigned int fromX, unsigned int fromY, unsigned int sizeX, unsigned int sizeY);	/**< Set viewport. This settings will be set everytime after calling bind() or beginGrame() */
};

#endif