/*-----------------------------------------------------------------
LOG
    GEM - Graphics Environment for Multimedia

    A pix_renderaa

    Copyright (c) 1997-1999 Mark Danks. mark@danks.org
    For information on usage and redistribution, and for a DISCLAIMER OF ALL
    WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.

-----------------------------------------------------------------*/

#ifndef INCLUDE_PIX_RENDERAA_H_
#define INCLUDE_PIX_RENDERAA_H_

#include "Base/GemPixObj.h"
#include "../Geos/TexFont.h"

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    pix_renderaa
    
    renders a char buffer into an ascii art image

KEYWORDS
    pix
    
DESCRIPTION

-----------------------------------------------------------------*/
class GEM_EXTERN pix_renderaa : public GemBase
{
    CPPEXTERN_HEADER(pix_renderaa,GemBase)

    public:

        //////////
        // Constructor
    	pix_renderaa(int argc, t_atom *argv);
    	
    protected:
    	
    	//////////
    	// Destructor
    	virtual ~pix_renderaa ();

    	//////////
    	// Do the rendering
    	virtual void 	render(GemState *state);

    	//////////
    	// Turn back off texture mapping
    	virtual void 	postrender(GemState *state);

    	//////////
    	// Establish texture object
    	virtual void	startRendering();

    	//////////
    	// Delete texture object
    	virtual void	stopRendering();
    	
	//////////
	// Set up the texture state
	void			setUpTextureState();


        //////////
        GLuint			m_textureQuality;

	t_symbol*           m_fontname;

        //////////
        // Set the texture quality
        // [in] type - if == 0, then GL_NEAREST, else GL_LINEAR
        void            textureQuality(int type);

    	//////////
    	// The texture font object 
	TexFont *	    	m_textureObj;

    	//////////
    	// The font to use
    	virtual void   	fontNameMess(t_symbol *filename) 
	  {
	    m_fontname = filename;
	    startRendering();
	  };


    	virtual void   	sizeMess(t_floatarg w,t_floatarg h)
	  {

	  }


	//////////
	// Set the font size
	virtual void	setFontSize(int size) {};
		
	//////////
	// Set the precision for rendering
	virtual void	setPrecision(float prec) {};


	private:

    	//////////
    	// static member functions

    	static void 	textureMessCallback(void *data, t_floatarg n);
    	static void 	textMessCallback(void *data, t_floatarg n);
    	static void 	fontMessCallback(void *data, t_symbol* s)
	  { GetMyClass(data)->fontNameMess(s); }
};

#endif	// for header file
