/*****************************************************************************
 * $Id: eng_opengl.hh,v 1.32 2006/07/29 14:01:53 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	OpenGL-specific functions.
 *//*
 * LEGAL:	COPYRIGHT (C) 2004 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE (GPL).
 *****************************************************************************/

#if COMPILING_ENGINE
#if GFXSYS_OPENGL
#ifndef ENG_OPENGL_HH
#define ENG_OPENGL_HH 1

// OpenGL matrix is always 4x4.
#define OPENGL_MATRIX_ELEMS     16

//------------------------------------------------------------------------------

void
Opengl( int* pargc, char** argv, const GfxsysParms* parms );

void
OpenglReshape( int w, int h );

void
OpenglSetViewportGeom( const Geom<int>& geom );

void
OpenglDisplayPreFrame( void );

void
OpenglDisplayPostFrame( void );

void
OpenglProject( int pt[2]/*OUT*/, const EyeVertex& v );

class VertexArray;
class DrawParm;
void
OpenglDrawVertexArray( VertexArray* const va, const EyeVertex* const ev, const DrawParm& drawParm );

//------------------------------------------------------------------------------
#if ENG_OPENGL_CC

static void
Opengl2( void );

static void
OpenglDisplayCallback( void );

static void
OpenglTimer( int unused );

static void
OpenglMouseButtonHandler( int button, int state, int x, int y );

static void
OpenglMouseMotionPassiveHandler( int x, int y );

static void
OpenglMouseMotionHandler( int x, int y );

static void
OpenglClearError( void );

static void
OpenglCheckError( const char* funcName );

static void
PrepOpenglDrawVertexArray( void );

#endif // ENG_OPENGL_CC
//------------------------------------------------------------------------------

#endif // ENG_OPENGL_HH
#endif // GFXSYS_OPENGL
#endif // COMPILING_ENGINE
