/*
Copyright (C) 2003-2006 Andrey Nazarov

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 2
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

#ifdef _WIN32
#define DEFAULT_OPENGL_DRIVER	"opengl32"
#else
#define DEFAULT_OPENGL_DRIVER	"libGL.so"
#endif

typedef enum {
	SETMODE_ERROR,
	SETMODE_WINDOWED,
	SETMODE_FULLSCREEN
} vidSetModeResult_t;

typedef enum {
	QVF_MINIDRIVER			= ( 1 << 0 ),
	QVF_ACCELERATED			= ( 1 << 1 ),
	QVF_STEREO_ENABLED		= ( 1 << 2 ),
	QVF_GAMMARAMP_ENABLED		= ( 1 << 3 ),
	QVF_FULLSCREEN_ENABLED		= ( 1 << 4 )
} vidFlags_t;

typedef struct {
	void (*Shutdown)( void );
	void (*UpdateGamma)( const byte *table );
	vidFlags_t (*GetFlags)( void );
	qboolean (*Init)( void );
	vidSetModeResult_t (*SetMode)( int *pwidth, int *pheight, int mode, qboolean fullscreen );
	void *(*GetProcAddr)( const char *symbol );
	void (*BeginFrame)( float stereo_separation );
	void (*EndFrame)( void );
} vidGLAPI_t;

typedef struct {
	void (*Shutdown)( void );
	void (*UpdateGamma)( const byte *table );
	vidFlags_t (*GetFlags)( void );
	qboolean (*Init)( void );
	vidSetModeResult_t (*SetMode)( int *pwidth, int *pheight, byte **buffer, int *rowbytes,
			const byte *palette, int mode, qboolean fullscreen );
	byte *(*GetSurface)( int *rowbytes );
	void (*UpdatePalette)( const byte *palette );
	void (*BeginFrame)( float stereo_separation );
	void (*EndFrame)( byte **buffer, int *rowbytes );
} vidSWAPI_t;

void Video_PumpEvents( void );
void Video_FillInputAPI( inputAPI_t *api );
void Video_FillGLAPI( vidGLAPI_t *api );
void Video_FillSWAPI( vidSWAPI_t *api );

#ifdef OPENGL_RENDERER
extern vidGLAPI_t   video;
#elif (defined SOFTWARE_RENDERER)
extern vidSWAPI_t   video;
#endif


