1 /* $Id: lines.c,v 1.6 1999/11/11 01:22:27 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
;
67 _mesa_LineStipple( GLint factor
, GLushort pattern
)
69 GET_CURRENT_CONTEXT(ctx
);
70 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glLineStipple");
71 ctx
->Line
.StippleFactor
= CLAMP( factor
, 1, 256 );
72 ctx
->Line
.StipplePattern
= pattern
;
73 ctx
->NewState
|= NEW_RASTER_OPS
;
78 /**********************************************************************/
79 /***** Rasterization *****/
80 /**********************************************************************/
84 * There are 4 pairs (RGBA, CI) of line drawing functions:
85 * 1. simple: width=1 and no special rasterization functions (fastest)
86 * 2. flat: width=1, non-stippled, flat-shaded, any raster operations
87 * 3. smooth: width=1, non-stippled, smooth-shaded, any raster operations
88 * 4. general: any other kind of line (slowest)
93 * All line drawing functions have the same arguments:
94 * v1, v2 - indexes of first and second endpoints into vertex buffer arrays
95 * pv - provoking vertex: which vertex color/index to use for flat shading.
103 #if MAX_WIDTH > MAX_HEIGHT
104 # define MAXPOINTS MAX_WIDTH
106 # define MAXPOINTS MAX_HEIGHT
110 /* Flat, color index line */
111 static void flat_ci_line( GLcontext
*ctx
,
112 GLuint vert0
, GLuint vert1
, GLuint pvert
)
115 GLint
*pbx
= ctx
->PB
->x
;
116 GLint
*pby
= ctx
->PB
->y
;
117 PB_SET_INDEX( ctx
, ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
118 count
= ctx
->PB
->count
;
127 #include "linetemp.h"
129 ctx
->PB
->count
= count
;
135 /* Flat, color index line with Z interpolation/testing */
136 static void flat_ci_z_line( GLcontext
*ctx
,
137 GLuint vert0
, GLuint vert1
, GLuint pvert
)
140 GLint
*pbx
= ctx
->PB
->x
;
141 GLint
*pby
= ctx
->PB
->y
;
142 GLdepth
*pbz
= ctx
->PB
->z
;
143 PB_SET_INDEX( ctx
, ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
144 count
= ctx
->PB
->count
;
155 #include "linetemp.h"
157 ctx
->PB
->count
= count
;
163 /* Flat-shaded, RGBA line */
164 static void flat_rgba_line( GLcontext
*ctx
,
165 GLuint vert0
, GLuint vert1
, GLuint pvert
)
168 GLint
*pbx
= ctx
->PB
->x
;
169 GLint
*pby
= ctx
->PB
->y
;
170 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
171 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
172 count
= ctx
->PB
->count
;
181 #include "linetemp.h"
183 ctx
->PB
->count
= count
;
189 /* Flat-shaded, RGBA line with Z interpolation/testing */
190 static void flat_rgba_z_line( GLcontext
*ctx
,
191 GLuint vert0
, GLuint vert1
, GLuint pvert
)
194 GLint
*pbx
= ctx
->PB
->x
;
195 GLint
*pby
= ctx
->PB
->y
;
196 GLdepth
*pbz
= ctx
->PB
->z
;
197 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
198 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
199 count
= ctx
->PB
->count
;
210 #include "linetemp.h"
212 ctx
->PB
->count
= count
;
218 /* Smooth shaded, color index line */
219 static void smooth_ci_line( GLcontext
*ctx
,
220 GLuint vert0
, GLuint vert1
, GLuint pvert
)
222 GLint count
= ctx
->PB
->count
;
223 GLint
*pbx
= ctx
->PB
->x
;
224 GLint
*pby
= ctx
->PB
->y
;
225 GLuint
*pbi
= ctx
->PB
->i
;
229 #define INTERP_INDEX 1
237 #include "linetemp.h"
239 ctx
->PB
->count
= count
;
245 /* Smooth shaded, color index line with Z interpolation/testing */
246 static void smooth_ci_z_line( GLcontext
*ctx
,
247 GLuint vert0
, GLuint vert1
, GLuint pvert
)
249 GLint count
= ctx
->PB
->count
;
250 GLint
*pbx
= ctx
->PB
->x
;
251 GLint
*pby
= ctx
->PB
->y
;
252 GLdepth
*pbz
= ctx
->PB
->z
;
253 GLuint
*pbi
= ctx
->PB
->i
;
258 #define INTERP_INDEX 1
267 #include "linetemp.h"
269 ctx
->PB
->count
= count
;
275 /* Smooth-shaded, RGBA line */
276 static void smooth_rgba_line( GLcontext
*ctx
,
277 GLuint vert0
, GLuint vert1
, GLuint pvert
)
279 GLint count
= ctx
->PB
->count
;
280 GLint
*pbx
= ctx
->PB
->x
;
281 GLint
*pby
= ctx
->PB
->y
;
282 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
287 #define INTERP_ALPHA 1
292 pbrgba[count][RCOMP] = FixedToInt(r0); \
293 pbrgba[count][GCOMP] = FixedToInt(g0); \
294 pbrgba[count][BCOMP] = FixedToInt(b0); \
295 pbrgba[count][ACOMP] = FixedToInt(a0); \
298 #include "linetemp.h"
300 ctx
->PB
->count
= count
;
306 /* Smooth-shaded, RGBA line with Z interpolation/testing */
307 static void smooth_rgba_z_line( GLcontext
*ctx
,
308 GLuint vert0
, GLuint vert1
, GLuint pvert
)
310 GLint count
= ctx
->PB
->count
;
311 GLint
*pbx
= ctx
->PB
->x
;
312 GLint
*pby
= ctx
->PB
->y
;
313 GLdepth
*pbz
= ctx
->PB
->z
;
314 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
320 #define INTERP_ALPHA 1
326 pbrgba[count][RCOMP] = FixedToInt(r0); \
327 pbrgba[count][GCOMP] = FixedToInt(g0); \
328 pbrgba[count][BCOMP] = FixedToInt(b0); \
329 pbrgba[count][ACOMP] = FixedToInt(a0); \
332 #include "linetemp.h"
334 ctx
->PB
->count
= count
;
339 #define CHECK_FULL(count) \
340 if (count >= PB_SIZE-MAX_WIDTH) { \
341 ctx->PB->count = count; \
343 count = ctx->PB->count; \
348 /* Smooth shaded, color index, any width, maybe stippled */
349 static void general_smooth_ci_line( GLcontext
*ctx
,
350 GLuint vert0
, GLuint vert1
, GLuint pvert
)
352 GLint count
= ctx
->PB
->count
;
353 GLint
*pbx
= ctx
->PB
->x
;
354 GLint
*pby
= ctx
->PB
->y
;
355 GLdepth
*pbz
= ctx
->PB
->z
;
356 GLuint
*pbi
= ctx
->PB
->i
;
359 if (ctx
->Line
.StippleFlag
) {
363 #define INTERP_INDEX 1
373 #include "linetemp.h"
377 if (ctx
->Line
.Width
==2.0F
) {
378 /* special case: unstippled and width=2 */
381 #define INTERP_INDEX 1
382 #define XMAJOR_PLOT(X,Y) \
383 pbx[count] = X; pbx[count+1] = X; \
384 pby[count] = Y; pby[count+1] = Y+1; \
385 pbz[count] = Z; pbz[count+1] = Z; \
386 pbi[count] = I; pbi[count+1] = I; \
389 #define YMAJOR_PLOT(X,Y) \
390 pbx[count] = X; pbx[count+1] = X+1; \
391 pby[count] = Y; pby[count+1] = Y; \
392 pbz[count] = Z; pbz[count+1] = Z; \
393 pbi[count] = I; pbi[count+1] = I; \
396 #include "linetemp.h"
399 /* unstippled, any width */
402 #define INTERP_INDEX 1
411 #include "linetemp.h"
415 ctx
->PB
->count
= count
;
420 /* Flat shaded, color index, any width, maybe stippled */
421 static void general_flat_ci_line( GLcontext
*ctx
,
422 GLuint vert0
, GLuint vert1
, GLuint pvert
)
425 GLint
*pbx
= ctx
->PB
->x
;
426 GLint
*pby
= ctx
->PB
->y
;
427 GLdepth
*pbz
= ctx
->PB
->z
;
428 PB_SET_INDEX( ctx
, ctx
->PB
, ctx
->VB
->IndexPtr
->data
[pvert
] );
429 count
= ctx
->PB
->count
;
431 if (ctx
->Line
.StippleFlag
) {
432 /* stippled, any width */
443 #include "linetemp.h"
447 if (ctx
->Line
.Width
==2.0F
) {
448 /* special case: unstippled and width=2 */
451 #define XMAJOR_PLOT(X,Y) \
452 pbx[count] = X; pbx[count+1] = X; \
453 pby[count] = Y; pby[count+1] = Y+1; \
454 pbz[count] = Z; pbz[count+1] = Z; \
457 #define YMAJOR_PLOT(X,Y) \
458 pbx[count] = X; pbx[count+1] = X+1; \
459 pby[count] = Y; pby[count+1] = Y; \
460 pbz[count] = Z; pbz[count+1] = Z; \
463 #include "linetemp.h"
466 /* unstippled, any width */
476 #include "linetemp.h"
480 ctx
->PB
->count
= count
;
486 static void general_smooth_rgba_line( GLcontext
*ctx
,
487 GLuint vert0
, GLuint vert1
, GLuint pvert
)
489 GLint count
= ctx
->PB
->count
;
490 GLint
*pbx
= ctx
->PB
->x
;
491 GLint
*pby
= ctx
->PB
->y
;
492 GLdepth
*pbz
= ctx
->PB
->z
;
493 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
496 if (ctx
->Line
.StippleFlag
) {
501 #define INTERP_ALPHA 1
508 pbrgba[count][RCOMP] = FixedToInt(r0); \
509 pbrgba[count][GCOMP] = FixedToInt(g0); \
510 pbrgba[count][BCOMP] = FixedToInt(b0); \
511 pbrgba[count][ACOMP] = FixedToInt(a0); \
514 #include "linetemp.h"
518 if (ctx
->Line
.Width
==2.0F
) {
519 /* special case: unstippled and width=2 */
523 #define INTERP_ALPHA 1
524 #define XMAJOR_PLOT(X,Y) \
525 pbx[count] = X; pbx[count+1] = X; \
526 pby[count] = Y; pby[count+1] = Y+1; \
527 pbz[count] = Z; pbz[count+1] = Z; \
528 pbrgba[count][RCOMP] = FixedToInt(r0); \
529 pbrgba[count][GCOMP] = FixedToInt(g0); \
530 pbrgba[count][BCOMP] = FixedToInt(b0); \
531 pbrgba[count][ACOMP] = FixedToInt(a0); \
532 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
533 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
534 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
535 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
538 #define YMAJOR_PLOT(X,Y) \
539 pbx[count] = X; pbx[count+1] = X+1; \
540 pby[count] = Y; pby[count+1] = Y; \
541 pbz[count] = Z; pbz[count+1] = Z; \
542 pbrgba[count][RCOMP] = FixedToInt(r0); \
543 pbrgba[count][GCOMP] = FixedToInt(g0); \
544 pbrgba[count][BCOMP] = FixedToInt(b0); \
545 pbrgba[count][ACOMP] = FixedToInt(a0); \
546 pbrgba[count+1][RCOMP] = FixedToInt(r0); \
547 pbrgba[count+1][GCOMP] = FixedToInt(g0); \
548 pbrgba[count+1][BCOMP] = FixedToInt(b0); \
549 pbrgba[count+1][ACOMP] = FixedToInt(a0); \
552 #include "linetemp.h"
555 /* unstippled, any width */
559 #define INTERP_ALPHA 1
565 pbrgba[count][RCOMP] = FixedToInt(r0); \
566 pbrgba[count][GCOMP] = FixedToInt(g0); \
567 pbrgba[count][BCOMP] = FixedToInt(b0); \
568 pbrgba[count][ACOMP] = FixedToInt(a0); \
571 #include "linetemp.h"
575 ctx
->PB
->count
= count
;
580 static void general_flat_rgba_line( GLcontext
*ctx
,
581 GLuint vert0
, GLuint vert1
, GLuint pvert
)
584 GLint
*pbx
= ctx
->PB
->x
;
585 GLint
*pby
= ctx
->PB
->y
;
586 GLdepth
*pbz
= ctx
->PB
->z
;
587 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pvert
];
588 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
589 count
= ctx
->PB
->count
;
591 if (ctx
->Line
.StippleFlag
) {
603 #include "linetemp.h"
607 if (ctx
->Line
.Width
==2.0F
) {
608 /* special case: unstippled and width=2 */
611 #define XMAJOR_PLOT(X,Y) \
612 pbx[count] = X; pbx[count+1] = X; \
613 pby[count] = Y; pby[count+1] = Y+1; \
614 pbz[count] = Z; pbz[count+1] = Z; \
617 #define YMAJOR_PLOT(X,Y) \
618 pbx[count] = X; pbx[count+1] = X+1; \
619 pby[count] = Y; pby[count+1] = Y; \
620 pbz[count] = Z; pbz[count+1] = Z; \
623 #include "linetemp.h"
626 /* unstippled, any width */
636 #include "linetemp.h"
640 ctx
->PB
->count
= count
;
645 /* Flat-shaded, textured, any width, maybe stippled */
646 static void flat_textured_line( GLcontext
*ctx
,
647 GLuint vert0
, GLuint vert1
, GLuint pv
)
650 GLint
*pbx
= ctx
->PB
->x
;
651 GLint
*pby
= ctx
->PB
->y
;
652 GLdepth
*pbz
= ctx
->PB
->z
;
653 GLfloat
*pbs
= ctx
->PB
->s
[0];
654 GLfloat
*pbt
= ctx
->PB
->t
[0];
655 GLfloat
*pbu
= ctx
->PB
->u
[0];
656 GLubyte
*color
= ctx
->VB
->ColorPtr
->data
[pv
];
657 PB_SET_COLOR( ctx
, ctx
->PB
, color
[0], color
[1], color
[2], color
[3] );
658 count
= ctx
->PB
->count
;
660 if (ctx
->Line
.StippleFlag
) {
664 #define INTERP_STUV0 1
678 #include "linetemp.h"
684 #define INTERP_STUV0 1
697 #include "linetemp.h"
700 ctx
->PB
->count
= count
;
706 /* Smooth-shaded, textured, any width, maybe stippled */
707 static void smooth_textured_line( GLcontext
*ctx
,
708 GLuint vert0
, GLuint vert1
, GLuint pvert
)
710 GLint count
= ctx
->PB
->count
;
711 GLint
*pbx
= ctx
->PB
->x
;
712 GLint
*pby
= ctx
->PB
->y
;
713 GLdepth
*pbz
= ctx
->PB
->z
;
714 GLfloat
*pbs
= ctx
->PB
->s
[0];
715 GLfloat
*pbt
= ctx
->PB
->t
[0];
716 GLfloat
*pbu
= ctx
->PB
->u
[0];
717 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
720 if (ctx
->Line
.StippleFlag
) {
725 #define INTERP_ALPHA 1
726 #define INTERP_STUV0 1
737 pbrgba[count][RCOMP] = FixedToInt(r0); \
738 pbrgba[count][GCOMP] = FixedToInt(g0); \
739 pbrgba[count][BCOMP] = FixedToInt(b0); \
740 pbrgba[count][ACOMP] = FixedToInt(a0); \
744 #include "linetemp.h"
751 #define INTERP_ALPHA 1
752 #define INTERP_STUV0 1
762 pbrgba[count][RCOMP] = FixedToInt(r0); \
763 pbrgba[count][GCOMP] = FixedToInt(g0); \
764 pbrgba[count][BCOMP] = FixedToInt(b0); \
765 pbrgba[count][ACOMP] = FixedToInt(a0); \
769 #include "linetemp.h"
772 ctx
->PB
->count
= count
;
777 /* Smooth-shaded, multitextured, any width, maybe stippled, separate specular
778 * color interpolation.
780 static void smooth_multitextured_line( GLcontext
*ctx
,
781 GLuint vert0
, GLuint vert1
, GLuint pvert
)
783 GLint count
= ctx
->PB
->count
;
784 GLint
*pbx
= ctx
->PB
->x
;
785 GLint
*pby
= ctx
->PB
->y
;
786 GLdepth
*pbz
= ctx
->PB
->z
;
787 GLfloat
*pbs
= ctx
->PB
->s
[0];
788 GLfloat
*pbt
= ctx
->PB
->t
[0];
789 GLfloat
*pbu
= ctx
->PB
->u
[0];
790 GLfloat
*pbs1
= ctx
->PB
->s
[1];
791 GLfloat
*pbt1
= ctx
->PB
->t
[1];
792 GLfloat
*pbu1
= ctx
->PB
->u
[1];
793 GLubyte (*pbrgba
)[4] = ctx
->PB
->rgba
;
794 GLubyte (*pbspec
)[3] = ctx
->PB
->spec
;
797 if (ctx
->Line
.StippleFlag
) {
802 #define INTERP_SPEC 1
803 #define INTERP_ALPHA 1
804 #define INTERP_STUV0 1
805 #define INTERP_STUV1 1
819 pbrgba[count][RCOMP] = FixedToInt(r0); \
820 pbrgba[count][GCOMP] = FixedToInt(g0); \
821 pbrgba[count][BCOMP] = FixedToInt(b0); \
822 pbrgba[count][ACOMP] = FixedToInt(a0); \
823 pbspec[count][RCOMP] = FixedToInt(sr0); \
824 pbspec[count][GCOMP] = FixedToInt(sg0); \
825 pbspec[count][BCOMP] = FixedToInt(sb0); \
829 #include "linetemp.h"
836 #define INTERP_SPEC 1
837 #define INTERP_ALPHA 1
838 #define INTERP_STUV0 1
839 #define INTERP_STUV1 1
852 pbrgba[count][RCOMP] = FixedToInt(r0); \
853 pbrgba[count][GCOMP] = FixedToInt(g0); \
854 pbrgba[count][BCOMP] = FixedToInt(b0); \
855 pbrgba[count][ACOMP] = FixedToInt(a0); \
856 pbspec[count][RCOMP] = FixedToInt(sr0); \
857 pbspec[count][GCOMP] = FixedToInt(sg0); \
858 pbspec[count][BCOMP] = FixedToInt(sb0); \
862 #include "linetemp.h"
865 ctx
->PB
->count
= count
;
871 * Antialiased RGBA line
873 * This AA line function isn't terribly efficient but it's pretty
874 * straight-forward to understand. Also, it doesn't exactly conform
875 * to the specification.
877 static void aa_rgba_line( GLcontext
*ctx
,
878 GLuint vert0
, GLuint vert1
, GLuint pvert
)
880 #define INTERP_RGBA 1
881 #define PLOT(x, y) { PB_WRITE_RGBA_PIXEL( pb, (x), (y), z, red, green, blue, coverage ); }
882 #include "lnaatemp.h"
886 * Antialiased Textured RGBA line
888 * This AA line function isn't terribly efficient but it's pretty
889 * straight-forward to understand. Also, it doesn't exactly conform
890 * to the specification.
892 static void aa_tex_rgba_line( GLcontext
*ctx
,
893 GLuint vert0
, GLuint vert1
, GLuint pvert
)
895 #define INTERP_RGBA 1
896 #define INTERP_STUV0 1
899 PB_WRITE_TEX_PIXEL( pb, (x), (y), z, red, green, blue, coverage, \
902 #include "lnaatemp.h"
907 * Antialiased Multitextured RGBA line
909 * This AA line function isn't terribly efficient but it's pretty
910 * straight-forward to understand. Also, it doesn't exactly conform
911 * to the specification.
913 static void aa_multitex_rgba_line( GLcontext
*ctx
,
914 GLuint vert0
, GLuint vert1
, GLuint pvert
)
916 #define INTERP_RGBA 1
917 #define INTERP_SPEC 1
918 #define INTERP_STUV0 1
919 #define INTERP_STUV1 1
922 PB_WRITE_MULTITEX_SPEC_PIXEL( pb, (x), (y), z, \
923 red, green, blue, coverage, specRed, specGreen, specBlue, \
924 s, t, u, s1, t1, u1 ); \
926 #include "lnaatemp.h"
931 * Antialiased CI line. Same comments for RGBA antialiased lines apply.
933 static void aa_ci_line( GLcontext
*ctx
,
934 GLuint vert0
, GLuint vert1
, GLuint pvert
)
936 #define INTERP_INDEX 1
939 PB_WRITE_CI_PIXEL( pb, (x), (y), z, index + coverage ); \
941 #include "lnaatemp.h"
946 * Null rasterizer for measuring transformation speed.
948 static void null_line( GLcontext
*ctx
, GLuint v1
, GLuint v2
, GLuint pv
)
958 * Determine which line drawing function to use given the current
961 void gl_set_line_function( GLcontext
*ctx
)
963 GLboolean rgbmode
= ctx
->Visual
->RGBAflag
;
964 /* TODO: antialiased lines */
966 if (ctx
->RenderMode
==GL_RENDER
) {
968 ctx
->Driver
.LineFunc
= null_line
;
971 if (ctx
->Driver
.LineFunc
) {
972 /* Device driver will draw lines. */
976 if (ctx
->Line
.SmoothFlag
) {
977 /* antialiased lines */
979 if (ctx
->Texture
.ReallyEnabled
) {
980 if (ctx
->Texture
.ReallyEnabled
>= TEXTURE1_1D
981 || ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
)
983 ctx
->Driver
.LineFunc
= aa_multitex_rgba_line
;
985 ctx
->Driver
.LineFunc
= aa_tex_rgba_line
;
987 ctx
->Driver
.LineFunc
= aa_rgba_line
;
991 ctx
->Driver
.LineFunc
= aa_ci_line
;
994 else if (ctx
->Texture
.ReallyEnabled
) {
995 if (ctx
->Texture
.ReallyEnabled
>= TEXTURE1_1D
996 || ctx
->Light
.Model
.ColorControl
==GL_SEPARATE_SPECULAR_COLOR
) {
997 /* multi-texture and/or separate specular color */
998 ctx
->Driver
.LineFunc
= smooth_multitextured_line
;
1001 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1002 ctx
->Driver
.LineFunc
= smooth_textured_line
;
1005 ctx
->Driver
.LineFunc
= flat_textured_line
;
1009 else if (ctx
->Line
.Width
!=1.0 || ctx
->Line
.StippleFlag
1010 || ctx
->Line
.SmoothFlag
) {
1011 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1013 ctx
->Driver
.LineFunc
= general_smooth_rgba_line
;
1015 ctx
->Driver
.LineFunc
= general_smooth_ci_line
;
1019 ctx
->Driver
.LineFunc
= general_flat_rgba_line
;
1021 ctx
->Driver
.LineFunc
= general_flat_ci_line
;
1025 if (ctx
->Light
.ShadeModel
==GL_SMOOTH
) {
1026 /* Width==1, non-stippled, smooth-shaded */
1028 || (ctx
->Fog
.Enabled
&& ctx
->Hint
.Fog
==GL_NICEST
)) {
1030 ctx
->Driver
.LineFunc
= smooth_rgba_z_line
;
1032 ctx
->Driver
.LineFunc
= smooth_ci_z_line
;
1036 ctx
->Driver
.LineFunc
= smooth_rgba_line
;
1038 ctx
->Driver
.LineFunc
= smooth_ci_line
;
1042 /* Width==1, non-stippled, flat-shaded */
1044 || (ctx
->Fog
.Enabled
&& ctx
->Hint
.Fog
==GL_NICEST
)) {
1046 ctx
->Driver
.LineFunc
= flat_rgba_z_line
;
1048 ctx
->Driver
.LineFunc
= flat_ci_z_line
;
1052 ctx
->Driver
.LineFunc
= flat_rgba_line
;
1054 ctx
->Driver
.LineFunc
= flat_ci_line
;
1059 else if (ctx
->RenderMode
==GL_FEEDBACK
) {
1060 ctx
->Driver
.LineFunc
= gl_feedback_line
;
1063 /* GL_SELECT mode */
1064 ctx
->Driver
.LineFunc
= gl_select_line
;