1 /* $Id: hint.c,v 1.1 2000/02/02 19:14:56 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
);
60 case GL_LINE_SMOOTH_HINT
:
61 ctx
->Hint
.LineSmooth
= mode
;
63 case GL_PERSPECTIVE_CORRECTION_HINT
:
64 ctx
->Hint
.PerspectiveCorrection
= mode
;
66 case GL_POINT_SMOOTH_HINT
:
67 ctx
->Hint
.PointSmooth
= mode
;
69 case GL_POLYGON_SMOOTH_HINT
:
70 ctx
->Hint
.PolygonSmooth
= mode
;
72 case GL_PREFER_DOUBLEBUFFER_HINT_PGI
:
73 case GL_STRICT_DEPTHFUNC_HINT_PGI
:
75 case GL_STRICT_LIGHTING_HINT_PGI
:
76 ctx
->Hint
.StrictLighting
= mode
;
78 case GL_STRICT_SCISSOR_HINT_PGI
:
79 case GL_FULL_STIPPLE_HINT_PGI
:
80 case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI
:
81 case GL_NATIVE_GRAPHICS_END_HINT_PGI
:
82 case GL_CONSERVE_MEMORY_HINT_PGI
:
83 case GL_RECLAIM_MEMORY_HINT_PGI
:
85 case GL_ALWAYS_FAST_HINT_PGI
:
87 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
88 ctx
->Hint
.AllowDrawSpn
= GL_FALSE
;
89 ctx
->Hint
.AllowDrawMem
= GL_FALSE
;
91 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
92 ctx
->Hint
.AllowDrawSpn
= GL_TRUE
;
93 ctx
->Hint
.AllowDrawMem
= GL_TRUE
;
96 case GL_ALWAYS_SOFT_HINT_PGI
:
97 ctx
->Hint
.AllowDrawWin
= GL_TRUE
;
98 ctx
->Hint
.AllowDrawSpn
= GL_TRUE
;
99 ctx
->Hint
.AllowDrawMem
= GL_TRUE
;
101 case GL_ALLOW_DRAW_OBJ_HINT_PGI
:
103 case GL_ALLOW_DRAW_WIN_HINT_PGI
:
104 ctx
->Hint
.AllowDrawWin
= mode
;
106 case GL_ALLOW_DRAW_SPN_HINT_PGI
:
107 ctx
->Hint
.AllowDrawSpn
= mode
;
109 case GL_ALLOW_DRAW_MEM_HINT_PGI
:
110 ctx
->Hint
.AllowDrawMem
= mode
;
112 case GL_CLIP_NEAR_HINT_PGI
:
113 case GL_CLIP_FAR_HINT_PGI
:
114 case GL_WIDE_LINE_HINT_PGI
:
115 case GL_BACK_NORMALS_HINT_PGI
:
116 case GL_NATIVE_GRAPHICS_HANDLE_PGI
:
119 /* GL_EXT_clip_volume_hint */
120 case GL_CLIP_VOLUME_CLIPPING_HINT_EXT
:
121 ctx
->Hint
.ClipVolumeClipping
= mode
;
125 gl_error( ctx
, GL_INVALID_ENUM
, "glHint(target)" );
128 ctx
->NewState
|= NEW_ALL
; /* just to be safe */
130 if (ctx
->Driver
.Hint
) {
131 (*ctx
->Driver
.Hint
)( ctx
, target
, mode
);
139 _mesa_HintPGI( GLenum target
, GLint mode
)
141 GET_CURRENT_CONTEXT(ctx
);
142 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glHintPGI");
144 if (MESA_VERBOSE
& VERBOSE_API
)
145 fprintf(stderr
, "glHintPGI %s %d\n", gl_lookup_enum_by_nr(target
), mode
);
148 case GL_PREFER_DOUBLEBUFFER_HINT_PGI
:
149 case GL_STRICT_DEPTHFUNC_HINT_PGI
:
150 case GL_STRICT_LIGHTING_HINT_PGI
:
151 case GL_STRICT_SCISSOR_HINT_PGI
:
152 case GL_FULL_STIPPLE_HINT_PGI
:
153 case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI
:
154 case GL_NATIVE_GRAPHICS_END_HINT_PGI
:
155 case GL_CONSERVE_MEMORY_HINT_PGI
:
156 case GL_RECLAIM_MEMORY_HINT_PGI
:
157 case GL_ALWAYS_FAST_HINT_PGI
:
158 case GL_ALWAYS_SOFT_HINT_PGI
:
159 case GL_ALLOW_DRAW_OBJ_HINT_PGI
:
160 case GL_ALLOW_DRAW_WIN_HINT_PGI
:
161 case GL_ALLOW_DRAW_SPN_HINT_PGI
:
162 case GL_ALLOW_DRAW_MEM_HINT_PGI
:
163 case GL_CLIP_NEAR_HINT_PGI
:
164 case GL_CLIP_FAR_HINT_PGI
:
165 case GL_WIDE_LINE_HINT_PGI
:
166 case GL_BACK_NORMALS_HINT_PGI
:
167 case GL_NATIVE_GRAPHICS_HANDLE_PGI
:
168 (void) _mesa_try_Hint(ctx
, target
, (GLenum
) mode
);
171 gl_error( ctx
, GL_INVALID_ENUM
, "glHintPGI(target)" );