1 /* $Id: hint.c,v 1.2 2000/03/17 15:32:04 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 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 (void) _mesa_try_Hint( ctx
, target
, mode
);
49 _mesa_try_Hint( GLcontext
*ctx
, GLenum target
, GLenum mode
)
51 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx
, "glHint", GL_FALSE
);
53 if (MESA_VERBOSE
& VERBOSE_API
)
54 fprintf(stderr
, "glHint %s %d\n", gl_lookup_enum_by_nr(target
), mode
);
56 if (mode
!= GL_NICEST
&& mode
!= GL_FASTEST
&& mode
!= GL_DONT_CARE
) {
57 gl_error(ctx
, GL_INVALID_ENUM
, "glHint(mode)");
65 case GL_LINE_SMOOTH_HINT
:
66 ctx
->Hint
.LineSmooth
= mode
;
68 case GL_PERSPECTIVE_CORRECTION_HINT
:
69 ctx
->Hint
.PerspectiveCorrection
= mode
;
71 case GL_POINT_SMOOTH_HINT
:
72 ctx
->Hint
.PointSmooth
= mode
;
74 case GL_POLYGON_SMOOTH_HINT
:
75 ctx
->Hint
.PolygonSmooth
= mode
;
77 case GL_PREFER_DOUBLEBUFFER_HINT_PGI
:
78 case GL_STRICT_DEPTHFUNC_HINT_PGI
:
80 case GL_STRICT_LIGHTING_HINT_PGI
:
81 ctx
->Hint
.StrictLighting
= mode
;
83 case GL_STRICT_SCISSOR_HINT_PGI
:
84 case GL_FULL_STIPPLE_HINT_PGI
:
85 case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI
:
86 case GL_NATIVE_GRAPHICS_END_HINT_PGI
:
87 case GL_CONSERVE_MEMORY_HINT_PGI
:
88 case GL_RECLAIM_MEMORY_HINT_PGI
:
90 case GL_ALWAYS_FAST_HINT_PGI
:
92 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
93 ctx
->Hint
.AllowDrawSpn
= GL_FALSE
;
94 ctx
->Hint
.AllowDrawMem
= GL_FALSE
;
96 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
97 ctx
->Hint
.AllowDrawSpn
= GL_TRUE
;
98 ctx
->Hint
.AllowDrawMem
= GL_TRUE
;
101 case GL_ALWAYS_SOFT_HINT_PGI
:
102 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
103 ctx
->Hint
.AllowDrawSpn
= GL_TRUE
;
104 ctx
->Hint
.AllowDrawMem
= GL_TRUE
;
106 case GL_ALLOW_DRAW_OBJ_HINT_PGI
:
108 case GL_ALLOW_DRAW_WIN_HINT_PGI
:
109 ctx
->Hint
.AllowDrawWin
= mode
;
111 case GL_ALLOW_DRAW_SPN_HINT_PGI
:
112 ctx
->Hint
.AllowDrawSpn
= mode
;
114 case GL_ALLOW_DRAW_MEM_HINT_PGI
:
115 ctx
->Hint
.AllowDrawMem
= mode
;
117 case GL_CLIP_NEAR_HINT_PGI
:
118 case GL_CLIP_FAR_HINT_PGI
:
119 case GL_WIDE_LINE_HINT_PGI
:
120 case GL_BACK_NORMALS_HINT_PGI
:
121 case GL_NATIVE_GRAPHICS_HANDLE_PGI
:
124 /* GL_EXT_clip_volume_hint */
125 case GL_CLIP_VOLUME_CLIPPING_HINT_EXT
:
126 ctx
->Hint
.ClipVolumeClipping
= mode
;
130 gl_error( ctx
, GL_INVALID_ENUM
, "glHint(target)" );
134 ctx
->NewState
|= NEW_ALL
; /* just to be safe */
136 if (ctx
->Driver
.Hint
) {
137 (*ctx
->Driver
.Hint
)( ctx
, target
, mode
);
145 _mesa_HintPGI( GLenum target
, GLint mode
)
147 GET_CURRENT_CONTEXT(ctx
);
148 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glHintPGI");
150 if (MESA_VERBOSE
& VERBOSE_API
)
151 fprintf(stderr
, "glHintPGI %s %d\n", gl_lookup_enum_by_nr(target
), mode
);
153 if (mode
!= GL_NICEST
&& mode
!= GL_FASTEST
&& mode
!= GL_DONT_CARE
) {
154 gl_error(ctx
, GL_INVALID_ENUM
, "glHintPGI(mode)");
159 case GL_PREFER_DOUBLEBUFFER_HINT_PGI
:
160 case GL_STRICT_DEPTHFUNC_HINT_PGI
:
161 case GL_STRICT_LIGHTING_HINT_PGI
:
162 case GL_STRICT_SCISSOR_HINT_PGI
:
163 case GL_FULL_STIPPLE_HINT_PGI
:
164 case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI
:
165 case GL_NATIVE_GRAPHICS_END_HINT_PGI
:
166 case GL_CONSERVE_MEMORY_HINT_PGI
:
167 case GL_RECLAIM_MEMORY_HINT_PGI
:
168 case GL_ALWAYS_FAST_HINT_PGI
:
169 case GL_ALWAYS_SOFT_HINT_PGI
:
170 case GL_ALLOW_DRAW_OBJ_HINT_PGI
:
171 case GL_ALLOW_DRAW_WIN_HINT_PGI
:
172 case GL_ALLOW_DRAW_SPN_HINT_PGI
:
173 case GL_ALLOW_DRAW_MEM_HINT_PGI
:
174 case GL_CLIP_NEAR_HINT_PGI
:
175 case GL_CLIP_FAR_HINT_PGI
:
176 case GL_WIDE_LINE_HINT_PGI
:
177 case GL_BACK_NORMALS_HINT_PGI
:
178 case GL_NATIVE_GRAPHICS_HANDLE_PGI
:
179 (void) _mesa_try_Hint(ctx
, target
, (GLenum
) mode
);
182 gl_error( ctx
, GL_INVALID_ENUM
, "glHintPGI(target)" );