3 * Mesa 3-D graphics library
6 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 _mesa_Hint( GLenum target
, GLenum mode
)
39 GET_CURRENT_CONTEXT(ctx
);
40 ASSERT_OUTSIDE_BEGIN_END(ctx
);
42 if (MESA_VERBOSE
& VERBOSE_API
)
43 _mesa_debug(ctx
, "glHint %s %s\n",
44 _mesa_lookup_enum_by_nr(target
),
45 _mesa_lookup_enum_by_nr(mode
));
47 if (mode
!= GL_NICEST
&& mode
!= GL_FASTEST
&& mode
!= GL_DONT_CARE
) {
48 _mesa_error(ctx
, GL_INVALID_ENUM
, "glHint(mode)");
54 if (ctx
->Hint
.Fog
== mode
)
56 FLUSH_VERTICES(ctx
, _NEW_HINT
);
59 case GL_LINE_SMOOTH_HINT
:
60 if (ctx
->Hint
.LineSmooth
== mode
)
62 FLUSH_VERTICES(ctx
, _NEW_HINT
);
63 ctx
->Hint
.LineSmooth
= mode
;
65 case GL_PERSPECTIVE_CORRECTION_HINT
:
66 if (ctx
->Hint
.PerspectiveCorrection
== mode
)
68 FLUSH_VERTICES(ctx
, _NEW_HINT
);
69 ctx
->Hint
.PerspectiveCorrection
= mode
;
71 case GL_POINT_SMOOTH_HINT
:
72 if (ctx
->Hint
.PointSmooth
== mode
)
74 FLUSH_VERTICES(ctx
, _NEW_HINT
);
75 ctx
->Hint
.PointSmooth
= mode
;
77 case GL_POLYGON_SMOOTH_HINT
:
78 if (ctx
->Hint
.PolygonSmooth
== mode
)
80 FLUSH_VERTICES(ctx
, _NEW_HINT
);
81 ctx
->Hint
.PolygonSmooth
= mode
;
84 /* GL_EXT_clip_volume_hint */
85 case GL_CLIP_VOLUME_CLIPPING_HINT_EXT
:
86 if (ctx
->Hint
.ClipVolumeClipping
== mode
)
88 FLUSH_VERTICES(ctx
, _NEW_HINT
);
89 ctx
->Hint
.ClipVolumeClipping
= mode
;
93 _mesa_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
97 if (ctx
->Driver
.Hint
) {
98 (*ctx
->Driver
.Hint
)( ctx
, target
, mode
);
103 /**********************************************************************/
104 /***** Initialization *****/
105 /**********************************************************************/
107 void _mesa_init_hint( struct gl_context
* ctx
)
110 ctx
->Hint
.PerspectiveCorrection
= GL_DONT_CARE
;
111 ctx
->Hint
.PointSmooth
= GL_DONT_CARE
;
112 ctx
->Hint
.LineSmooth
= GL_DONT_CARE
;
113 ctx
->Hint
.PolygonSmooth
= GL_DONT_CARE
;
114 ctx
->Hint
.Fog
= GL_DONT_CARE
;
115 ctx
->Hint
.ClipVolumeClipping
= GL_DONT_CARE
;