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

  1. /* $Id: Amigamesa.h,v 1.0 1996/02/21 11:09:45 StefanZ 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: amesa.h,v $
  26.  * Revision 1.0  1996/02/21  11:09:45  brianp
  27.  * A copy of amesa.h version 1.4 in a brave atempt to make a amiga interface
  28.  *
  29.  */
  30.  
  31.  
  32. /*
  33.  * Mesa/Amiga interface by Stephan Zivkovic (d94sz@efd.lth.se)
  34.  */
  35.  
  36.  
  37. /* Example usage:
  38.  *
  39.  * 1. Make a window using Intuition calls
  40.  *
  41.  * 2. Call AMesaCreateContext() to make a rendering context and attach it
  42.  *    to the window made in step 1.
  43.  *
  44.  * 3. Call AMesaMakeCurrent() to make the context the active one.
  45.  *
  46.  * 4. Make gl* calls to render your graphics.
  47.  *
  48.  * 5. When exiting, call AMesaDestroyContext().
  49.  */
  50.  
  51.  
  52.  
  53. #ifndef AMIGAMESA_H
  54. #define AMIGAMESA_H
  55.  
  56.  
  57. #include <intuition/intuition.h>
  58. #include "GL/gl.h"
  59.  
  60.  
  61. /*
  62.  * This is the Amiga/Mesa context structure.  This usually contains
  63.  * info about what window/buffer we're rendering too, the current
  64.  * drawing color, etc.
  65.  */
  66. struct amigamesa_context
  67. {
  68.     struct gl_context *gl_ctx;    /* the core library context */
  69.     GLboolean db_flag;        /* double buffered? */
  70.     GLboolean rgb_flag;        /* RGB mode? */
  71.     struct amigamesa_contex * sharelist;
  72.  
  73.     unsigned long pixel;    /* current color index or RGBA pixel value */
  74.     unsigned long clearpixel;  /* pixel for clearing the color buffers */
  75.  
  76.     /* etc... */
  77.     struct Window *window;        /* the Intuition window */
  78.         struct RastPort *front_rp;    /* front rastport */
  79.         struct RastPort *back_rp;    /* back rastport (NULL if SB or RGB) */
  80.     struct RastPort *rp;        /* current rastport */
  81.     struct TmpRas *tmpras;        /* tmpras rastport */
  82.     GLuint depth;            /* bits per pixel (1, 8, 24, etc) */
  83.  
  84.     GLuint width, height;        /* drawable area */
  85.     GLint left, bottom;        /* offsets due to window border */
  86.     
  87.     int mypen[256];
  88.     UBYTE penconv[256];    /* when allocating index 13 with a color */
  89.                 /* penconv[13] is the actual system color. */
  90.                 /* penconv[] is changed if */
  91.                 /* auxSetOneColor(index,r,g,b); is called */ 
  92.  
  93.     UBYTE *imageline;    /* One Line for WritePixelRow renders */
  94.     GLuint *rgb_buffer;    /* back buffer when in RGBA mode  OLD DElete?*/
  95. };
  96.  
  97.  
  98.  
  99. typedef struct amigamesa_context *AmigaMesaContext;
  100.  
  101. void amiga_setup_DD_pointers(void);
  102.  
  103.  
  104. /**********************************************************************/
  105. /*****              Some Usefull code                             *****/
  106. /**********************************************************************/
  107.  
  108. int RGBA(GLubyte r,GLubyte g,GLubyte b,GLubyte a);    /* returns an allocated color thts nearest the wanted one */
  109.  
  110.  
  111. /**********************************************************************/
  112. /*****               Amiga/Mesa API Functions                     *****/
  113. /**********************************************************************/
  114.  
  115. __asm __saveds struct amigamesa_context *AmigaMesaCreateContext(register __a1 struct Window *window,register __d0 GLboolean rgb_flag,register __d1 GLboolean db_flag );
  116. __asm __saveds void AmigaMesaDestroyContext(register __a0 struct amigamesa_context *c );
  117. __asm __saveds void AmigaMesaMakeCurrent(register __a0 struct amigamesa_context *c );
  118. __asm __saveds void AmigaMesaSwapBuffers();
  119.  
  120.  
  121.  
  122. #endif
  123.