/*****************************************************************************
 * $LastChangedDate: 2009-12-26 00:05:41 -0500 (Sat, 26 Dec 2009) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   OpenGL abstraction.
 *//*
 * LEGAL:   COPYRIGHT (C) 2008 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef GFX_GFX_HH
#define GFX_GFX_HH 1

#include "gfx/opengl.hh"
#include "gfx/graphics.hh"
#include "gfx/rgba.hh"

namespace gfx {

////////////////////////////////////////////////////////////////////////////////
/// @brief OpenGL abstraction.
///
/// The GFX class is intended for when low-level OpenGL functions
/// are called by an osg::Operation functor.  OSG allows changes to OpenGL state
/// in that situation and GFX makes no attempt to save/restore OpenGL state.
///
class GFX
{
PREVENT_COPYING(GFX)
public:
    CLASS_METHOD void   Begin2D( const Rect<int>& rect );
    CLASS_METHOD void   Begin2D( void );  // current window
    CLASS_METHOD void   End2D( void );
    CLASS_METHOD void   DrawBox( const Rect<int>& rect, const RGBA color, const bool drawX = false );

    /*****************************************************************************
     * Send 2D vertex.
     *****************************************************************************/
    CLASS_METHOD
    void
    Vertex2D( fp x, fp y )
    {
        // glVertex3f() with Z=1.0 is actually used for a 2D vertex
        // in order to draw 2D vertexs over a 3D scene.
        // A particular problem is drawing 2D fonts when a 3D land polygon
        // at low altitude becomes so close that it would obscure the 2D fonts.
        glVertex3f( x, y, 1.0f );
    }
};

} // namespace gfx

#endif // GFX_GFX_HH
