79bf5679d8a04515f8a21f2fd9d171ec91424c72
2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 * \param width line width in pixels.
41 _mesa_LineWidth( GLfloat width
)
43 GET_CURRENT_CONTEXT(ctx
);
44 ASSERT_OUTSIDE_BEGIN_END(ctx
);
46 if (MESA_VERBOSE
& VERBOSE_API
)
47 _mesa_debug(ctx
, "glLineWidth %f\n", width
);
50 _mesa_error( ctx
, GL_INVALID_VALUE
, "glLineWidth" );
54 if (ctx
->Line
.Width
== width
)
57 FLUSH_VERTICES(ctx
, _NEW_LINE
);
58 ctx
->Line
.Width
= width
;
60 if (ctx
->Driver
.LineWidth
)
61 ctx
->Driver
.LineWidth(ctx
, width
);
66 * Set the line stipple pattern.
68 * \param factor pattern scale factor.
69 * \param pattern bit pattern.
71 * \sa glLineStipple().
73 * Updates gl_line_attrib::StippleFactor and gl_line_attrib::StipplePattern. On
74 * change flushes the vertices and notifies the driver via
75 * the dd_function_table::LineStipple callback.
78 _mesa_LineStipple( GLint factor
, GLushort pattern
)
80 GET_CURRENT_CONTEXT(ctx
);
81 ASSERT_OUTSIDE_BEGIN_END(ctx
);
83 if (MESA_VERBOSE
& VERBOSE_API
)
84 _mesa_debug(ctx
, "glLineStipple %d %u\n", factor
, pattern
);
86 factor
= CLAMP( factor
, 1, 256 );
88 if (ctx
->Line
.StippleFactor
== factor
&&
89 ctx
->Line
.StipplePattern
== pattern
)
92 FLUSH_VERTICES(ctx
, _NEW_LINE
);
93 ctx
->Line
.StippleFactor
= factor
;
94 ctx
->Line
.StipplePattern
= pattern
;
96 if (ctx
->Driver
.LineStipple
)
97 ctx
->Driver
.LineStipple( ctx
, factor
, pattern
);
102 * Initialize the context line state.
104 * \param ctx GL context.
106 * Initializes __struct gl_contextRec::Line and line related constants in
107 * __struct gl_contextRec::Const.
110 _mesa_init_line( struct gl_context
* ctx
)
112 ctx
->Line
.SmoothFlag
= GL_FALSE
;
113 ctx
->Line
.StippleFlag
= GL_FALSE
;
114 ctx
->Line
.Width
= 1.0;
115 ctx
->Line
.StipplePattern
= 0xffff;
116 ctx
->Line
.StippleFactor
= 1;