1 /* $Id: lines.c,v 1.9 2000/03/03 18:55:45 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
)
120 GLint
*pbx
= ctx
->PB
->x
;
121 GLint
*pby
= ctx
->PB
->y
;
122 PB_SET_INDEX( ctx
, ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
123 count
= ctx
->PB
->count
;
132 #include "linetemp.h"
134 ctx
->PB
->count
= count
;
140 /* Flat, color index line with Z interpolation/testing */
141 static void flat_ci_z_line( GLcontext
*ctx
,
142 GLuint vert0
, GLuint vert1
, GLuint pvert
)
145 GLint
*pbx
= ctx
->PB
->x
;
146 GLint
*pby
= ctx
->PB
->y
;
147 GLdepth
*pbz
= ctx
->PB
->z
;
148 PB_SET_INDEX( ctx
, ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
149 count
= ctx
->PB
->count
;
160 #include "linetemp.h"
162 ctx
->PB
->count
= count
;
168 /* Flat-shaded, RGBA line */
169 static void flat_rgba_line( GLcontext
*ctx
,
170 GLuint vert0
, GLuint vert1
, GLuint pvert
)
173 GLint
*pbx
= ctx
->PB
->x
;
174 GLint
*pby
= ctx
->PB
->y
;
175 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
176 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
177 count
= ctx
->PB
->count
;
186 #include "linetemp.h"
188 ctx
->PB
->count
= count
;
194 /* Flat-shaded, RGBA line with Z interpolation/testing */
195 static void flat_rgba_z_line( GLcontext
*ctx
,
196 GLuint vert0
, GLuint vert1
, GLuint pvert
)
199 GLint
*pbx
= ctx
->PB
->x
;
200 GLint
*pby
= ctx
->PB
->y
;
201 GLdepth
*pbz
= ctx
->PB
->z
;
202 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
203 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
204 count
= ctx
->PB
->count
;
215 #include "linetemp.h"
217 ctx
->PB
->count
= count
;
223 /* Smooth shaded, color index line */
224 static void smooth_ci_line( GLcontext
*ctx
,
225 GLuint vert0
, GLuint vert1
, GLuint pvert
)
227 GLint count
= ctx
->PB
->count
;
228 GLint
*pbx
= ctx
->PB
->x
;
229 GLint
*pby
= ctx
->PB
->y
;
230 GLuint
*pbi
= ctx
->PB
->i
;
234 #define INTERP_INDEX 1
242 #include "linetemp.h"
244 ctx
->PB
->count
= count
;
250 /* Smooth shaded, color index line with Z interpolation/testing */
251 static void smooth_ci_z_line( GLcontext
*ctx
,
252 GLuint vert0
, GLuint vert1
, GLuint pvert
)
254 GLint count
= ctx
->PB
->count
;
255 GLint
*pbx
= ctx
->PB
->x
;
256 GLint
*pby
= ctx
->PB
->y
;
257 GLdepth
*pbz
= ctx
->PB
->z
;
258 GLuint
*pbi
= ctx
->PB
->i
;
263 #define INTERP_INDEX 1
272 #include "linetemp.h"
274 ctx
->PB
->count
= count
;
280 /* Smooth-shaded, RGBA line */
281 static void smooth_rgba_line( GLcontext
*ctx
,
282 GLuint vert0
, GLuint vert1
, GLuint pvert
)
284 GLint count
= ctx
->PB
->count
;
285 GLint
*pbx
= ctx
->PB
->x
;
286 GLint
*pby
= ctx
->PB
->y
;
287 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
292 #define INTERP_ALPHA 1
297 pbrgba[count][RCOMP] = FixedToInt(r0); \
298 pbrgba[count][GCOMP] = FixedToInt(g0); \
299 pbrgba[count][BCOMP] = FixedToInt(b0); \
300 pbrgba[count][ACOMP] = FixedToInt(a0); \
303 #include "linetemp.h"
305 ctx
->PB
->count
= count
;
311 /* Smooth-shaded, RGBA line with Z interpolation/testing */
312 static void smooth_rgba_z_line( GLcontext
*ctx
,
313 GLuint vert0
, GLuint vert1
, GLuint pvert
)
315 GLint count
= ctx
->PB
->count
;
316 GLint
*pbx
= ctx
->PB
->x
;
317 GLint
*pby
= ctx
->PB
->y
;
318 GLdepth
*pbz
= ctx
->PB
->z
;
319 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
325 #define INTERP_ALPHA 1
331 pbrgba[count][RCOMP] = FixedToInt(r0); \
332 pbrgba[count][GCOMP] = FixedToInt(g0); \
333 pbrgba[count][BCOMP] = FixedToInt(b0); \
334 pbrgba[count][ACOMP] = FixedToInt(a0); \
337 #include "linetemp.h"
339 ctx
->PB
->count
= count
;
344 #define CHECK_FULL(count) \
345 if (count >= PB_SIZE-MAX_WIDTH) { \
346 ctx->PB->count = count; \
348 count = ctx->PB->count; \
353 /* Smooth shaded, color index, any width, maybe stippled */
354 static void general_smooth_ci_line( GLcontext
*ctx
,
355 GLuint vert0
, GLuint vert1
, GLuint pvert
)
357 GLint count
= ctx
->PB
->count
;
358 GLint
*pbx
= ctx
->PB
->x
;
359 GLint
*pby
= ctx
->PB
->y
;
360 GLdepth
*pbz
= ctx
->PB
->z
;
361 GLuint
*pbi
= ctx
->PB
->i
;
364 if (ctx
->Line
.StippleFlag
) {
368 #define INTERP_INDEX 1
378 #include "linetemp.h"
382 if (ctx
->Line
.Width
==2.0F
) {
383 /* special case: unstippled and width=2 */
386 #define INTERP_INDEX 1
387 #define XMAJOR_PLOT(X,Y) \
388 pbx[count] = X; pbx[count+1] = X; \
389 pby[count] = Y; pby[count+1] = Y+1; \
390 pbz[count] = Z; pbz[count+1] = Z; \
391 pbi[count] = I; pbi[count+1] = I; \
394 #define YMAJOR_PLOT(X,Y) \
395 pbx[count] = X; pbx[count+1] = X+1; \
396 pby[count] = Y; pby[count+1] = Y; \
397 pbz[count] = Z; pbz[count+1] = Z; \
398 pbi[count] = I; pbi[count+1] = I; \
401 #include "linetemp.h"
404 /* unstippled, any width */
407 #define INTERP_INDEX 1
416 #include "linetemp.h"
420 ctx
->PB
->count
= count
;
425 /* Flat shaded, color index, any width, maybe stippled */
426 static void general_flat_ci_line( GLcontext
*ctx
,
427 GLuint vert0
, GLuint vert1
, GLuint pvert
)
430 GLint
*pbx
= ctx
->PB
->x
;
431 GLint
*pby
= ctx
->PB
->y
;
432 GLdepth
*pbz
= ctx
->PB
->z
;
433 PB_SET_INDEX( ctx
, ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
434 count
= ctx
->PB
->count
;
436 if (ctx
->Line
.StippleFlag
) {
437 /* stippled, any width */
448 #include "linetemp.h"
452 if (ctx
->Line
.Width
==2.0F
) {
453 /* special case: unstippled and width=2 */
456 #define XMAJOR_PLOT(X,Y) \
457 pbx[count] = X; pbx[count+1] = X; \
458 pby[count] = Y; pby[count+1] = Y+1; \
459 pbz[count] = Z; pbz[count+1] = Z; \
462 #define YMAJOR_PLOT(X,Y) \
463 pbx[count] = X; pbx[count+1] = X+1; \
464 pby[count] = Y; pby[count+1] = Y; \
465 pbz[count] = Z; pbz[count+1] = Z; \
468 #include "linetemp.h"
471 /* unstippled, any width */
481 #include "linetemp.h"
485 ctx
->PB
->count
= count
;
491 static void general_smooth_rgba_line( GLcontext
*ctx
,
492 GLuint vert0
, GLuint vert1
, GLuint pvert
)
494 GLint count
= ctx
->PB
->count
;
495 GLint
*pbx
= ctx
->PB
->x
;
496 GLint
*pby
= ctx
->PB
->y
;
497 GLdepth
*pbz
= ctx
->PB
->z
;
498 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
501 if (ctx
->Line
.StippleFlag
) {
506 #define INTERP_ALPHA 1
513 pbrgba[count][RCOMP] = FixedToInt(r0); \
514 pbrgba[count][GCOMP] = FixedToInt(g0); \
515 pbrgba[count][BCOMP] = FixedToInt(b0); \
516 pbrgba[count][ACOMP] = FixedToInt(a0); \
519 #include "linetemp.h"
523 if (ctx
->Line
.Width
==2.0F
) {
524 /* special case: unstippled and width=2 */
528 #define INTERP_ALPHA 1
529 #define XMAJOR_PLOT(X,Y) \
530 pbx[count] = X; pbx[count+1] = X; \
531 pby[count] = Y; pby[count+1] = Y+1; \
532 pbz[count] = Z; pbz[count+1] = Z; \
533 pbrgba[count][RCOMP] = FixedToInt(r0); \
534 pbrgba[count][GCOMP] = FixedToInt(g0); \
535 pbrgba[count][BCOMP] = FixedToInt(b0); \
536 pbrgba[count][ACOMP] = FixedToInt(a0); \
537 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
538 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
539 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
540 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
543 #define YMAJOR_PLOT(X,Y) \
544 pbx[count] = X; pbx[count+1] = X+1; \
545 pby[count] = Y; pby[count+1] = Y; \
546 pbz[count] = Z; pbz[count+1] = Z; \
547 pbrgba[count][RCOMP] = FixedToInt(r0); \
548 pbrgba[count][GCOMP] = FixedToInt(g0); \
549 pbrgba[count][BCOMP] = FixedToInt(b0); \
550 pbrgba[count][ACOMP] = FixedToInt(a0); \
551 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
552 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
553 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
554 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
557 #include "linetemp.h"
560 /* unstippled, any width */
564 #define INTERP_ALPHA 1
570 pbrgba[count][RCOMP] = FixedToInt(r0); \
571 pbrgba[count][GCOMP] = FixedToInt(g0); \
572 pbrgba[count][BCOMP] = FixedToInt(b0); \
573 pbrgba[count][ACOMP] = FixedToInt(a0); \
576 #include "linetemp.h"
580 ctx
->PB
->count
= count
;
585 static void general_flat_rgba_line( GLcontext
*ctx
,
586 GLuint vert0
, GLuint vert1
, GLuint pvert
)
589 GLint
*pbx
= ctx
->PB
->x
;
590 GLint
*pby
= ctx
->PB
->y
;
591 GLdepth
*pbz
= ctx
->PB
->z
;
592 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
593 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
594 count
= ctx
->PB
->count
;
596 if (ctx
->Line
.StippleFlag
) {
608 #include "linetemp.h"
612 if (ctx
->Line
.Width
==2.0F
) {
613 /* special case: unstippled and width=2 */
616 #define XMAJOR_PLOT(X,Y) \
617 pbx[count] = X; pbx[count+1] = X; \
618 pby[count] = Y; pby[count+1] = Y+1; \
619 pbz[count] = Z; pbz[count+1] = Z; \
622 #define YMAJOR_PLOT(X,Y) \
623 pbx[count] = X; pbx[count+1] = X+1; \
624 pby[count] = Y; pby[count+1] = Y; \
625 pbz[count] = Z; pbz[count+1] = Z; \
628 #include "linetemp.h"
631 /* unstippled, any width */
641 #include "linetemp.h"
645 ctx
->PB
->count
= count
;
650 /* Flat-shaded, textured, any width, maybe stippled */
651 static void flat_textured_line( GLcontext
*ctx
,
652 GLuint vert0
, GLuint vert1
, GLuint pv
)
655 GLint
*pbx
= ctx
->PB
->x
;
656 GLint
*pby
= ctx
->PB
->y
;
657 GLdepth
*pbz
= ctx
->PB
->z
;
658 GLfloat
*pbs
= ctx
->PB
->s
[0];
659 GLfloat
*pbt
= ctx
->PB
->t
[0];
660 GLfloat
*pbu
= ctx
->PB
->u
[0];
661 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
662 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
663 count
= ctx
->PB
->count
;
665 if (ctx
->Line
.StippleFlag
) {
669 #define INTERP_STUV0 1
683 #include "linetemp.h"
689 #define INTERP_STUV0 1
702 #include "linetemp.h"
705 ctx
->PB
->count
= count
;
711 /* Smooth-shaded, textured, any width, maybe stippled */
712 static void smooth_textured_line( GLcontext
*ctx
,
713 GLuint vert0
, GLuint vert1
, GLuint pvert
)
715 GLint count
= ctx
->PB
->count
;
716 GLint
*pbx
= ctx
->PB
->x
;
717 GLint
*pby
= ctx
->PB
->y
;
718 GLdepth
*pbz
= ctx
->PB
->z
;
719 GLfloat
*pbs
= ctx
->PB
->s
[0];
720 GLfloat
*pbt
= ctx
->PB
->t
[0];
721 GLfloat
*pbu
= ctx
->PB
->u
[0];
722 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
725 if (ctx
->Line
.StippleFlag
) {
730 #define INTERP_ALPHA 1
731 #define INTERP_STUV0 1
742 pbrgba[count][RCOMP] = FixedToInt(r0); \
743 pbrgba[count][GCOMP] = FixedToInt(g0); \
744 pbrgba[count][BCOMP] = FixedToInt(b0); \
745 pbrgba[count][ACOMP] = FixedToInt(a0); \
749 #include "linetemp.h"
756 #define INTERP_ALPHA 1
757 #define INTERP_STUV0 1
767 pbrgba[count][RCOMP] = FixedToInt(r0); \
768 pbrgba[count][GCOMP] = FixedToInt(g0); \
769 pbrgba[count][BCOMP] = FixedToInt(b0); \
770 pbrgba[count][ACOMP] = FixedToInt(a0); \
774 #include "linetemp.h"
777 ctx
->PB
->count
= count
;
782 /* Smooth-shaded, multitextured, any width, maybe stippled, separate specular
783 * color interpolation.
785 static void smooth_multitextured_line( GLcontext
*ctx
,
786 GLuint vert0
, GLuint vert1
, GLuint pvert
)
788 GLint count
= ctx
->PB
->count
;
789 GLint
*pbx
= ctx
->PB
->x
;
790 GLint
*pby
= ctx
->PB
->y
;
791 GLdepth
*pbz
= ctx
->PB
->z
;
792 GLfloat
*pbs
= ctx
->PB
->s
[0];
793 GLfloat
*pbt
= ctx
->PB
->t
[0];
794 GLfloat
*pbu
= ctx
->PB
->u
[0];
795 GLfloat
*pbs1
= ctx
->PB
->s
[1];
796 GLfloat
*pbt1
= ctx
->PB
->t
[1];
797 GLfloat
*pbu1
= ctx
->PB
->u
[1];
798 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
799 GLubyte (*pbspec
)[3] = ctx
->PB
->spec
;
802 if (ctx
->Line
.StippleFlag
) {
807 #define INTERP_SPEC 1
808 #define INTERP_ALPHA 1
809 #define INTERP_STUV0 1
810 #define INTERP_STUV1 1
824 pbrgba[count][RCOMP] = FixedToInt(r0); \
825 pbrgba[count][GCOMP] = FixedToInt(g0); \
826 pbrgba[count][BCOMP] = FixedToInt(b0); \
827 pbrgba[count][ACOMP] = FixedToInt(a0); \
828 pbspec[count][RCOMP] = FixedToInt(sr0); \
829 pbspec[count][GCOMP] = FixedToInt(sg0); \
830 pbspec[count][BCOMP] = FixedToInt(sb0); \
834 #include "linetemp.h"
841 #define INTERP_SPEC 1
842 #define INTERP_ALPHA 1
843 #define INTERP_STUV0 1
844 #define INTERP_STUV1 1
857 pbrgba[count][RCOMP] = FixedToInt(r0); \
858 pbrgba[count][GCOMP] = FixedToInt(g0); \
859 pbrgba[count][BCOMP] = FixedToInt(b0); \
860 pbrgba[count][ACOMP] = FixedToInt(a0); \
861 pbspec[count][RCOMP] = FixedToInt(sr0); \
862 pbspec[count][GCOMP] = FixedToInt(sg0); \
863 pbspec[count][BCOMP] = FixedToInt(sb0); \
867 #include "linetemp.h"
870 ctx
->PB
->count
= count
;
876 * Antialiased RGBA line
878 * This AA line function isn't terribly efficient but it's pretty
879 * straight-forward to understand. Also, it doesn't exactly conform
880 * to the specification.
882 static void aa_rgba_line( GLcontext
*ctx
,
883 GLuint vert0
, GLuint vert1
, GLuint pvert
)
885 #define INTERP_RGBA 1
886 #define PLOT(x, y) { PB_WRITE_RGBA_PIXEL( pb, (x), (y), z, red, green, blue, coverage ); }
887 #include "lnaatemp.h"
891 * Antialiased Textured RGBA line
893 * This AA line function isn't terribly efficient but it's pretty
894 * straight-forward to understand. Also, it doesn't exactly conform
895 * to the specification.
897 static void aa_tex_rgba_line( GLcontext
*ctx
,
898 GLuint vert0
, GLuint vert1
, GLuint pvert
)
900 #define INTERP_RGBA 1
901 #define INTERP_STUV0 1
904 PB_WRITE_TEX_PIXEL( pb, (x), (y), z, red, green, blue, coverage, \
907 #include "lnaatemp.h"
912 * Antialiased Multitextured RGBA line
914 * This AA line function isn't terribly efficient but it's pretty
915 * straight-forward to understand. Also, it doesn't exactly conform
916 * to the specification.
918 static void aa_multitex_rgba_line( GLcontext
*ctx
,
919 GLuint vert0
, GLuint vert1
, GLuint pvert
)
921 #define INTERP_RGBA 1
922 #define INTERP_SPEC 1
923 #define INTERP_STUV0 1
924 #define INTERP_STUV1 1
927 PB_WRITE_MULTITEX_SPEC_PIXEL( pb, (x), (y), z, \
928 red, green, blue, coverage, specRed, specGreen, specBlue, \
929 s, t, u, s1, t1, u1 ); \
931 #include "lnaatemp.h"
936 * Antialiased CI line. Same comments for RGBA antialiased lines apply.
938 static void aa_ci_line( GLcontext
*ctx
,
939 GLuint vert0
, GLuint vert1
, GLuint pvert
)
941 #define INTERP_INDEX 1
944 PB_WRITE_CI_PIXEL( pb, (x), (y), z, index + coverage ); \
946 #include "lnaatemp.h"
951 * Null rasterizer for measuring transformation speed.
953 static void null_line( GLcontext
*ctx
, GLuint v1
, GLuint v2
, GLuint pv
)
963 * Determine which line drawing function to use given the current
966 void gl_set_line_function( GLcontext
*ctx
)
968 GLboolean rgbmode
= ctx
->Visual
->RGBAflag
;
969 /* TODO: antialiased lines */
971 if (ctx
->RenderMode
==GL_RENDER
) {
973 ctx
->Driver
.LineFunc
= null_line
;
976 if (ctx
->Driver
.LineFunc
) {
977 /* Device driver will draw lines. */
981 if (ctx
->Line
.SmoothFlag
) {
982 /* antialiased lines */
984 if (ctx
->Texture
.ReallyEnabled
) {
985 if (ctx
->Texture
.ReallyEnabled
>= TEXTURE1_1D
986 || ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
)
988 ctx
->Driver
.LineFunc
= aa_multitex_rgba_line
;
990 ctx
->Driver
.LineFunc
= aa_tex_rgba_line
;
992 ctx
->Driver
.LineFunc
= aa_rgba_line
;
996 ctx
->Driver
.LineFunc
= aa_ci_line
;
999 else if (ctx
->Texture
.ReallyEnabled
) {
1000 if (ctx
->Texture
.ReallyEnabled
>= TEXTURE1_1D
1001 || ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
) {
1002 /* multi-texture and/or separate specular color */
1003 ctx
->Driver
.LineFunc
= smooth_multitextured_line
;
1006 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1007 ctx
->Driver
.LineFunc
= smooth_textured_line
;
1010 ctx
->Driver
.LineFunc
= flat_textured_line
;
1014 else if (ctx
->Line
.Width
!=1.0 || ctx
->Line
.StippleFlag
1015 || ctx
->Line
.SmoothFlag
) {
1016 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1018 ctx
->Driver
.LineFunc
= general_smooth_rgba_line
;
1020 ctx
->Driver
.LineFunc
= general_smooth_ci_line
;
1024 ctx
->Driver
.LineFunc
= general_flat_rgba_line
;
1026 ctx
->Driver
.LineFunc
= general_flat_ci_line
;
1030 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1031 /* Width==1, non-stippled, smooth-shaded */
1032 if (ctx
->Depth
.Test
|| ctx
->FogMode
== FOG_FRAGMENT
) {
1034 ctx
->Driver
.LineFunc
= smooth_rgba_z_line
;
1036 ctx
->Driver
.LineFunc
= smooth_ci_z_line
;
1040 ctx
->Driver
.LineFunc
= smooth_rgba_line
;
1042 ctx
->Driver
.LineFunc
= smooth_ci_line
;
1046 /* Width==1, non-stippled, flat-shaded */
1047 if (ctx
->Depth
.Test
|| ctx
->FogMode
== FOG_FRAGMENT
) {
1049 ctx
->Driver
.LineFunc
= flat_rgba_z_line
;
1051 ctx
->Driver
.LineFunc
= flat_ci_z_line
;
1055 ctx
->Driver
.LineFunc
= flat_rgba_line
;
1057 ctx
->Driver
.LineFunc
= flat_ci_line
;
1062 else if (ctx
->RenderMode
==GL_FEEDBACK
) {
1063 ctx
->Driver
.LineFunc
= gl_feedback_line
;
1066 /* GL_SELECT mode */
1067 ctx
->Driver
.LineFunc
= gl_select_line
;