Debian Codegraph @

debian/external_deps/fetk/sg/src/gl/context.h

raw
1 /* $Id: context.h,v 1.2 2000/10/27 15:21:40 mholst Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 2.2
6 * Copyright (C) 1995-1997 Brian Paul
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 #ifndef CONTEXT_H
24 #define CONTEXT_H
25
26
27 #include "types.h"
28
29
30
31 #ifdef THREADS
32 /*
33 * A seperate GLcontext for each thread
34 */
35 extern GLcontext *gl_get_thread_context( void );
36 #else
37 /*
38 * All threads use same pointer to current context.
39 */
40 extern GLcontext *CC;
41 #endif
42
43
44
45 /*
46 * There are three Mesa datatypes which are meant to be used by device
47 * drivers:
48 * GLcontext: this contains the Mesa rendering state
49 * GLvisual: this describes the color buffer (rgb vs. ci), whether
50 * or not there's a depth buffer, stencil buffer, etc.
51 * GLframebuffer: contains pointers to the depth buffer, stencil
52 * buffer, accum buffer and alpha buffers.
53 *
54 * These types should be encapsulated by corresponding device driver
55 * datatypes. See xmesa.h and xmesaP.h for an example.
56 *
57 * The following functions create and destroy these datatypes.
58 */
59
60
61 /*
62 * Create/destroy a GLvisual. A GLvisual is like a GLX visual. It describes
63 * the colorbuffer, depth buffer, stencil buffer and accum buffer which will
64 * be used by the GL context and framebuffer.
65 */
66 extern GLvisual *gl_create_visual( GLboolean rgb_flag,
67 GLboolean alpha_flag,
68 GLboolean db_flag,
69 GLint depth_bits,
70 GLint stencil_bits,
71 GLint accum_bits,
72 GLint index_bits,
73 GLfloat red_scale,
74 GLfloat green_scale,
75 GLfloat blue_scale,
76 GLfloat alpha_scale );
77
78 extern void gl_destroy_visual( GLvisual *vis );
79
80
81 /*
82 * Create/destroy a GLcontext. A GLcontext is like a GLX context. It
83 * contains the rendering state.
84 */
85 extern GLcontext *gl_create_context( GLvisual *visual,
86 GLcontext *share_list,
87 void *driver_ctx );
88
89 extern void gl_destroy_context( GLcontext *ctx );
90
91
92 /*
93 * Create/destroy a GLframebuffer. A GLframebuffer is like a GLX drawable.
94 * It bundles up the depth buffer, stencil buffer and accum buffers into a
95 * single entity.
96 */
97 extern GLframebuffer *gl_create_framebuffer( GLvisual *visual );
98
99 extern void gl_destroy_framebuffer( GLframebuffer *buffer );
100
101
102
103 extern void gl_make_current( GLcontext *ctx, GLframebuffer *buffer );
104
105 extern void gl_copy_context( GLcontext *src, GLcontext *dst, GLuint mask );
106
107
108
109 /*
110 * GL_MESA_resize_buffers extension
111 */
112 extern void gl_ResizeBuffersMESA( GLcontext *ctx );
113
114
115
116 /*
117 * Miscellaneous
118 */
119
120 extern void gl_problem( GLcontext *ctx, const char *s );
121
122 extern void gl_warning( GLcontext *ctx, const char *s );
123
124 extern void gl_error( GLcontext *ctx, GLenum error, const char *s );
125
126 extern GLenum gl_GetError( GLcontext *ctx );
127
128
129 extern void gl_update_state( GLcontext *ctx );
130
131
132
133 #ifdef PROFILE
134 extern GLdouble gl_time( void );
135 #endif
136
137
138 #endif