1 /* $Id: hint.c,v 1.10 2001/05/21 16:41:03 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 _mesa_Hint( GLenum target
, GLenum mode
)
43 GET_CURRENT_CONTEXT(ctx
);
44 ASSERT_OUTSIDE_BEGIN_END(ctx
);
45 (void) _mesa_try_Hint( ctx
, target
, mode
);
50 _mesa_try_Hint( GLcontext
*ctx
, GLenum target
, GLenum mode
)
52 if (MESA_VERBOSE
& VERBOSE_API
)
53 fprintf(stderr
, "glHint %s %d\n", _mesa_lookup_enum_by_nr(target
), mode
);
55 if (mode
!= GL_NICEST
&& mode
!= GL_FASTEST
&& mode
!= GL_DONT_CARE
) {
56 _mesa_error(ctx
, GL_INVALID_ENUM
, "glHint(mode)");
62 if (ctx
->Hint
.Fog
== mode
)
64 FLUSH_VERTICES(ctx
, _NEW_HINT
);
67 case GL_LINE_SMOOTH_HINT
:
68 if (ctx
->Hint
.LineSmooth
== mode
)
70 FLUSH_VERTICES(ctx
, _NEW_HINT
);
71 ctx
->Hint
.LineSmooth
= mode
;
73 case GL_PERSPECTIVE_CORRECTION_HINT
:
74 if (ctx
->Hint
.PerspectiveCorrection
== mode
)
76 FLUSH_VERTICES(ctx
, _NEW_HINT
);
77 ctx
->Hint
.PerspectiveCorrection
= mode
;
79 case GL_POINT_SMOOTH_HINT
:
80 if (ctx
->Hint
.PointSmooth
== mode
)
82 FLUSH_VERTICES(ctx
, _NEW_HINT
);
83 ctx
->Hint
.PointSmooth
= mode
;
85 case GL_POLYGON_SMOOTH_HINT
:
86 if (ctx
->Hint
.PolygonSmooth
== mode
)
88 FLUSH_VERTICES(ctx
, _NEW_HINT
);
89 ctx
->Hint
.PolygonSmooth
= mode
;
92 /* GL_EXT_clip_volume_hint */
93 case GL_CLIP_VOLUME_CLIPPING_HINT_EXT
:
94 if (ctx
->Hint
.ClipVolumeClipping
== mode
)
96 FLUSH_VERTICES(ctx
, _NEW_HINT
);
97 ctx
->Hint
.ClipVolumeClipping
= mode
;
100 /* GL_ARB_texture_compression */
101 case GL_TEXTURE_COMPRESSION_HINT_ARB
:
102 if (!ctx
->Extensions
.ARB_texture_compression
) {
103 _mesa_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
106 if (ctx
->Hint
.TextureCompression
== mode
)
108 FLUSH_VERTICES(ctx
, _NEW_HINT
);
109 ctx
->Hint
.TextureCompression
= mode
;
112 /* GL_SGIS_generate_mipmap */
113 case GL_GENERATE_MIPMAP_HINT_SGIS
:
114 if (!ctx
->Extensions
.SGIS_generate_mipmap
) {
115 _mesa_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
118 if (ctx
->Hint
.GenerateMipmap
== mode
)
120 FLUSH_VERTICES(ctx
, _NEW_HINT
);
121 ctx
->Hint
.GenerateMipmap
= mode
;
125 _mesa_error(ctx
, GL_INVALID_ENUM
, "glHint(target)");
129 if (ctx
->Driver
.Hint
) {
130 (*ctx
->Driver
.Hint
)( ctx
, target
, mode
);