home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / mesa-1.2.8 / include / gl / xmesa.h < prev   
C/C++ Source or Header  |  1996-05-27  |  6KB  |  202 lines

  1. /* $Id: xmesa.h,v 1.10 1996/04/26 16:58:31 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  1.2
  6.  * Copyright (C) 1995-1996  Brian Paul  (brianp@ssec.wisc.edu)
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25. $Log: xmesa.h,v $
  26.  * Revision 1.10  1996/04/26  16:58:31  brianp
  27.  * added Colormap argument to XMesaBindPixmap()
  28.  *
  29.  * Revision 1.9  1996/04/25  19:31:59  brianp
  30.  * added new parameters to XMesaCreateContext()
  31.  *
  32.  * Revision 1.8  1996/02/15  16:00:31  brianp
  33.  * added Amiga Amiwin support
  34.  *
  35.  * Revision 1.7  1995/10/12  16:58:55  brianp
  36.  * fixed up include files
  37.  *
  38.  * Revision 1.6  1995/05/22  17:03:21  brianp
  39.  * Release 1.2
  40.  *
  41.  * Revision 1.5  1995/05/15  16:11:41  brianp
  42.  * added share_list argument to XMesaCreateContext()
  43.  *
  44.  * Revision 1.4  1995/04/19  13:47:56  brianp
  45.  * added XMesaGetBackBuffer()
  46.  *
  47.  * Revision 1.3  1995/04/17  14:42:32  brianp
  48.  * API changes: XMesaCreateContext, XMesaBindWindow, XMesaBindPixmap
  49.  *
  50.  * Revision 1.2  1995/03/04  19:45:47  brianp
  51.  * 1.1 beta revision
  52.  *
  53.  * Revision 1.1  1995/02/28  21:21:03  brianp
  54.  * Initial revision
  55.  *
  56.  */
  57.  
  58.  
  59. /*
  60.  * Mesa/X11 interface.  This header file serves as the documentation for
  61.  * the Mesa/X11 interface functions.
  62.  */
  63.  
  64.  
  65. /* Sample Usage:
  66.  
  67. 1. Make the X11 calls needed to open the display, select a visual, make a
  68.    colormap, open a window, etc.
  69.  
  70. 2. Call XMesaCreateContext() to create an X/Mesa rendering context.
  71.  
  72. 3. Call XMesaBindWindow() to bind the context to your window.
  73.    (or XMesaBindPixmap() to bind the context to an off-screen pixmap).
  74.  
  75. 4. Call XMesaMakeCurrent() to make the context the active one.
  76.  
  77. 5. Make gl* calls to render your graphics.
  78.  
  79. 6. Use XMesaSwapBuffers() when double buffering to update the window.
  80.  
  81. 7. When exiting, call XMesaDestroyContext().
  82.  
  83. */
  84.  
  85.  
  86.  
  87.  
  88. #ifndef XMESA_H
  89. #define XMESA_H
  90.  
  91.  
  92. #ifdef __cplusplus
  93. extern "C" {
  94. #endif
  95.  
  96.  
  97. #include <X11/Xlib.h>
  98. #include <X11/Xutil.h>
  99. #include "GL/gl.h"
  100.  
  101. #ifdef AMIWIN
  102. #include <pragmas/xlib_pragmas.h>
  103. extern struct Library *XLibBase;
  104. #endif
  105.  
  106.  
  107.  
  108. /*
  109.  * This is the XMesa context 'handle':
  110.  */
  111. typedef struct xmesa_context *XMesaContext;
  112.  
  113.  
  114.  
  115. /*
  116.  * Create a new XMesaContext for rendering into an X11 window.
  117.  *
  118.  * Input:  display - X11 display
  119.  *         window - X11 window to render into.
  120.  *         rgb_flag - GL_TRUE = RGB mode,
  121.  *                    GL_FALSE = color index mode
  122.  *         alpha_flag - alpha buffer requested?
  123.  *         db_flag - GL_TRUE = double-buffered,
  124.  *                   GL_FALSE = single buffered
  125.  *         depth_size - requested bits/depth values, or zero
  126.  *         stencil_size - requested bits/stencil values, or zero
  127.  *         accum_size - requested bits/component values, or zero
  128.  *         ximage_flag - GL_TRUE = use an XImage for back buffer,
  129.  *                       GL_FALSE = use an off-screen pixmap for back buffer
  130.  *         share_list - another XMesaContext with which to share display
  131.  *                      lists or NULL if no sharing is wanted.
  132.  * Return:  an XMesaContext or NULL if error.
  133.  */
  134. extern XMesaContext XMesaCreateContext( Display *display,
  135.                                         XVisualInfo *visinfo,
  136.                                         GLboolean rgb_flag,
  137.                                         GLboolean alpha_flag,
  138.                                         GLboolean db_flag,
  139.                                         GLint depth_size,
  140.                                         GLint stencil_size,
  141.                                         GLint accum_size,
  142.                                         GLboolean ximage_flag,
  143.                                         XMesaContext share_list );
  144.  
  145.  
  146. /*
  147.  * Destroy a rendering context as returned by XMesaCreateContext()
  148.  */
  149. extern void XMesaDestroyContext( XMesaContext ctx );
  150.  
  151.  
  152. /*
  153.  * Bind an X/Mesa context to an X window.
  154.  */
  155. extern GLboolean XMesaBindWindow( XMesaContext c, Window w );
  156.  
  157.  
  158. /*
  159.  * Bind an X/Mesa context to an X pixmap.
  160.  */
  161. extern GLboolean XMesaBindPixmap( XMesaContext c, Pixmap p, Colormap cmap );
  162.  
  163.  
  164. /*
  165.  * Make the specified context the current one.
  166.  */
  167. extern GLboolean XMesaMakeCurrent( XMesaContext ctx );
  168.  
  169.  
  170. /*
  171.  * Return a handle to the current context.
  172.  */
  173. extern XMesaContext XMesaGetCurrentContext( void );
  174.  
  175.  
  176. /*
  177.  * Swap the front and back buffers for the current context.  No action is
  178.  * taken if the context is not double buffered.
  179.  */
  180. extern void XMesaSwapBuffers( void );
  181.  
  182.  
  183. /*
  184.  * Return a pointer to the XMesa backbuffer Pixmap or XImage.  This function
  185.  * is a way to get "under the hood" of X/Mesa so one can manipulate the
  186.  * back buffer directly.
  187.  * Output:  pixmap - pointer to back buffer's Pixmap, or 0
  188.  *          ximage - pointer to back buffer's XImage, or NULL
  189.  * Return:  GL_TRUE = context is double buffered
  190.  *          GL_FALSE = context is single buffered
  191.  */
  192. extern GLboolean XMesaGetBackBuffer( Pixmap *pixmap, XImage **ximage );
  193.  
  194.  
  195.  
  196. #ifdef __cplusplus
  197. }
  198. #endif
  199.  
  200.  
  201. #endif
  202.