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

    create a window

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

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

#ifndef INCLUDE_GEMWINCREATE_H_
#define INCLUDE_GEMWINCREATE_H_

#ifdef _UNIX_

#include <GL/glx.h>

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    WindowInfo
    
    All of the relavent information about an OpenGL window

DESCRIPTION
    
-----------------------------------------------------------------*/
class WindowInfo
{
	public:
	
		//////////
		// Constructor
		WindowInfo()	: dpy(NULL), win(NULL), cmap(NULL), context(NULL) {}

        //////////
        // X Display
		Display     *dpy;

        //////////
        // X window
		Window      win;

        //////////
        // X color map for window
		Colormap    cmap;

        //////////
        // GLXcontext for rendering
		GLXContext  context;
};

#elif _WINDOWS

#include <windows.h>

class WindowInfo
{
	public:

		//////////
		// Constructor
		WindowInfo()	: win(NULL), dc(NULL), context(NULL) {}

        //////////
        // Window handle
		HWND        win;

        //////////
        // Device context handle
		HDC         dc;

        //////////
        // Windows OpenGL context
		HGLRC       context;
};

#else

#error Need to specifiy an OS dependent window creation

#endif

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    WindowHints
    
    Hints for window creation

DESCRIPTION
    
-----------------------------------------------------------------*/
class WindowHints
{
	public:

        //////////
        // Should the window be realized
		int         actuallyDisplay;

        //////////
        // Single or double buffered
		int         buffer;

        //////////
        // The width/x of the window
		int         width;

        //////////
        // The height/y of the window
		int         height;

        //////////
        // The GLXcontext to share rendering with
#ifdef _UNIX_
		GLXContext  shared;
#elif _WINDOWS
		HGLRC       shared;
#endif
};



//////////
// Create a new window
extern int createGemWindow(WindowInfo &info, WindowHints &hints);

//////////
// Destroy a window
extern void destroyGemWindow(WindowInfo &info);

#endif  // for header file
