1 /* $Id: lines.c,v 1.10 2000/05/10 22:36:05 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999 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.
47 _mesa_LineWidth( GLfloat width
)
49 GET_CURRENT_CONTEXT(ctx
);
51 gl_error( ctx
, GL_INVALID_VALUE
, "glLineWidth" );
54 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glLineWidth");
56 if (ctx
->Line
.Width
!= width
) {
57 ctx
->Line
.Width
= width
;
58 ctx
->TriangleCaps
&= ~DD_LINE_WIDTH
;
59 if (width
!= 1.0) ctx
->TriangleCaps
|= DD_LINE_WIDTH
;
60 ctx
->NewState
|= NEW_RASTER_OPS
;
61 if (ctx
->Driver
.LineWidth
)
62 (*ctx
->Driver
.LineWidth
)(ctx
, width
);
69 _mesa_LineStipple( GLint factor
, GLushort pattern
)
71 GET_CURRENT_CONTEXT(ctx
);
72 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glLineStipple");
73 ctx
->Line
.StippleFactor
= CLAMP( factor
, 1, 256 );
74 ctx
->Line
.StipplePattern
= pattern
;
75 ctx
->NewState
|= NEW_RASTER_OPS
;
77 if (ctx
->Driver
.LineStipple
)
78 ctx
->Driver
.LineStipple( ctx
, factor
, pattern
);
83 /**********************************************************************/
84 /***** Rasterization *****/
85 /**********************************************************************/
89 * There are 4 pairs (RGBA, CI) of line drawing functions:
90 * 1. simple: width=1 and no special rasterization functions (fastest)
91 * 2. flat: width=1, non-stippled, flat-shaded, any raster operations
92 * 3. smooth: width=1, non-stippled, smooth-shaded, any raster operations
93 * 4. general: any other kind of line (slowest)
98 * All line drawing functions have the same arguments:
99 * v1, v2 - indexes of first and second endpoints into vertex buffer arrays
100 * pv - provoking vertex: which vertex color/index to use for flat shading.
108 #if MAX_WIDTH > MAX_HEIGHT
109 # define MAXPOINTS MAX_WIDTH
111 # define MAXPOINTS MAX_HEIGHT
115 /* Flat, color index line */
116 static void flat_ci_line( GLcontext
*ctx
,
117 GLuint vert0
, GLuint vert1
, GLuint pvert
)
119 PB_SET_INDEX( ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
122 #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0);
124 #include "linetemp.h"
131 /* Flat, color index line with Z interpolation/testing */
132 static void flat_ci_z_line( GLcontext
*ctx
,
133 GLuint vert0
, GLuint vert1
, GLuint pvert
)
135 PB_SET_INDEX( ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
139 #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
141 #include "linetemp.h"
148 /* Flat-shaded, RGBA line */
149 static void flat_rgba_line( GLcontext
*ctx
,
150 GLuint vert0
, GLuint vert1
, GLuint pvert
)
152 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
153 PB_SET_COLOR( ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
156 #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0);
158 #include "linetemp.h"
165 /* Flat-shaded, RGBA line with Z interpolation/testing */
166 static void flat_rgba_z_line( GLcontext
*ctx
,
167 GLuint vert0
, GLuint vert1
, GLuint pvert
)
169 const GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
170 PB_SET_COLOR( ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
174 #define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
176 #include "linetemp.h"
183 /* Smooth shaded, color index line */
184 static void smooth_ci_line( GLcontext
*ctx
,
185 GLuint vert0
, GLuint vert1
, GLuint pvert
)
187 GLint count
= ctx
->PB
->count
;
188 GLint
*pbx
= ctx
->PB
->x
;
189 GLint
*pby
= ctx
->PB
->y
;
190 GLuint
*pbi
= ctx
->PB
->index
;
193 ctx
->PB
->mono
= GL_FALSE
;
196 #define INTERP_INDEX 1
204 #include "linetemp.h"
206 ctx
->PB
->count
= count
;
212 /* Smooth shaded, color index line with Z interpolation/testing */
213 static void smooth_ci_z_line( GLcontext
*ctx
,
214 GLuint vert0
, GLuint vert1
, GLuint pvert
)
216 GLint count
= ctx
->PB
->count
;
217 GLint
*pbx
= ctx
->PB
->x
;
218 GLint
*pby
= ctx
->PB
->y
;
219 GLdepth
*pbz
= ctx
->PB
->z
;
220 GLuint
*pbi
= ctx
->PB
->index
;
223 ctx
->PB
->mono
= GL_FALSE
;
227 #define INTERP_INDEX 1
236 #include "linetemp.h"
238 ctx
->PB
->count
= count
;
244 /* Smooth-shaded, RGBA line */
245 static void smooth_rgba_line( GLcontext
*ctx
,
246 GLuint vert0
, GLuint vert1
, GLuint pvert
)
248 GLint count
= ctx
->PB
->count
;
249 GLint
*pbx
= ctx
->PB
->x
;
250 GLint
*pby
= ctx
->PB
->y
;
251 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
254 ctx
->PB
->mono
= GL_FALSE
;
258 #define INTERP_ALPHA 1
263 pbrgba[count][RCOMP] = FixedToInt(r0); \
264 pbrgba[count][GCOMP] = FixedToInt(g0); \
265 pbrgba[count][BCOMP] = FixedToInt(b0); \
266 pbrgba[count][ACOMP] = FixedToInt(a0); \
269 #include "linetemp.h"
271 ctx
->PB
->count
= count
;
277 /* Smooth-shaded, RGBA line with Z interpolation/testing */
278 static void smooth_rgba_z_line( GLcontext
*ctx
,
279 GLuint vert0
, GLuint vert1
, GLuint pvert
)
281 GLint count
= ctx
->PB
->count
;
282 GLint
*pbx
= ctx
->PB
->x
;
283 GLint
*pby
= ctx
->PB
->y
;
284 GLdepth
*pbz
= ctx
->PB
->z
;
285 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
288 ctx
->PB
->mono
= GL_FALSE
;
293 #define INTERP_ALPHA 1
299 pbrgba[count][RCOMP] = FixedToInt(r0); \
300 pbrgba[count][GCOMP] = FixedToInt(g0); \
301 pbrgba[count][BCOMP] = FixedToInt(b0); \
302 pbrgba[count][ACOMP] = FixedToInt(a0); \
305 #include "linetemp.h"
307 ctx
->PB
->count
= count
;
312 #define CHECK_FULL(count) \
313 if (count >= PB_SIZE-MAX_WIDTH) { \
314 ctx->PB->count = count; \
316 count = ctx->PB->count; \
321 /* Smooth shaded, color index, any width, maybe stippled */
322 static void general_smooth_ci_line( GLcontext
*ctx
,
323 GLuint vert0
, GLuint vert1
, GLuint pvert
)
325 GLint count
= ctx
->PB
->count
;
326 GLint
*pbx
= ctx
->PB
->x
;
327 GLint
*pby
= ctx
->PB
->y
;
328 GLdepth
*pbz
= ctx
->PB
->z
;
329 GLuint
*pbi
= ctx
->PB
->index
;
332 ctx
->PB
->mono
= GL_FALSE
;
334 if (ctx
->Line
.StippleFlag
) {
338 #define INTERP_INDEX 1
348 #include "linetemp.h"
352 if (ctx
->Line
.Width
==2.0F
) {
353 /* special case: unstippled and width=2 */
356 #define INTERP_INDEX 1
357 #define XMAJOR_PLOT(X,Y) \
358 pbx[count] = X; pbx[count+1] = X; \
359 pby[count] = Y; pby[count+1] = Y+1; \
360 pbz[count] = Z; pbz[count+1] = Z; \
361 pbi[count] = I; pbi[count+1] = I; \
364 #define YMAJOR_PLOT(X,Y) \
365 pbx[count] = X; pbx[count+1] = X+1; \
366 pby[count] = Y; pby[count+1] = Y; \
367 pbz[count] = Z; pbz[count+1] = Z; \
368 pbi[count] = I; pbi[count+1] = I; \
371 #include "linetemp.h"
374 /* unstippled, any width */
377 #define INTERP_INDEX 1
386 #include "linetemp.h"
390 ctx
->PB
->count
= count
;
395 /* Flat shaded, color index, any width, maybe stippled */
396 static void general_flat_ci_line( GLcontext
*ctx
,
397 GLuint vert0
, GLuint vert1
, GLuint pvert
)
400 GLint
*pbx
= ctx
->PB
->x
;
401 GLint
*pby
= ctx
->PB
->y
;
402 GLdepth
*pbz
= ctx
->PB
->z
;
403 PB_SET_INDEX( ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
404 count
= ctx
->PB
->count
;
406 if (ctx
->Line
.StippleFlag
) {
407 /* stippled, any width */
418 #include "linetemp.h"
422 if (ctx
->Line
.Width
==2.0F
) {
423 /* special case: unstippled and width=2 */
426 #define XMAJOR_PLOT(X,Y) \
427 pbx[count] = X; pbx[count+1] = X; \
428 pby[count] = Y; pby[count+1] = Y+1; \
429 pbz[count] = Z; pbz[count+1] = Z; \
432 #define YMAJOR_PLOT(X,Y) \
433 pbx[count] = X; pbx[count+1] = X+1; \
434 pby[count] = Y; pby[count+1] = Y; \
435 pbz[count] = Z; pbz[count+1] = Z; \
438 #include "linetemp.h"
441 /* unstippled, any width */
451 #include "linetemp.h"
455 ctx
->PB
->count
= count
;
461 static void general_smooth_rgba_line( GLcontext
*ctx
,
462 GLuint vert0
, GLuint vert1
, GLuint pvert
)
464 GLint count
= ctx
->PB
->count
;
465 GLint
*pbx
= ctx
->PB
->x
;
466 GLint
*pby
= ctx
->PB
->y
;
467 GLdepth
*pbz
= ctx
->PB
->z
;
468 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
471 ctx
->PB
->mono
= GL_FALSE
;
473 if (ctx
->Line
.StippleFlag
) {
478 #define INTERP_ALPHA 1
485 pbrgba[count][RCOMP] = FixedToInt(r0); \
486 pbrgba[count][GCOMP] = FixedToInt(g0); \
487 pbrgba[count][BCOMP] = FixedToInt(b0); \
488 pbrgba[count][ACOMP] = FixedToInt(a0); \
491 #include "linetemp.h"
495 if (ctx
->Line
.Width
==2.0F
) {
496 /* special case: unstippled and width=2 */
500 #define INTERP_ALPHA 1
501 #define XMAJOR_PLOT(X,Y) \
502 pbx[count] = X; pbx[count+1] = X; \
503 pby[count] = Y; pby[count+1] = Y+1; \
504 pbz[count] = Z; pbz[count+1] = Z; \
505 pbrgba[count][RCOMP] = FixedToInt(r0); \
506 pbrgba[count][GCOMP] = FixedToInt(g0); \
507 pbrgba[count][BCOMP] = FixedToInt(b0); \
508 pbrgba[count][ACOMP] = FixedToInt(a0); \
509 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
510 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
511 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
512 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
515 #define YMAJOR_PLOT(X,Y) \
516 pbx[count] = X; pbx[count+1] = X+1; \
517 pby[count] = Y; pby[count+1] = Y; \
518 pbz[count] = Z; pbz[count+1] = Z; \
519 pbrgba[count][RCOMP] = FixedToInt(r0); \
520 pbrgba[count][GCOMP] = FixedToInt(g0); \
521 pbrgba[count][BCOMP] = FixedToInt(b0); \
522 pbrgba[count][ACOMP] = FixedToInt(a0); \
523 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
524 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
525 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
526 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
529 #include "linetemp.h"
532 /* unstippled, any width */
536 #define INTERP_ALPHA 1
542 pbrgba[count][RCOMP] = FixedToInt(r0); \
543 pbrgba[count][GCOMP] = FixedToInt(g0); \
544 pbrgba[count][BCOMP] = FixedToInt(b0); \
545 pbrgba[count][ACOMP] = FixedToInt(a0); \
548 #include "linetemp.h"
552 ctx
->PB
->count
= count
;
557 static void general_flat_rgba_line( GLcontext
*ctx
,
558 GLuint vert0
, GLuint vert1
, GLuint pvert
)
561 GLint
*pbx
= ctx
->PB
->x
;
562 GLint
*pby
= ctx
->PB
->y
;
563 GLdepth
*pbz
= ctx
->PB
->z
;
564 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
565 PB_SET_COLOR( ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
566 count
= ctx
->PB
->count
;
568 if (ctx
->Line
.StippleFlag
) {
580 #include "linetemp.h"
584 if (ctx
->Line
.Width
==2.0F
) {
585 /* special case: unstippled and width=2 */
588 #define XMAJOR_PLOT(X,Y) \
589 pbx[count] = X; pbx[count+1] = X; \
590 pby[count] = Y; pby[count+1] = Y+1; \
591 pbz[count] = Z; pbz[count+1] = Z; \
594 #define YMAJOR_PLOT(X,Y) \
595 pbx[count] = X; pbx[count+1] = X+1; \
596 pby[count] = Y; pby[count+1] = Y; \
597 pbz[count] = Z; pbz[count+1] = Z; \
600 #include "linetemp.h"
603 /* unstippled, any width */
613 #include "linetemp.h"
617 ctx
->PB
->count
= count
;
622 /* Flat-shaded, textured, any width, maybe stippled */
623 static void flat_textured_line( GLcontext
*ctx
,
624 GLuint vert0
, GLuint vert1
, GLuint pv
)
627 GLint
*pbx
= ctx
->PB
->x
;
628 GLint
*pby
= ctx
->PB
->y
;
629 GLdepth
*pbz
= ctx
->PB
->z
;
630 GLfloat
*pbs
= ctx
->PB
->s
[0];
631 GLfloat
*pbt
= ctx
->PB
->t
[0];
632 GLfloat
*pbu
= ctx
->PB
->u
[0];
633 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
634 PB_SET_COLOR( ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
635 count
= ctx
->PB
->count
;
637 if (ctx
->Line
.StippleFlag
) {
641 #define INTERP_STUV0 1
655 #include "linetemp.h"
661 #define INTERP_STUV0 1
674 #include "linetemp.h"
677 ctx
->PB
->count
= count
;
683 /* Smooth-shaded, textured, any width, maybe stippled */
684 static void smooth_textured_line( GLcontext
*ctx
,
685 GLuint vert0
, GLuint vert1
, GLuint pvert
)
687 GLint count
= ctx
->PB
->count
;
688 GLint
*pbx
= ctx
->PB
->x
;
689 GLint
*pby
= ctx
->PB
->y
;
690 GLdepth
*pbz
= ctx
->PB
->z
;
691 GLfloat
*pbs
= ctx
->PB
->s
[0];
692 GLfloat
*pbt
= ctx
->PB
->t
[0];
693 GLfloat
*pbu
= ctx
->PB
->u
[0];
694 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
697 ctx
->PB
->mono
= GL_FALSE
;
699 if (ctx
->Line
.StippleFlag
) {
704 #define INTERP_ALPHA 1
705 #define INTERP_STUV0 1
716 pbrgba[count][RCOMP] = FixedToInt(r0); \
717 pbrgba[count][GCOMP] = FixedToInt(g0); \
718 pbrgba[count][BCOMP] = FixedToInt(b0); \
719 pbrgba[count][ACOMP] = FixedToInt(a0); \
723 #include "linetemp.h"
730 #define INTERP_ALPHA 1
731 #define INTERP_STUV0 1
741 pbrgba[count][RCOMP] = FixedToInt(r0); \
742 pbrgba[count][GCOMP] = FixedToInt(g0); \
743 pbrgba[count][BCOMP] = FixedToInt(b0); \
744 pbrgba[count][ACOMP] = FixedToInt(a0); \
748 #include "linetemp.h"
751 ctx
->PB
->count
= count
;
756 /* Smooth-shaded, multitextured, any width, maybe stippled, separate specular
757 * color interpolation.
759 static void smooth_multitextured_line( GLcontext
*ctx
,
760 GLuint vert0
, GLuint vert1
, GLuint pvert
)
762 GLint count
= ctx
->PB
->count
;
763 GLint
*pbx
= ctx
->PB
->x
;
764 GLint
*pby
= ctx
->PB
->y
;
765 GLdepth
*pbz
= ctx
->PB
->z
;
766 GLfloat
*pbs
= ctx
->PB
->s
[0];
767 GLfloat
*pbt
= ctx
->PB
->t
[0];
768 GLfloat
*pbu
= ctx
->PB
->u
[0];
769 GLfloat
*pbs1
= ctx
->PB
->s
[1];
770 GLfloat
*pbt1
= ctx
->PB
->t
[1];
771 GLfloat
*pbu1
= ctx
->PB
->u
[1];
772 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
773 GLubyte (*pbspec
)[3] = ctx
->PB
->spec
;
776 ctx
->PB
->mono
= GL_FALSE
;
778 if (ctx
->Line
.StippleFlag
) {
783 #define INTERP_SPEC 1
784 #define INTERP_ALPHA 1
785 #define INTERP_STUV0 1
786 #define INTERP_STUV1 1
800 pbrgba[count][RCOMP] = FixedToInt(r0); \
801 pbrgba[count][GCOMP] = FixedToInt(g0); \
802 pbrgba[count][BCOMP] = FixedToInt(b0); \
803 pbrgba[count][ACOMP] = FixedToInt(a0); \
804 pbspec[count][RCOMP] = FixedToInt(sr0); \
805 pbspec[count][GCOMP] = FixedToInt(sg0); \
806 pbspec[count][BCOMP] = FixedToInt(sb0); \
810 #include "linetemp.h"
817 #define INTERP_SPEC 1
818 #define INTERP_ALPHA 1
819 #define INTERP_STUV0 1
820 #define INTERP_STUV1 1
833 pbrgba[count][RCOMP] = FixedToInt(r0); \
834 pbrgba[count][GCOMP] = FixedToInt(g0); \
835 pbrgba[count][BCOMP] = FixedToInt(b0); \
836 pbrgba[count][ACOMP] = FixedToInt(a0); \
837 pbspec[count][RCOMP] = FixedToInt(sr0); \
838 pbspec[count][GCOMP] = FixedToInt(sg0); \
839 pbspec[count][BCOMP] = FixedToInt(sb0); \
843 #include "linetemp.h"
846 ctx
->PB
->count
= count
;
852 * Antialiased RGBA line
854 * This AA line function isn't terribly efficient but it's pretty
855 * straight-forward to understand. Also, it doesn't exactly conform
856 * to the specification.
858 static void aa_rgba_line( GLcontext
*ctx
,
859 GLuint vert0
, GLuint vert1
, GLuint pvert
)
861 #define INTERP_RGBA 1
862 #define PLOT(x, y) { PB_WRITE_RGBA_PIXEL( pb, (x), (y), z, red, green, blue, coverage ); }
863 #include "lnaatemp.h"
867 * Antialiased Textured RGBA line
869 * This AA line function isn't terribly efficient but it's pretty
870 * straight-forward to understand. Also, it doesn't exactly conform
871 * to the specification.
873 static void aa_tex_rgba_line( GLcontext
*ctx
,
874 GLuint vert0
, GLuint vert1
, GLuint pvert
)
876 #define INTERP_RGBA 1
877 #define INTERP_STUV0 1
880 PB_WRITE_TEX_PIXEL( pb, (x), (y), z, red, green, blue, coverage, \
883 #include "lnaatemp.h"
888 * Antialiased Multitextured RGBA line
890 * This AA line function isn't terribly efficient but it's pretty
891 * straight-forward to understand. Also, it doesn't exactly conform
892 * to the specification.
894 static void aa_multitex_rgba_line( GLcontext
*ctx
,
895 GLuint vert0
, GLuint vert1
, GLuint pvert
)
897 #define INTERP_RGBA 1
898 #define INTERP_SPEC 1
899 #define INTERP_STUV0 1
900 #define INTERP_STUV1 1
903 PB_WRITE_MULTITEX_SPEC_PIXEL( pb, (x), (y), z, \
904 red, green, blue, coverage, specRed, specGreen, specBlue, \
905 s, t, u, s1, t1, u1 ); \
907 #include "lnaatemp.h"
912 * Antialiased CI line. Same comments for RGBA antialiased lines apply.
914 static void aa_ci_line( GLcontext
*ctx
,
915 GLuint vert0
, GLuint vert1
, GLuint pvert
)
917 #define INTERP_INDEX 1
920 PB_WRITE_CI_PIXEL( pb, (x), (y), z, index + coverage ); \
922 #include "lnaatemp.h"
927 * Null rasterizer for measuring transformation speed.
929 static void null_line( GLcontext
*ctx
, GLuint v1
, GLuint v2
, GLuint pv
)
939 * Determine which line drawing function to use given the current
942 void gl_set_line_function( GLcontext
*ctx
)
944 GLboolean rgbmode
= ctx
->Visual
->RGBAflag
;
945 /* TODO: antialiased lines */
947 if (ctx
->RenderMode
==GL_RENDER
) {
949 ctx
->Driver
.LineFunc
= null_line
;
952 if (ctx
->Driver
.LineFunc
) {
953 /* Device driver will draw lines. */
957 if (ctx
->Line
.SmoothFlag
) {
958 /* antialiased lines */
960 if (ctx
->Texture
.ReallyEnabled
) {
961 if (ctx
->Texture
.ReallyEnabled
>= TEXTURE1_1D
962 || ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
)
964 ctx
->Driver
.LineFunc
= aa_multitex_rgba_line
;
966 ctx
->Driver
.LineFunc
= aa_tex_rgba_line
;
968 ctx
->Driver
.LineFunc
= aa_rgba_line
;
972 ctx
->Driver
.LineFunc
= aa_ci_line
;
975 else if (ctx
->Texture
.ReallyEnabled
) {
976 if (ctx
->Texture
.ReallyEnabled
>= TEXTURE1_1D
977 || ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
) {
978 /* multi-texture and/or separate specular color */
979 ctx
->Driver
.LineFunc
= smooth_multitextured_line
;
982 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
983 ctx
->Driver
.LineFunc
= smooth_textured_line
;
986 ctx
->Driver
.LineFunc
= flat_textured_line
;
990 else if (ctx
->Line
.Width
!=1.0 || ctx
->Line
.StippleFlag
991 || ctx
->Line
.SmoothFlag
) {
992 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
994 ctx
->Driver
.LineFunc
= general_smooth_rgba_line
;
996 ctx
->Driver
.LineFunc
= general_smooth_ci_line
;
1000 ctx
->Driver
.LineFunc
= general_flat_rgba_line
;
1002 ctx
->Driver
.LineFunc
= general_flat_ci_line
;
1006 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1007 /* Width==1, non-stippled, smooth-shaded */
1008 if (ctx
->Depth
.Test
|| ctx
->FogMode
== FOG_FRAGMENT
) {
1010 ctx
->Driver
.LineFunc
= smooth_rgba_z_line
;
1012 ctx
->Driver
.LineFunc
= smooth_ci_z_line
;
1016 ctx
->Driver
.LineFunc
= smooth_rgba_line
;
1018 ctx
->Driver
.LineFunc
= smooth_ci_line
;
1022 /* Width==1, non-stippled, flat-shaded */
1023 if (ctx
->Depth
.Test
|| ctx
->FogMode
== FOG_FRAGMENT
) {
1025 ctx
->Driver
.LineFunc
= flat_rgba_z_line
;
1027 ctx
->Driver
.LineFunc
= flat_ci_z_line
;
1031 ctx
->Driver
.LineFunc
= flat_rgba_line
;
1033 ctx
->Driver
.LineFunc
= flat_ci_line
;
1038 else if (ctx
->RenderMode
==GL_FEEDBACK
) {
1039 ctx
->Driver
.LineFunc
= gl_feedback_line
;
1042 /* GL_SELECT mode */
1043 ctx
->Driver
.LineFunc
= gl_select_line
;