home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / System / Mesa-3.1 / include / GL / amigamesa.h next >
C/C++ Source or Header  |  1999-09-20  |  10KB  |  289 lines

  1. /*
  2.  * amigamesa.h 
  3.  */
  4.  
  5. /*
  6.  * Mesa 3-D graphics library
  7.  * Version:  3.1
  8.  * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
  9.  *
  10.  * This library is free software; you can redistribute it and/or
  11.  * modify it under the terms of the GNU Library General Public
  12.  * License as published by the Free Software Foundation; either
  13.  * version 2 of the License, or (at your option) any later version.
  14.  *
  15.  * This library is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18.  * Library General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU Library General Public
  21.  * License along with this library; if not, write to the Free
  22.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. /*
  26.  * $Id: Amigamesa.h 3.10 1999/06/22 18:51:18 NielsF Exp NielsF $
  27.  * 
  28.  * $Log: amigaMesa.h $
  29.  * Revision 3.10  1999/06/22  18:51:18  NielsF
  30.  * - Mesa 3.1 API
  31.  * - fixed most of the new introduced bugs
  32.  *
  33.  * $Log: amigaMesa.h $
  34.  * Revision 3.00  1998/09/15  19:16:56  NielsF
  35.  * - Mesa 3.0 API
  36.  * - fixed most of the bugs
  37.  *
  38.  * $Log: Amigamesa.h $
  39.  * Revision 1.5  1997/06/25  19:16:45  StefanZ
  40.  * *** empty log message ***
  41.  *
  42.  * Revision 1.3  1996/10/06  20:35:11  StefanZ
  43.  * Source bump before Mesa 2.0
  44.  *
  45.  * Revision 1.2  1996/08/14  22:16:31  StefanZ
  46.  * New Api to amigaspecific functions, Added suport for gfx-cards
  47.  *
  48.  * Revision 1.1  1996/06/02  00:15:03   StefanZ
  49.  * Initial revision
  50.  *
  51.  * Revision 1.0  1996/02/21  11:09:45   brianp
  52.  * A copy of amesa.h version 1.4 in a brave atempt to make a amiga interface
  53.  *
  54.  */
  55.  
  56. #ifndef AMIGAMESA_H
  57. #define AMIGAMESA_H
  58.  
  59. #ifdef __cplusplus
  60. extern "C" {
  61. #endif
  62.  
  63. #include <GL/gl.h>
  64.  
  65. #ifndef UTILITY_TAGITEM_H
  66. #include <utility/tagitem.h>
  67. #endif
  68.  
  69.   enum AMesaError {
  70.     AMESA_OUT_OF_MEM,
  71.  
  72.     AMESA_RASTPORT_TAG_MISSING,
  73.     AMESA_SCREEN_TAG_MISSING,
  74.     AMESA_WINDOW_TAG_MISSING
  75.   };
  76.  
  77.   enum AMesaChanged {
  78.     /* fail GL_FALSE */
  79.     AMESA_FAILED     =       -1 ,                        /* TODO: all bits set that are unused upto made number negative */
  80.     /* negative nothing */
  81.     AMESA_NOTHING    =        0 ,
  82.     /* positive bitfield */
  83.     AMESA_BUFFER     =  (1 << 0),                        /* gl_buffer changed */
  84.     AMESA_VISUAL     =  (1 << 1),                        /* gl_visual changed (implies gl_context/gl_buffer changed) */
  85.     AMESA_CONTEXT    =  (1 << 2),                        /* gl_context changed */
  86.     AMESA_SHARED     =  (1 << 3),                        /* gl_shared_context changed (implies gl_context changed) */
  87.     AMESA_DIMENSIONS =  (1 << 4),                        /* context-dimensions changed */
  88.     AMESA_BINDING    =  (1 << 5)                        /* contexts rastport (or window/screen) changed */
  89.   };
  90.  
  91. #ifndef    AOS_KERNEL
  92.   /* first part defines amigaMesa-specifig tag
  93.    * second part defines the choosen palette (aka modelling of available colors)
  94.    * third part defines methog to fetch data (aka encoding of given colors
  95.    *
  96.    * at the moment dithering is only available in RGBMode, that means if we are
  97.    * in index-mode the index-pixels are directly (without dither) mapped to
  98.    * pen-pixels, it could be an improvement to offer dithering even for index-modes
  99.    */
  100.   typedef enum PaletteModeID {
  101.     /* dithering */
  102.     AMESA_HPCR_DITHER = -8,                            /* hp-color-recovery */
  103.     AMESA_GREY_DITHER = -4,
  104.     AMESA_WEIGHTED_DITHER = -2,                            /* default standard 0 */
  105.     AMESA_TRUECOLOR_DITHER = -1,                        /* matches below 0 */
  106.     /* matching */
  107.     AMESA_HPCR_MATCH = 8,                            /* hp-color-recovery */
  108.     AMESA_GREY_MATCH = 4,
  109.     AMESA_WEIGHTED_MATCH = 2,                            /* default standard 0 */
  110.     AMESA_TRUECOLOR_MATCH = 1,                            /* matches below 0 */
  111.     /* shifting */
  112.     AMESA_TRUECOLOR_SHIFT = 0,                            /* shifts above 0 */
  113.     /* invalid */
  114.     AMESA_DEADFOOD = 0xDEAD                            /* dead man */
  115.   } palMode;
  116.  
  117.  /*
  118.   * This is the Amiga/Mesa context structure.  This usually contains
  119.   * info about what window/buffer we're rendering too, the current
  120.   * drawing color, etc.
  121.   */
  122.   struct amigamesa_context {
  123.     /* everything is private!!! */
  124.   };
  125.  
  126.   struct amigamesa_visual {
  127.     /* everything is private!!! */
  128.   };
  129.  
  130.   struct amigamesa_buffer {
  131.     /* everything is private!!! */
  132.   };
  133. #endif
  134.  
  135.   typedef struct amigamesa_context *amigaMesaContext;
  136.   typedef struct amigamesa_visual  *amigaMesaVisual;
  137.   typedef struct amigamesa_buffer  *amigaMesaBuffer;
  138.  
  139. /**********************************************************************/
  140. /*****                  Amiga/Mesa API Functions                  *****/
  141. /**********************************************************************/
  142.  
  143.   /* buffers */
  144.   amigaMesaBuffer amigaMesaCreateBufferTags(amigaMesaVisual, long Tag1,...);
  145.   amigaMesaBuffer amigaMesaCreateBuffer(amigaMesaVisual, struct TagItem *);
  146.   void amigaMesaDestroyBuffer(amigaMesaBuffer);
  147.  
  148.   enum AMesaChanged amigaMesaChangeBufferTags(amigaMesaBuffer, long Tag1,...);
  149.   enum AMesaChanged amigaMesaChangeBuffer(amigaMesaBuffer, struct TagItem *);
  150.  
  151.   void amigaMesaGetBufferTags(amigaMesaBuffer, long Tag1,...);
  152.   void amigaMesaGetBuffer(amigaMesaBuffer, struct TagItem *);
  153.  
  154.   /* visuals */
  155.   amigaMesaVisual amigaMesaCreateVisualTags(long Tag1,...);
  156.   amigaMesaVisual amigaMesaCreateVisual(struct TagItem *);
  157.   void amigaMesaDestroyVisual(amigaMesaVisual);
  158.  
  159.   enum AMesaChanged amigaMesaChangeVisualTags(amigaMesaVisual, long Tag1,...);
  160.   enum AMesaChanged amigaMesaChangeVisual(amigaMesaVisual, struct TagItem *);
  161.  
  162.   void amigaMesaGetVisualTags(amigaMesaVisual, long Tag1,...);
  163.   void amigaMesaGetVisual(amigaMesaVisual, struct TagItem *);
  164.  
  165.   /* contexts */
  166.   amigaMesaContext amigaMesaCreateContextTags(long Tag1,...);
  167.   amigaMesaContext amigaMesaCreateContext(struct TagItem *);
  168.   void amigaMesaDestroyContext(amigaMesaContext);
  169.  
  170.   enum AMesaChanged amigaMesaChangeContextTags(amigaMesaContext, long Tag1,...);
  171.   enum AMesaChanged amigaMesaChangeContext(amigaMesaContext, struct TagItem *);
  172.  
  173.   void amigaMesaGetContextTags(amigaMesaContext, long Tag1,...);
  174.   void amigaMesaGetContext(amigaMesaContext, struct TagItem *);
  175.  
  176.   /* misc */
  177.   void amigaMesaSetOneColor(amigaMesaContext, GLuint, GLfloat r, GLfloat g, GLfloat b);
  178.   GLuint amigaMesaGetOneColor(amigaMesaContext, GLuint);
  179.   GLint amigaMesaNumColors(amigaMesaContext);
  180.  
  181.   void amigaMesaMakeCurrent(amigaMesaContext, amigaMesaBuffer);
  182.   void amigaMesaSwapBuffers(amigaMesaContext);
  183.  
  184.   extern GLenum LastError;                            /* Last Error generated */
  185.  
  186.   /* This is on the drawingboard */
  187.   GLboolean amigaMesaSetDefs(struct TagItem *tagList);
  188.   GLenum amigaMesaReportError(amigaMesaContext amesa);
  189.  
  190. /**********************************************************************/
  191. /*****                amigaMesa TAGS (Set/Get)                    *****/
  192. /**********************************************************************/
  193.  
  194.  /*
  195.   * Amiga Mesa Attribute tag ID's.  These are used in the ti_Tag field of
  196.   * TagItem arrays passed to amigaMesaSetDefs() and amigaMesaCreateContext()
  197.   */
  198. #define AMA_Dummy        (TAG_USER + 32)
  199.  
  200.  /*
  201.   * Offset to use. WARNING AMA_Left, AMA_Bottom Specifies the low left corner
  202.   * of the drawing area in deltapixles from the lowest left corner
  203.   * typical AMA_Left,window->BorderLeft
  204.   * AMA_Bottom,window->BorderBottom + 1
  205.   * This is since ALL gl drawing actions is specified with this point as 0,0
  206.   * and with y positive uppwards (like in real graphs).
  207.   * 
  208.   * Untuched (defult) will result in 
  209.   * AMA_Left=0;
  210.   * AMA_Bottom=0;
  211.   */
  212. #define AMA_Left        (AMA_Dummy + 0x0001)
  213. #define AMA_Bottom        (AMA_Dummy + 0x0002)
  214. #define AMA_Right        (AMA_Dummy + 0x0003)
  215. #define AMA_Top            (AMA_Dummy + 0x0004)
  216.  
  217.  /*
  218.   * Size in pixels of drawing area if others than the whole rastport.
  219.   * All internal drawingbuffers will be in this size
  220.   * 
  221.   * Untuched (defult) will result in 
  222.   * AMA_Width =rp->BitMap->BytesPerRow*8;
  223.   * AMA_Height=rp->BitMap->Rows;
  224.   */
  225. #define AMA_Width        (AMA_Dummy + 0x0010)
  226. #define AMA_Height        (AMA_Dummy + 0x0011)
  227.  
  228. #define AMA_PaletteMode        (AMA_Dummy + 0x0020)
  229. #define AMA_PaletteCache    (AMA_Dummy + 0x0021)
  230. #define AMA_PaletteDither    (AMA_Dummy + 0x0022)
  231.  
  232. #define AMA_Screen        (AMA_Dummy + 0x0030)
  233. #define AMA_Window        (AMA_Dummy + 0x0031)
  234. #define AMA_RastPort        (AMA_Dummy + 0x0032)
  235.  
  236.  /** booleans **/
  237.  /*
  238.   * AMA_DoubleBuf: If specified it uses double Buffering (change buffer with
  239.   * amigaMesaSwapBuffers()) Turn this on as much as posible
  240.   * it will result in smother looking and faster rendering
  241.   * Defult value: GL_FALSE
  242.   * AMA_RGBMode: If specified it uses 24bit when drawing (on non 24bit displays it
  243.   * it emuletes 24bit)
  244.   * Defult value: GL_TRUE
  245.   * AMA_AlphaFlag: Alphachanel ?
  246.   * Defule value: GL_FALSE
  247.   */
  248. #define AMA_DoubleBuffer    (AMA_Dummy + 0x0040)
  249. #define AMA_RGBMode        (AMA_Dummy + 0x0041)
  250. #define AMA_AlphaChannel    (AMA_Dummy + 0x0042)
  251. #define AMA_Stereo        (AMA_Dummy + 0x0043)
  252.  
  253. #define AMA_BitsDepth        (AMA_Dummy + 0x0044)
  254. #define AMA_BitsAccum        (AMA_Dummy + 0x0045)
  255. #define AMA_BitsStencil        (AMA_Dummy + 0x0046)
  256.  
  257. #define    AMA_No3D        (AMA_Dummy + 0x0047)
  258.  
  259.  /** Special **/
  260.  /*
  261.   * AMA_ShareGLContext: Set the "friend" context (use multiple contexts) 
  262.   * See the GL maual or Mesa to get more info
  263.   * AMA_Visual: If you want to implement your own amigamesa_visual 
  264.   * AMA_Buffer: If you want to implement your own amigamesa_buffer
  265.   * AMA_WindowID: A windowID to use when I alloc AMA_Buffer for you if
  266.   * you didn't supply one.(defult=1)
  267.   */
  268.  
  269. #define AMA_ShareGLContext    (AMA_Dummy + 0x0050)
  270. #define AMA_Visual        (AMA_Dummy + 0x0051)
  271. #define AMA_Buffer        (AMA_Dummy + 0x0052)
  272. #define AMA_WindowID        (AMA_Dummy + 0x0053)
  273. #define AMA_GLContext        (AMA_Dummy + 0x0054)
  274.  
  275.  /** GetOnly **/
  276.  /*
  277.   * AMA_Depth: get the current context-depth
  278.   */
  279.  
  280. #define    AMA_VisualDepth        (AMA_Dummy + 0x0060)
  281. #define    AMA_ContextDepth    (AMA_Dummy + 0x0061)
  282. #define    AMA_VisualGLVisual    (AMA_Dummy + 0x0062)
  283.  
  284. #ifdef __cplusplus
  285. }
  286.  
  287. #endif
  288. #endif
  289.