/* * Mesa 3-D graphics library * Version: 7.1 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Mesa/X11 interface. This header file serves as the documentation for * the Mesa/X11 interface functions. * * Note: this interface isn't intended for user programs. It's primarily * just for implementing the pseudo-GLX interface. */ /* Sample Usage: In addition to the usual X calls to select a visual, create a colormap and create a window, you must do the following to use the X/Mesa interface: 1. Call XMesaCreateVisual() to make an XMesaVisual from an XVisualInfo. 2. Call XMesaCreateContext() to create an X/Mesa rendering context, given the XMesaVisual. 3. Call XMesaCreateWindowBuffer() to create an XMesaBuffer from an X window and XMesaVisual. 4. Call XMesaMakeCurrent() to bind the XMesaBuffer to an XMesaContext and to make the context the current one. 5. Make gl* calls to render your graphics. 6. Use XMesaSwapBuffers() when double buffering to swap front/back buffers. 7. Before the X window is destroyed, call XMesaDestroyBuffer(). 8. Before exiting, call XMesaDestroyVisual and XMesaDestroyContext. */ #ifndef XMESA_H #define XMESA_H typedef struct xmesa_context *XMesaContext; typedef struct xmesa_visual *XMesaVisual; typedef struct xmesa_buffer *XMesaBuffer; /* Every user of this file also includes xmesaP.h */ #include "xmesaP.h" /* * Create a new X/Mesa visual. * Input: display - X11 display * visinfo - an XVisualInfo pointer * rgb_flag - GL_TRUE = RGB mode, * GL_FALSE = color index mode * alpha_flag - alpha buffer requested? * db_flag - GL_TRUE = double-buffered, * GL_FALSE = single buffered * stereo_flag - stereo visual? * ximage_flag - GL_TRUE = use an XImage for back buffer, * GL_FALSE = use an off-screen pixmap for back buffer * depth_size - requested bits/depth values, or zero * stencil_size - requested bits/stencil values, or zero * accum_red_size - requested bits/red accum values, or zero * accum_green_size - requested bits/green accum values, or zero * accum_blue_size - requested bits/blue accum values, or zero * accum_alpha_size - requested bits/alpha accum values, or zero * num_samples - number of samples/pixel if multisampling, or zero * level - visual level, usually 0 * visualCaveat - ala the GLX extension, usually GLX_NONE_EXT * Return; a new XMesaVisual or 0 if error. */ extern XMesaVisual XMesaCreateVisual( Display *display, XVisualInfo * visinfo, GLboolean rgb_flag, GLboolean alpha_flag, GLboolean db_flag, GLboolean stereo_flag, GLboolean ximage_flag, GLint depth_size, GLint stencil_size, GLint accum_red_size, GLint accum_green_size, GLint accum_blue_size, GLint accum_alpha_size, GLint num_samples, GLint level, GLint visualCaveat ); /* * Destroy an XMesaVisual, but not the associated XVisualInfo. */ extern void XMesaDestroyVisual( XMesaVisual v ); /* * Create a new XMesaContext for rendering into an X11 window. * * Input: visual - an XMesaVisual * share_list - another XMesaContext with which to share display * lists or NULL if no sharing is wanted. * Return: an XMesaContext or NULL if error. */ extern XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ); /* * Destroy a rendering context as returned by XMesaCreateContext() */ extern void XMesaDestroyContext( XMesaContext c ); /* * Create an XMesaBuffer from an X window. */ extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, Window w ); /* * Create an XMesaBuffer from an X pixmap. */ extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, Pixmap p, Colormap cmap ); /* * Destroy an XMesaBuffer, but not the corresponding window or pixmap. */ extern void XMesaDestroyBuffer( XMesaBuffer b ); /* * Return the XMesaBuffer handle which corresponds to an X drawable, if any. * * New in Mesa 2.3. */ extern XMesaBuffer XMesaFindBuffer( Display *dpy, Drawable d ); /* * Bind two buffers (read and draw) to a context and make the * context the current one. * New in Mesa 3.3 */ extern GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, XMesaBuffer readBuffer ); /* * Unbind the current context from its buffer. */ extern GLboolean XMesaUnbindContext( XMesaContext c ); /* * Return a handle to the current context. */ extern XMesaContext XMesaGetCurrentContext( void ); /* * Swap the front and back buffers for the given buffer. No action is * taken if the buffer is not double buffered. */ extern void XMesaSwapBuffers( XMesaBuffer b ); /* * Copy a sub-region of the back buffer to the front buffer. * * New in Mesa 2.6 */ extern void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ); /* * Flush/sync a context */ extern void XMesaFlush( XMesaContext c ); /* * Scan for XMesaBuffers whose window/pixmap has been destroyed, then free * any memory used by that buffer. * * New in Mesa 2.3. */ extern void XMesaGarbageCollect( void ); /* * Create a pbuffer. * New in Mesa 4.1 */ extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, Colormap cmap, unsigned int width, unsigned int height); /* * Texture from Pixmap * New in Mesa 7.1 */ extern void XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer, const int *attrib_list); extern void XMesaReleaseTexImage(Display *dpy, XMesaBuffer drawable, int buffer); extern XMesaBuffer XMesaCreatePixmapTextureBuffer(XMesaVisual v, Pixmap p, Colormap cmap, int format, int target, int mipmap); #endif