#ifndef __GLX_glx_h__
#define __GLX_glx_h__

#pragma ident "@(#)glx.h 1.11 98/10/30 SMI"

/*
 * Portions Copyright (c) 1997 by Sun Microsystems, Inc.
 * All Rights Reserved
 */


/*
** Copyright 1991, 1992, Silicon Graphics, Inc.
** All Rights Reserved.
** 
** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
** the contents of this file may not be disclosed to third parties, copied or
** duplicated in any form, in whole or in part, without the prior written
** permission of Silicon Graphics, Inc.
** 
** RESTRICTED RIGHTS LEGEND:
** Use, duplication or disclosure by the Government is subject to restrictions
** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
** rights reserved under the Copyright Laws of the United States.
*/

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xmd.h>
#include <GL/gl.h>
#include <GL/glxproto.h>
#include <GL/glxtokens.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
** GLX resources.
*/
typedef XID GLXContextID;
typedef XID GLXPixmap;
typedef XID GLXDrawable;
typedef XID GLXPbuffer;

/*
** GLXContext is a pointer to opaque data.
**/
typedef struct __glXContextRec *GLXContext;
typedef struct __glXFBConfigSGIXRec *GLXFBConfigSGIX;


/************************************************************************/

extern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList);
extern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, unsigned int mask);
extern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
extern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap);
extern void glXDestroyContext (Display *dpy, GLXContext ctx);
extern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix);
extern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value);
extern GLXContext glXGetCurrentContext (void);
extern GLXDrawable glXGetCurrentDrawable (void);
extern Bool glXIsDirect (Display *dpy, GLXContext ctx);
extern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx);
extern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase);
extern Bool glXQueryVersion (Display *dpy, int *major, int *minor);
extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable);
extern void glXUseXFont (Font font, int first, int count, int listBase);
extern void glXWaitGL (void);
extern void glXWaitX (void);
extern const char * glXGetClientString (Display *dpy, int name );
extern const char * glXQueryServerString (Display *dpy, int screen, int name );
extern const char * glXQueryExtensionsString (Display *dpy, int screen );

extern Display * glXGetCurrentDisplay (void);
extern Display * glXGetCurrentDisplayEXT (void);

#ifdef NOT_SUPPORTED
extern GLXContextID glXGetContextIDEXT (const GLXContext ctx);
extern GLXDrawable glXGetCurrentDrawableEXT (void);
extern GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID);
extern void glXFreeContextEXT (Display *dpy, GLXContext ctx);
extern int glXQueryContextInfoEXT (Display *dpy, GLXContext ctx, int attribute, int *value);
#endif

extern GLboolean glXGetTransparentIndexSUN(Display *dpy, Window overlay, 
		    Window underlay, unsigned int *transparentIndex);


/* Functions related to FBconfig extension */

extern  int glXGetFBConfigAttribSGIX(Display *dpy, 
			         GLXFBConfigSGIX  config,
			         int attribute,
			         int *value);
					   
extern  GLXFBConfigSGIX  *glXChooseFBConfigSGIX(Display *dpy, 
				           int screen,
				           const int *attrib_list,
				           int *nelements);
					   
extern  GLXPixmap glXCreateGLXPixmapWithConfigSGIX(Display *dpy, 
		                   	       GLXFBConfigSGIX  config,
				   	       Pixmap pixmap);

extern  GLXContext glXCreateContextWithConfigSGIX(Display *dpy,  
                                              GLXFBConfigSGIX  config,
					      int render_type,
                                              GLXContext share_list,
				 	      Bool direct);

extern  XVisualInfo *glXGetVisualFromFBConfigSGIX(Display *dpy,
                                              GLXFBConfigSGIX  config);

extern  GLXFBConfigSGIX  glXGetFBConfigFromVisualSGIX(Display *dpy,
                                                 XVisualInfo *vis);

/* Functions related to pbuffer extension */

extern GLXPbuffer glXCreateGLXPbufferSGIX(Display *dpy,
                                       GLXFBConfigSGIX config,
                                       unsigned int width,
                                       unsigned int height,
                                       int *attrib_list);

extern void glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbuffer pbuf);

extern void glXQueryGLXPbufferSGIX(Display *dpy, GLXPbuffer pbuf, int attribute,
                                unsigned int *value);

extern void glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, 
				unsigned int mask);

extern void glXGetSelectedEventSGIX(Display *dpy,
				 GLXDrawable drawable,
                                 unsigned int *mask);

extern Bool glXMakeCurrentReadSGI(Display *dpy, GLXDrawable drawable,
GLXDrawable readable, GLXContext ctx);

extern GLXDrawable glXGetCurrentReadDrawableSGI(void);

extern int glXInitThreadsSUN ( void );


#ifdef __cplusplus
}
#endif

#endif /* !__GLX_glx_h__ */
