#include	"quakedef.h"
#include	"gl_BufferFBO.h"
#include	"gl_BufferPBO.h"

void Buffer_Set (int Width, int Height)
{
	if (gl_fbo_pbo.value == 2)
		FBO_Set (1 , Width, Height, 32, 0);
	else if (gl_fbo_pbo.value == 1)
		PBO_Set  (Width, Height, modeTexture2D, true);
}

void Buffer_Init (void)
{
	if (gl_fbo_pbo.value == 2)
	{
		FBO_Init();
		PBO_Delete();
	}
	else if (gl_fbo_pbo.value == 1)
	{
		PBO_Init();
		FBO_Delete();
	}
	else
	{
		FBO_Delete();
		PBO_Delete();
	}
}

void Buffer_Delete (void)
{
	if (gl_fbo_pbo.value == 2)
		FBO_Delete();
	else if (gl_fbo_pbo.value == 1)
		PBO_Delete();
	else
	{
		FBO_Delete();
		PBO_Delete();
	}
}

void Buffer_Activate (void)
{
	if (gl_fbo_pbo.value == 2)
	{}
	else if (gl_fbo_pbo.value == 1)
		PBO_Activate();
}

void Buffer_Deactivate (void)
{
	if (gl_fbo_pbo.value == 2)
	{}
	else if (gl_fbo_pbo.value == 1)
		PBO_Deactivate();
}

void Buffer_BindToTexture (void)
{
	if (gl_fbo_pbo.value == 2)
	{}
	else if (gl_fbo_pbo.value == 1)
	PBO_BindToTexture(WGL_FRONT_LEFT_ARB);
}

void Buffer_UnbindFromTexture (void)
{
	if (gl_fbo_pbo.value == 2)
	{}
	else if (gl_fbo_pbo.value == 1)
	PBO_UnbindFromTexture(WGL_FRONT_LEFT_ARB);
}