2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * DOS/DJGPP device driver for Mesa
28 * Author: Daniel Borca
29 * Email : dborca@users.sourceforge.net
30 * Web : http://www.geocities.com/dborca
34 #ifndef DMESA_H_included
35 #define DMESA_H_included
37 #define DMESA_MAJOR_VERSION 6
38 #define DMESA_MINOR_VERSION 5
42 * 1. Call DMesaCreateVisual() to initialize graphics.
43 * 2. Call DMesaCreateContext() to create a DMesa rendering context.
44 * 3. Call DMesaCreateBuffer() to define the window.
45 * 4. Call DMesaMakeCurrent() to bind the DMesaBuffer to a DMesaContext.
46 * 5. Make gl* calls to render your graphics.
47 * 6. Use DMesaSwapBuffers() when double buffering to swap front/back buffers.
48 * 7. Before exiting, destroy DMesaBuffer, DMesaContext and DMesaVisual.
51 typedef struct dmesa_context
*DMesaContext
;
52 typedef struct dmesa_visual
*DMesaVisual
;
53 typedef struct dmesa_buffer
*DMesaBuffer
;
60 * Create a new Visual and set graphics mode.
62 DMesaVisual
DMesaCreateVisual (GLint width
, /* X res */
63 GLint height
, /* Y res */
64 GLint colDepth
, /* BPP */
65 GLint refresh
, /* refresh rate: 0=default */
66 GLboolean dbFlag
, /* double-buffered */
67 GLboolean rgbFlag
, /* RGB mode */
68 GLint alphaSize
, /* requested bits/alpha */
69 GLint depthSize
, /* requested bits/depth */
70 GLint stencilSize
, /* requested bits/stencil */
71 GLint accumSize
); /* requested bits/accum */
74 * Destroy Visual and restore screen.
76 void DMesaDestroyVisual (DMesaVisual v
);
81 * Create a new Context for rendering.
83 DMesaContext
DMesaCreateContext (DMesaVisual visual
, DMesaContext share
);
88 void DMesaDestroyContext (DMesaContext c
);
91 * Return a handle to the current context.
93 DMesaContext
DMesaGetCurrentContext (void);
98 * Create a new Buffer (window).
100 DMesaBuffer
DMesaCreateBuffer (DMesaVisual visual
,
101 GLint xpos
, GLint ypos
,
102 GLint width
, GLint height
);
107 void DMesaDestroyBuffer (DMesaBuffer b
);
110 * Return a handle to the current buffer.
112 DMesaBuffer
DMesaGetCurrentBuffer (void);
115 * Swap the front and back buffers for the given Buffer.
116 * No action is taken if the buffer is not double buffered.
118 void DMesaSwapBuffers (DMesaBuffer b
);
121 * Bind Buffer to Context and make the Context the current one.
123 GLboolean
DMesaMakeCurrent (DMesaContext c
, DMesaBuffer b
);
128 * Move/Resize current Buffer.
130 GLboolean
DMesaMoveBuffer (GLint xpos
, GLint ypos
);
131 GLboolean
DMesaResizeBuffer (GLint width
, GLint height
);
134 * Set palette index, using normalized values.
136 void DMesaSetCI (int ndx
, GLfloat red
, GLfloat green
, GLfloat blue
);
141 typedef void (*DMesaProc
) ();
142 DMesaProc
DMesaGetProcAddress (const char *name
);
145 * DMesa state retrieval.
147 #define DMESA_GET_SCREEN_SIZE 0x0100
148 #define DMESA_GET_DRIVER_CAPS 0x0200
149 #define DMESA_GET_VIDEO_MODES 0x0300
150 #define DMESA_GET_BUFFER_ADDR 0x0400
152 #define DMESA_DRIVER_DBL_BIT 0x1 /* double-buffered */
153 #define DMESA_DRIVER_YUP_BIT 0x2 /* lower-left window origin */
154 int DMesaGetIntegerv (GLenum pname
, GLint
*params
);