changed a warning string
[mesa.git] / src / mesa / main / points.c
1 /* $Id: points.c,v 1.5 1999/11/11 01:22:27 brianp Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.3
6 *
7 * Copyright (C) 1999 Brian Paul All Rights Reserved.
8 *
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:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
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.
25 */
26
27
28 #ifdef PC_HEADER
29 #include "all.h"
30 #else
31 #include "glheader.h"
32 #include "context.h"
33 #include "feedback.h"
34 #include "macros.h"
35 #include "mmath.h"
36 #include "pb.h"
37 #include "points.h"
38 #include "span.h"
39 #include "texstate.h"
40 #include "types.h"
41 #include "vb.h"
42 #endif
43
44
45
46 void
47 _mesa_PointSize( GLfloat size )
48 {
49 GET_CURRENT_CONTEXT(ctx);
50 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointSize");
51
52 if (size <= 0.0) {
53 gl_error( ctx, GL_INVALID_VALUE, "glPointSize" );
54 return;
55 }
56
57 if (ctx->Point.Size != size) {
58 ctx->Point.Size = size;
59 ctx->TriangleCaps &= ~DD_POINT_SIZE;
60 if (size != 1.0) ctx->TriangleCaps |= DD_POINT_SIZE;
61 ctx->NewState |= NEW_RASTER_OPS;
62 }
63 }
64
65
66
67 void
68 _mesa_PointParameterfEXT( GLenum pname, GLfloat param)
69 {
70 _mesa_PointParameterfvEXT(pname, &param);
71 }
72
73
74 void
75 _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params)
76 {
77 GET_CURRENT_CONTEXT(ctx);
78 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointParameterfvEXT");
79
80 if (pname == GL_DISTANCE_ATTENUATION_EXT) {
81 GLboolean tmp = ctx->Point.Attenuated;
82 COPY_3V(ctx->Point.Params,params);
83 ctx->Point.Attenuated = (params[0] != 1.0 ||
84 params[1] != 0.0 ||
85 params[2] != 0.0);
86
87 if (tmp != ctx->Point.Attenuated) {
88 ctx->Enabled ^= ENABLE_POINT_ATTEN;
89 ctx->TriangleCaps ^= DD_POINT_ATTEN;
90 ctx->NewState |= NEW_RASTER_OPS;
91 }
92 }
93 else {
94 if (*params<0.0 ) {
95 gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" );
96 return;
97 }
98 switch (pname) {
99 case GL_POINT_SIZE_MIN_EXT:
100 ctx->Point.MinSize=*params;
101 break;
102 case GL_POINT_SIZE_MAX_EXT:
103 ctx->Point.MaxSize=*params;
104 break;
105 case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
106 ctx->Point.Threshold=*params;
107 break;
108 default:
109 gl_error( ctx, GL_INVALID_ENUM, "glPointParameterfvEXT" );
110 return;
111 }
112 }
113 ctx->NewState |= NEW_RASTER_OPS;
114 }
115
116
117 /**********************************************************************/
118 /***** Rasterization *****/
119 /**********************************************************************/
120
121
122 /*
123 * There are 3 pairs (RGBA, CI) of point rendering functions:
124 * 1. simple: size=1 and no special rasterization functions (fastest)
125 * 2. size1: size=1 and any rasterization functions
126 * 3. general: any size and rasterization functions (slowest)
127 *
128 * All point rendering functions take the same two arguments: first and
129 * last which specify that the points specified by VB[first] through
130 * VB[last] are to be rendered.
131 */
132
133
134
135
136
137 /*
138 * CI points with size == 1.0
139 */
140 static void size1_ci_points( GLcontext *ctx, GLuint first, GLuint last )
141 {
142 struct vertex_buffer *VB = ctx->VB;
143 struct pixel_buffer *PB = ctx->PB;
144 GLfloat *win;
145 GLint *pbx = PB->x, *pby = PB->y;
146 GLdepth *pbz = PB->z;
147 GLuint *pbi = PB->i;
148 GLuint pbcount = PB->count;
149 GLuint i;
150
151 win = &VB->Win.data[first][0];
152 for (i=first;i<=last;i++) {
153 if (VB->ClipMask[i]==0) {
154 pbx[pbcount] = (GLint) win[0];
155 pby[pbcount] = (GLint) win[1];
156 pbz[pbcount] = (GLint) (win[2] + ctx->PointZoffset);
157 pbi[pbcount] = VB->IndexPtr->data[i];
158 pbcount++;
159 }
160 win += 3;
161 }
162 PB->count = pbcount;
163 PB_CHECK_FLUSH(ctx, PB);
164 }
165
166
167
168 /*
169 * RGBA points with size == 1.0
170 */
171 static void size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
172 {
173 struct vertex_buffer *VB = ctx->VB;
174 struct pixel_buffer *PB = ctx->PB;
175 GLuint i;
176
177 for (i=first;i<=last;i++) {
178 if (VB->ClipMask[i]==0) {
179 GLint x, y, z;
180 GLint red, green, blue, alpha;
181
182 x = (GLint) VB->Win.data[i][0];
183 y = (GLint) VB->Win.data[i][1];
184 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
185
186 red = VB->ColorPtr->data[i][0];
187 green = VB->ColorPtr->data[i][1];
188 blue = VB->ColorPtr->data[i][2];
189 alpha = VB->ColorPtr->data[i][3];
190
191 PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha );
192 }
193 }
194 PB_CHECK_FLUSH(ctx,PB);
195 }
196
197
198
199 /*
200 * General CI points.
201 */
202 static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last )
203 {
204 struct vertex_buffer *VB = ctx->VB;
205 struct pixel_buffer *PB = ctx->PB;
206 GLuint i;
207 GLint isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
208 GLint radius = isize >> 1;
209
210 for (i=first;i<=last;i++) {
211 if (VB->ClipMask[i]==0) {
212 GLint x, y, z;
213 GLint x0, x1, y0, y1;
214 GLint ix, iy;
215
216 x = (GLint) VB->Win.data[i][0];
217 y = (GLint) VB->Win.data[i][1];
218 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
219
220 if (isize & 1) {
221 /* odd size */
222 x0 = x - radius;
223 x1 = x + radius;
224 y0 = y - radius;
225 y1 = y + radius;
226 }
227 else {
228 /* even size */
229 x0 = (GLint) (x + 1.5F) - radius;
230 x1 = x0 + isize - 1;
231 y0 = (GLint) (y + 1.5F) - radius;
232 y1 = y0 + isize - 1;
233 }
234
235 PB_SET_INDEX( ctx, PB, VB->IndexPtr->data[i] );
236
237 for (iy=y0;iy<=y1;iy++) {
238 for (ix=x0;ix<=x1;ix++) {
239 PB_WRITE_PIXEL( PB, ix, iy, z );
240 }
241 }
242 PB_CHECK_FLUSH(ctx,PB);
243 }
244 }
245 }
246
247
248 /*
249 * General RGBA points.
250 */
251 static void general_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
252 {
253 struct vertex_buffer *VB = ctx->VB;
254 struct pixel_buffer *PB = ctx->PB;
255 GLuint i;
256 GLint isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
257 GLint radius = isize >> 1;
258
259 for (i=first;i<=last;i++) {
260 if (VB->ClipMask[i]==0) {
261 GLint x, y, z;
262 GLint x0, x1, y0, y1;
263 GLint ix, iy;
264
265 x = (GLint) VB->Win.data[i][0];
266 y = (GLint) VB->Win.data[i][1];
267 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
268
269 if (isize & 1) {
270 /* odd size */
271 x0 = x - radius;
272 x1 = x + radius;
273 y0 = y - radius;
274 y1 = y + radius;
275 }
276 else {
277 /* even size */
278 x0 = (GLint) (x + 1.5F) - radius;
279 x1 = x0 + isize - 1;
280 y0 = (GLint) (y + 1.5F) - radius;
281 y1 = y0 + isize - 1;
282 }
283
284 PB_SET_COLOR( ctx, PB,
285 VB->ColorPtr->data[i][0],
286 VB->ColorPtr->data[i][1],
287 VB->ColorPtr->data[i][2],
288 VB->ColorPtr->data[i][3] );
289
290 for (iy=y0;iy<=y1;iy++) {
291 for (ix=x0;ix<=x1;ix++) {
292 PB_WRITE_PIXEL( PB, ix, iy, z );
293 }
294 }
295 PB_CHECK_FLUSH(ctx,PB);
296 }
297 }
298 }
299
300
301
302
303 /*
304 * Textured RGBA points.
305 */
306 static void textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
307 {
308 struct vertex_buffer *VB = ctx->VB;
309 struct pixel_buffer *PB = ctx->PB;
310 GLuint i;
311
312 for (i=first;i<=last;i++) {
313 if (VB->ClipMask[i]==0) {
314 GLint x, y, z;
315 GLint x0, x1, y0, y1;
316 GLint ix, iy;
317 GLint isize, radius;
318 GLint red, green, blue, alpha;
319 GLfloat s, t, u;
320
321 x = (GLint) VB->Win.data[i][0];
322 y = (GLint) VB->Win.data[i][1];
323 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
324
325 isize = (GLint)
326 (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
327 if (isize<1) {
328 isize = 1;
329 }
330 radius = isize >> 1;
331
332 if (isize & 1) {
333 /* odd size */
334 x0 = x - radius;
335 x1 = x + radius;
336 y0 = y - radius;
337 y1 = y + radius;
338 }
339 else {
340 /* even size */
341 x0 = (GLint) (x + 1.5F) - radius;
342 x1 = x0 + isize - 1;
343 y0 = (GLint) (y + 1.5F) - radius;
344 y1 = y0 + isize - 1;
345 }
346
347 red = VB->ColorPtr->data[i][0];
348 green = VB->ColorPtr->data[i][1];
349 blue = VB->ColorPtr->data[i][2];
350 alpha = VB->ColorPtr->data[i][3];
351
352 switch (VB->TexCoordPtr[0]->size) {
353 case 4:
354 s = VB->TexCoordPtr[0]->data[i][0]/VB->TexCoordPtr[0]->data[i][3];
355 t = VB->TexCoordPtr[0]->data[i][1]/VB->TexCoordPtr[0]->data[i][3];
356 u = VB->TexCoordPtr[0]->data[i][2]/VB->TexCoordPtr[0]->data[i][3];
357 break;
358 case 3:
359 s = VB->TexCoordPtr[0]->data[i][0];
360 t = VB->TexCoordPtr[0]->data[i][1];
361 u = VB->TexCoordPtr[0]->data[i][2];
362 break;
363 case 2:
364 s = VB->TexCoordPtr[0]->data[i][0];
365 t = VB->TexCoordPtr[0]->data[i][1];
366 u = 0.0;
367 break;
368 case 1:
369 s = VB->TexCoordPtr[0]->data[i][0];
370 t = 0.0;
371 u = 0.0;
372 break;
373 default:
374 /* should never get here */
375 s = t = u = 0.0;
376 gl_problem(ctx, "unexpected texcoord size in textured_rgba_points()");
377 }
378
379 /* don't think this is needed
380 PB_SET_COLOR( red, green, blue, alpha );
381 */
382
383 for (iy=y0;iy<=y1;iy++) {
384 for (ix=x0;ix<=x1;ix++) {
385 PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u );
386 }
387 }
388 PB_CHECK_FLUSH(ctx,PB);
389 }
390 }
391 }
392
393
394 /*
395 * Multitextured RGBA points.
396 */
397 static void multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
398 {
399 struct vertex_buffer *VB = ctx->VB;
400 struct pixel_buffer *PB = ctx->PB;
401 GLuint i;
402
403 for (i=first;i<=last;i++) {
404 if (VB->ClipMask[i]==0) {
405 GLint x, y, z;
406 GLint x0, x1, y0, y1;
407 GLint ix, iy;
408 GLint isize, radius;
409 GLint red, green, blue, alpha;
410 GLfloat s, t, u;
411 GLfloat s1, t1, u1;
412
413 x = (GLint) VB->Win.data[i][0];
414 y = (GLint) VB->Win.data[i][1];
415 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
416
417 isize = (GLint)
418 (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
419 if (isize<1) {
420 isize = 1;
421 }
422 radius = isize >> 1;
423
424 if (isize & 1) {
425 /* odd size */
426 x0 = x - radius;
427 x1 = x + radius;
428 y0 = y - radius;
429 y1 = y + radius;
430 }
431 else {
432 /* even size */
433 x0 = (GLint) (x + 1.5F) - radius;
434 x1 = x0 + isize - 1;
435 y0 = (GLint) (y + 1.5F) - radius;
436 y1 = y0 + isize - 1;
437 }
438
439 red = VB->ColorPtr->data[i][0];
440 green = VB->ColorPtr->data[i][1];
441 blue = VB->ColorPtr->data[i][2];
442 alpha = VB->ColorPtr->data[i][3];
443
444 switch (VB->TexCoordPtr[0]->size) {
445 case 4:
446 s = VB->TexCoordPtr[0]->data[i][0]/VB->TexCoordPtr[0]->data[i][3];
447 t = VB->TexCoordPtr[0]->data[i][1]/VB->TexCoordPtr[0]->data[i][3];
448 u = VB->TexCoordPtr[0]->data[i][2]/VB->TexCoordPtr[0]->data[i][3];
449 break;
450 case 3:
451 s = VB->TexCoordPtr[0]->data[i][0];
452 t = VB->TexCoordPtr[0]->data[i][1];
453 u = VB->TexCoordPtr[0]->data[i][2];
454 break;
455 case 2:
456 s = VB->TexCoordPtr[0]->data[i][0];
457 t = VB->TexCoordPtr[0]->data[i][1];
458 u = 0.0;
459 break;
460 case 1:
461 s = VB->TexCoordPtr[0]->data[i][0];
462 t = 0.0;
463 u = 0.0;
464 break;
465 default:
466 /* should never get here */
467 s = t = u = 0.0;
468 gl_problem(ctx, "unexpected texcoord size in multitextured_rgba_points()");
469 }
470
471 switch (VB->TexCoordPtr[1]->size) {
472 case 4:
473 s1 = VB->TexCoordPtr[1]->data[i][0]/VB->TexCoordPtr[1]->data[i][3];
474 t1 = VB->TexCoordPtr[1]->data[i][1]/VB->TexCoordPtr[1]->data[i][3];
475 u1 = VB->TexCoordPtr[1]->data[i][2]/VB->TexCoordPtr[1]->data[i][3];
476 break;
477 case 3:
478 s1 = VB->TexCoordPtr[1]->data[i][0];
479 t1 = VB->TexCoordPtr[1]->data[i][1];
480 u1 = VB->TexCoordPtr[1]->data[i][2];
481 break;
482 case 2:
483 s1 = VB->TexCoordPtr[1]->data[i][0];
484 t1 = VB->TexCoordPtr[1]->data[i][1];
485 u1 = 0.0;
486 break;
487 case 1:
488 s1 = VB->TexCoordPtr[1]->data[i][0];
489 t1 = 0.0;
490 u1 = 0.0;
491 break;
492 default:
493 /* should never get here */
494 s1 = t1 = u1 = 0.0;
495 gl_problem(ctx, "unexpected texcoord size in multitextured_rgba_points()");
496 }
497
498 for (iy=y0;iy<=y1;iy++) {
499 for (ix=x0;ix<=x1;ix++) {
500 PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u, s1, t1, u1 );
501 }
502 }
503 PB_CHECK_FLUSH(ctx,PB);
504 }
505 }
506 }
507
508
509
510
511 /*
512 * Antialiased points with or without texture mapping.
513 */
514 static void antialiased_rgba_points( GLcontext *ctx,
515 GLuint first, GLuint last )
516 {
517 struct vertex_buffer *VB = ctx->VB;
518 struct pixel_buffer *PB = ctx->PB;
519 GLuint i;
520 GLfloat radius, rmin, rmax, rmin2, rmax2, cscale;
521
522 radius = CLAMP( ctx->Point.Size, MIN_POINT_SIZE, MAX_POINT_SIZE ) * 0.5F;
523 rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
524 rmax = radius + 0.7071F;
525 rmin2 = rmin*rmin;
526 rmax2 = rmax*rmax;
527 cscale = 256.0F / (rmax2-rmin2);
528
529 if (ctx->Texture.ReallyEnabled) {
530 for (i=first;i<=last;i++) {
531 if (VB->ClipMask[i]==0) {
532 GLint xmin, ymin, xmax, ymax;
533 GLint x, y, z;
534 GLint red, green, blue, alpha;
535 GLfloat s, t, u;
536 GLfloat s1, t1, u1;
537
538 xmin = (GLint) (VB->Win.data[i][0] - radius);
539 xmax = (GLint) (VB->Win.data[i][0] + radius);
540 ymin = (GLint) (VB->Win.data[i][1] - radius);
541 ymax = (GLint) (VB->Win.data[i][1] + radius);
542 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
543
544 red = VB->ColorPtr->data[i][0];
545 green = VB->ColorPtr->data[i][1];
546 blue = VB->ColorPtr->data[i][2];
547
548 switch (VB->TexCoordPtr[0]->size) {
549 case 4:
550 s = (VB->TexCoordPtr[0]->data[i][0]/
551 VB->TexCoordPtr[0]->data[i][3]);
552 t = (VB->TexCoordPtr[0]->data[i][1]/
553 VB->TexCoordPtr[0]->data[i][3]);
554 u = (VB->TexCoordPtr[0]->data[i][2]/
555 VB->TexCoordPtr[0]->data[i][3]);
556 break;
557 case 3:
558 s = VB->TexCoordPtr[0]->data[i][0];
559 t = VB->TexCoordPtr[0]->data[i][1];
560 u = VB->TexCoordPtr[0]->data[i][2];
561 break;
562 case 2:
563 s = VB->TexCoordPtr[0]->data[i][0];
564 t = VB->TexCoordPtr[0]->data[i][1];
565 u = 0.0;
566 break;
567 case 1:
568 s = VB->TexCoordPtr[0]->data[i][0];
569 t = 0.0;
570 u = 0.0;
571 break;
572 default:
573 /* should never get here */
574 s = t = u = 0.0;
575 gl_problem(ctx, "unexpected texcoord size in antialiased_rgba_points()");
576 }
577
578 if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
579 /* Multitextured! This is probably a slow enough path that
580 there's no reason to specialize the multitexture case. */
581 switch (VB->TexCoordPtr[1]->size) {
582 case 4:
583 s1 = ( VB->TexCoordPtr[1]->data[i][0] /
584 VB->TexCoordPtr[1]->data[i][3]);
585 t1 = ( VB->TexCoordPtr[1]->data[i][1] /
586 VB->TexCoordPtr[1]->data[i][3]);
587 u1 = ( VB->TexCoordPtr[1]->data[i][2] /
588 VB->TexCoordPtr[1]->data[i][3]);
589 break;
590 case 3:
591 s1 = VB->TexCoordPtr[1]->data[i][0];
592 t1 = VB->TexCoordPtr[1]->data[i][1];
593 u1 = VB->TexCoordPtr[1]->data[i][2];
594 break;
595 case 2:
596 s1 = VB->TexCoordPtr[1]->data[i][0];
597 t1 = VB->TexCoordPtr[1]->data[i][1];
598 u1 = 0.0;
599 break;
600 case 1:
601 s1 = VB->TexCoordPtr[1]->data[i][0];
602 t1 = 0.0;
603 u1 = 0.0;
604 break;
605 default:
606 /* should never get here */
607 s1 = t1 = u1 = 0.0;
608 gl_problem(ctx, "unexpected texcoord size in antialiased_rgba_points()");
609 }
610 }
611
612 for (y=ymin;y<=ymax;y++) {
613 for (x=xmin;x<=xmax;x++) {
614 GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
615 GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
616 GLfloat dist2 = dx*dx + dy*dy;
617 if (dist2<rmax2) {
618 alpha = VB->ColorPtr->data[i][3];
619 if (dist2>=rmin2) {
620 GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
621 /* coverage is in [0,256] */
622 alpha = (alpha * coverage) >> 8;
623 }
624 if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
625 PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue,
626 alpha, s, t, u, s1, t1, u1 );
627 } else {
628 PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue,
629 alpha, s, t, u );
630 }
631 }
632 }
633 }
634
635 PB_CHECK_FLUSH(ctx,PB);
636 }
637 }
638 }
639 else {
640 /* Not texture mapped */
641 for (i=first;i<=last;i++) {
642 if (VB->ClipMask[i]==0) {
643 GLint xmin, ymin, xmax, ymax;
644 GLint x, y, z;
645 GLint red, green, blue, alpha;
646
647 xmin = (GLint) (VB->Win.data[i][0] - radius);
648 xmax = (GLint) (VB->Win.data[i][0] + radius);
649 ymin = (GLint) (VB->Win.data[i][1] - radius);
650 ymax = (GLint) (VB->Win.data[i][1] + radius);
651 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
652
653 red = VB->ColorPtr->data[i][0];
654 green = VB->ColorPtr->data[i][1];
655 blue = VB->ColorPtr->data[i][2];
656
657 for (y=ymin;y<=ymax;y++) {
658 for (x=xmin;x<=xmax;x++) {
659 GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
660 GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
661 GLfloat dist2 = dx*dx + dy*dy;
662 if (dist2<rmax2) {
663 alpha = VB->ColorPtr->data[i][3];
664 if (dist2>=rmin2) {
665 GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
666 /* coverage is in [0,256] */
667 alpha = (alpha * coverage) >> 8;
668 }
669 PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue,
670 alpha );
671 }
672 }
673 }
674 PB_CHECK_FLUSH(ctx,PB);
675 }
676 }
677 }
678 }
679
680
681
682 /*
683 * Null rasterizer for measuring transformation speed.
684 */
685 static void null_points( GLcontext *ctx, GLuint first, GLuint last )
686 {
687 (void) ctx;
688 (void) first;
689 (void) last;
690 }
691
692
693
694 /* Definition of the functions for GL_EXT_point_parameters */
695
696 /* Calculates the distance attenuation formula of a vector of points in
697 * eye space coordinates
698 */
699 static void dist3(GLfloat *out, GLuint first, GLuint last,
700 const GLcontext *ctx, const GLvector4f *v)
701 {
702 GLuint stride = v->stride;
703 GLfloat *p = VEC_ELT(v, GLfloat, first);
704 GLuint i;
705
706 for (i = first ; i <= last ; i++, STRIDE_F(p, stride) )
707 {
708 GLfloat dist = GL_SQRT(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
709 out[i] = 1/(ctx->Point.Params[0]+
710 dist * (ctx->Point.Params[1] +
711 dist * ctx->Point.Params[2]));
712 }
713 }
714
715 static void dist2(GLfloat *out, GLuint first, GLuint last,
716 const GLcontext *ctx, const GLvector4f *v)
717 {
718 GLuint stride = v->stride;
719 GLfloat *p = VEC_ELT(v, GLfloat, first);
720 GLuint i;
721
722 for (i = first ; i <= last ; i++, STRIDE_F(p, stride) )
723 {
724 GLfloat dist = GL_SQRT(p[0]*p[0]+p[1]*p[1]);
725 out[i] = 1/(ctx->Point.Params[0]+
726 dist * (ctx->Point.Params[1] +
727 dist * ctx->Point.Params[2]));
728 }
729 }
730
731
732 typedef void (*dist_func)(GLfloat *out, GLuint first, GLuint last,
733 const GLcontext *ctx, const GLvector4f *v);
734
735
736 static dist_func eye_dist_tab[5] = {
737 0,
738 0,
739 dist2,
740 dist3,
741 dist3
742 };
743
744
745 static void clip_dist(GLfloat *out, GLuint first, GLuint last,
746 const GLcontext *ctx, GLvector4f *clip)
747 {
748 /* this is never called */
749 gl_problem(NULL, "clip_dist() called - dead code!\n");
750
751 (void) out;
752 (void) first;
753 (void) last;
754 (void) ctx;
755 (void) clip;
756
757 #if 0
758 GLuint i;
759 const GLfloat *from = (GLfloat *)clip_vec->start;
760 const GLuint stride = clip_vec->stride;
761
762 for (i = first ; i <= last ; i++ )
763 {
764 GLfloat dist = win[i][2];
765 out[i] = 1/(ctx->Point.Params[0]+
766 dist * (ctx->Point.Params[1] +
767 dist * ctx->Point.Params[2]));
768 }
769 #endif
770 }
771
772
773
774 /*
775 * Distance Attenuated General CI points.
776 */
777 static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first,
778 GLuint last )
779 {
780 struct vertex_buffer *VB = ctx->VB;
781 struct pixel_buffer *PB = ctx->PB;
782 GLuint i;
783 GLfloat psize,dsize;
784 GLfloat dist[VB_SIZE];
785 psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE);
786
787 if (ctx->NeedEyeCoords)
788 (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
789 else
790 clip_dist( dist, first, last, ctx, VB->ClipPtr );
791
792 for (i=first;i<=last;i++) {
793 if (VB->ClipMask[i]==0) {
794 GLint x, y, z;
795 GLint x0, x1, y0, y1;
796 GLint ix, iy;
797 GLint isize, radius;
798
799 x = (GLint) VB->Win.data[i][0];
800 y = (GLint) VB->Win.data[i][1];
801 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
802
803 dsize=psize*dist[i];
804 if(dsize>=ctx->Point.Threshold) {
805 isize=(GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F);
806 } else {
807 isize=(GLint) (MAX2(ctx->Point.Threshold,ctx->Point.MinSize)+0.5F);
808 }
809 radius = isize >> 1;
810
811 if (isize & 1) {
812 /* odd size */
813 x0 = x - radius;
814 x1 = x + radius;
815 y0 = y - radius;
816 y1 = y + radius;
817 }
818 else {
819 /* even size */
820 x0 = (GLint) (x + 1.5F) - radius;
821 x1 = x0 + isize - 1;
822 y0 = (GLint) (y + 1.5F) - radius;
823 y1 = y0 + isize - 1;
824 }
825
826 PB_SET_INDEX( ctx, PB, VB->IndexPtr->data[i] );
827
828 for (iy=y0;iy<=y1;iy++) {
829 for (ix=x0;ix<=x1;ix++) {
830 PB_WRITE_PIXEL( PB, ix, iy, z );
831 }
832 }
833 PB_CHECK_FLUSH(ctx,PB);
834 }
835 }
836 }
837
838 /*
839 * Distance Attenuated General RGBA points.
840 */
841 static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first,
842 GLuint last )
843 {
844 struct vertex_buffer *VB = ctx->VB;
845 struct pixel_buffer *PB = ctx->PB;
846 GLuint i;
847 GLubyte alpha;
848 GLfloat psize,dsize;
849 GLfloat dist[VB_SIZE];
850 psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE);
851
852 if (ctx->NeedEyeCoords)
853 (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
854 else
855 clip_dist( dist, first, last, ctx, VB->ClipPtr );
856
857 for (i=first;i<=last;i++) {
858 if (VB->ClipMask[i]==0) {
859 GLint x, y, z;
860 GLint x0, x1, y0, y1;
861 GLint ix, iy;
862 GLint isize, radius;
863
864 x = (GLint) VB->Win.data[i][0];
865 y = (GLint) VB->Win.data[i][1];
866 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
867 dsize=psize*dist[i];
868 if (dsize >= ctx->Point.Threshold) {
869 isize = (GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F);
870 alpha = VB->ColorPtr->data[i][3];
871 }
872 else {
873 isize = (GLint) (MAX2(ctx->Point.Threshold,ctx->Point.MinSize)+0.5F);
874 dsize /= ctx->Point.Threshold;
875 alpha = (GLint) (VB->ColorPtr->data[i][3]* (dsize*dsize));
876 }
877 radius = isize >> 1;
878
879 if (isize & 1) {
880 /* odd size */
881 x0 = x - radius;
882 x1 = x + radius;
883 y0 = y - radius;
884 y1 = y + radius;
885 }
886 else {
887 /* even size */
888 x0 = (GLint) (x + 1.5F) - radius;
889 x1 = x0 + isize - 1;
890 y0 = (GLint) (y + 1.5F) - radius;
891 y1 = y0 + isize - 1;
892 }
893
894 PB_SET_COLOR( ctx, PB,
895 VB->ColorPtr->data[i][0],
896 VB->ColorPtr->data[i][1],
897 VB->ColorPtr->data[i][2],
898 alpha );
899
900 for (iy=y0;iy<=y1;iy++) {
901 for (ix=x0;ix<=x1;ix++) {
902 PB_WRITE_PIXEL( PB, ix, iy, z );
903 }
904 }
905 PB_CHECK_FLUSH(ctx,PB);
906 }
907 }
908 }
909
910 /*
911 * Distance Attenuated Textured RGBA points.
912 */
913 static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first,
914 GLuint last )
915 {
916 struct vertex_buffer *VB = ctx->VB;
917 struct pixel_buffer *PB = ctx->PB;
918 GLuint i;
919 GLfloat psize,dsize;
920 GLfloat dist[VB_SIZE];
921 psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE);
922
923 if (ctx->NeedEyeCoords)
924 (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
925 else
926 clip_dist( dist, first, last, ctx, VB->ClipPtr );
927
928 for (i=first;i<=last;i++) {
929 if (VB->ClipMask[i]==0) {
930 GLint x, y, z;
931 GLint x0, x1, y0, y1;
932 GLint ix, iy;
933 GLint isize, radius;
934 GLint red, green, blue, alpha;
935 GLfloat s, t, u;
936 GLfloat s1, t1, u1;
937
938 x = (GLint) VB->Win.data[i][0];
939 y = (GLint) VB->Win.data[i][1];
940 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
941
942 dsize=psize*dist[i];
943 if(dsize>=ctx->Point.Threshold) {
944 isize=(GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F);
945 alpha=VB->ColorPtr->data[i][3];
946 } else {
947 isize=(GLint) (MAX2(ctx->Point.Threshold,ctx->Point.MinSize)+0.5F);
948 dsize/=ctx->Point.Threshold;
949 alpha = (GLint) (VB->ColorPtr->data[i][3]* (dsize*dsize));
950 }
951
952 if (isize<1) {
953 isize = 1;
954 }
955 radius = isize >> 1;
956
957 if (isize & 1) {
958 /* odd size */
959 x0 = x - radius;
960 x1 = x + radius;
961 y0 = y - radius;
962 y1 = y + radius;
963 }
964 else {
965 /* even size */
966 x0 = (GLint) (x + 1.5F) - radius;
967 x1 = x0 + isize - 1;
968 y0 = (GLint) (y + 1.5F) - radius;
969 y1 = y0 + isize - 1;
970 }
971
972 red = VB->ColorPtr->data[i][0];
973 green = VB->ColorPtr->data[i][1];
974 blue = VB->ColorPtr->data[i][2];
975
976 switch (VB->TexCoordPtr[0]->size) {
977 case 4:
978 s = (VB->TexCoordPtr[0]->data[i][0]/
979 VB->TexCoordPtr[0]->data[i][3]);
980 t = (VB->TexCoordPtr[0]->data[i][1]/
981 VB->TexCoordPtr[0]->data[i][3]);
982 u = (VB->TexCoordPtr[0]->data[i][2]/
983 VB->TexCoordPtr[0]->data[i][3]);
984 break;
985 case 3:
986 s = VB->TexCoordPtr[0]->data[i][0];
987 t = VB->TexCoordPtr[0]->data[i][1];
988 u = VB->TexCoordPtr[0]->data[i][2];
989 break;
990 case 2:
991 s = VB->TexCoordPtr[0]->data[i][0];
992 t = VB->TexCoordPtr[0]->data[i][1];
993 u = 0.0;
994 break;
995 case 1:
996 s = VB->TexCoordPtr[0]->data[i][0];
997 t = 0.0;
998 u = 0.0;
999 break;
1000 default:
1001 /* should never get here */
1002 s = t = u = 0.0;
1003 gl_problem(ctx, "unexpected texcoord size in dist_atten_textured_rgba_points()");
1004 }
1005
1006 if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
1007 /* Multitextured! This is probably a slow enough path that
1008 there's no reason to specialize the multitexture case. */
1009 switch (VB->TexCoordPtr[1]->size) {
1010 case 4:
1011 s1 = ( VB->TexCoordPtr[1]->data[i][0] /
1012 VB->TexCoordPtr[1]->data[i][3] );
1013 t1 = ( VB->TexCoordPtr[1]->data[i][1] /
1014 VB->TexCoordPtr[1]->data[i][3] );
1015 u1 = ( VB->TexCoordPtr[1]->data[i][2] /
1016 VB->TexCoordPtr[1]->data[i][3] );
1017 break;
1018 case 3:
1019 s1 = VB->TexCoordPtr[1]->data[i][0];
1020 t1 = VB->TexCoordPtr[1]->data[i][1];
1021 u1 = VB->TexCoordPtr[1]->data[i][2];
1022 break;
1023 case 2:
1024 s1 = VB->TexCoordPtr[1]->data[i][0];
1025 t1 = VB->TexCoordPtr[1]->data[i][1];
1026 u1 = 0.0;
1027 break;
1028 case 1:
1029 s1 = VB->TexCoordPtr[1]->data[i][0];
1030 t1 = 0.0;
1031 u1 = 0.0;
1032 break;
1033 default:
1034 /* should never get here */
1035 s1 = t1 = u1 = 0.0;
1036 gl_problem(ctx, "unexpected texcoord size in dist_atten_textured_rgba_points()");
1037 }
1038 }
1039
1040 /* don't think this is needed
1041 PB_SET_COLOR( red, green, blue, alpha );
1042 */
1043
1044 for (iy=y0;iy<=y1;iy++) {
1045 for (ix=x0;ix<=x1;ix++) {
1046 if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
1047 PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u, s1, t1, u1 );
1048 } else {
1049 PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u );
1050 }
1051 }
1052 }
1053 PB_CHECK_FLUSH(ctx,PB);
1054 }
1055 }
1056 }
1057
1058 /*
1059 * Distance Attenuated Antialiased points with or without texture mapping.
1060 */
1061 static void dist_atten_antialiased_rgba_points( GLcontext *ctx,
1062 GLuint first, GLuint last )
1063 {
1064 struct vertex_buffer *VB = ctx->VB;
1065 struct pixel_buffer *PB = ctx->PB;
1066 GLuint i;
1067 GLfloat radius, rmin, rmax, rmin2, rmax2, cscale;
1068 GLfloat psize,dsize,alphaf;
1069 GLfloat dist[VB_SIZE];
1070 psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE);
1071
1072 if (ctx->NeedEyeCoords)
1073 (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr );
1074 else
1075 clip_dist( dist, first, last, ctx, VB->ClipPtr );
1076
1077 if (ctx->Texture.ReallyEnabled) {
1078 for (i=first;i<=last;i++) {
1079 if (VB->ClipMask[i]==0) {
1080 GLint xmin, ymin, xmax, ymax;
1081 GLint x, y, z;
1082 GLint red, green, blue, alpha;
1083 GLfloat s, t, u;
1084 GLfloat s1, t1, u1;
1085
1086 dsize=psize*dist[i];
1087 if(dsize>=ctx->Point.Threshold) {
1088 radius=(MIN2(dsize,ctx->Point.MaxSize)*0.5F);
1089 alphaf=1.0;
1090 } else {
1091 radius=(MAX2(ctx->Point.Threshold,ctx->Point.MinSize)*0.5F);
1092 dsize/=ctx->Point.Threshold;
1093 alphaf=(dsize*dsize);
1094 }
1095 rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
1096 rmax = radius + 0.7071F;
1097 rmin2 = rmin*rmin;
1098 rmax2 = rmax*rmax;
1099 cscale = 256.0F / (rmax2-rmin2);
1100
1101 xmin = (GLint) (VB->Win.data[i][0] - radius);
1102 xmax = (GLint) (VB->Win.data[i][0] + radius);
1103 ymin = (GLint) (VB->Win.data[i][1] - radius);
1104 ymax = (GLint) (VB->Win.data[i][1] + radius);
1105 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
1106
1107 red = VB->ColorPtr->data[i][0];
1108 green = VB->ColorPtr->data[i][1];
1109 blue = VB->ColorPtr->data[i][2];
1110
1111 switch (VB->TexCoordPtr[0]->size) {
1112 case 4:
1113 s = (VB->TexCoordPtr[0]->data[i][0]/
1114 VB->TexCoordPtr[0]->data[i][3]);
1115 t = (VB->TexCoordPtr[0]->data[i][1]/
1116 VB->TexCoordPtr[0]->data[i][3]);
1117 u = (VB->TexCoordPtr[0]->data[i][2]/
1118 VB->TexCoordPtr[0]->data[i][3]);
1119 break;
1120 case 3:
1121 s = VB->TexCoordPtr[0]->data[i][0];
1122 t = VB->TexCoordPtr[0]->data[i][1];
1123 u = VB->TexCoordPtr[0]->data[i][2];
1124 break;
1125 case 2:
1126 s = VB->TexCoordPtr[0]->data[i][0];
1127 t = VB->TexCoordPtr[0]->data[i][1];
1128 u = 0.0;
1129 break;
1130 case 1:
1131 s = VB->TexCoordPtr[0]->data[i][0];
1132 t = 0.0;
1133 u = 0.0;
1134 break;
1135 default:
1136 /* should never get here */
1137 s = t = u = 0.0;
1138 gl_problem(ctx, "unexpected texcoord size in dist_atten_antialiased_rgba_points()");
1139 }
1140
1141 if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
1142 /* Multitextured! This is probably a slow enough path that
1143 there's no reason to specialize the multitexture case. */
1144 switch (VB->TexCoordPtr[1]->size) {
1145 case 4:
1146 s1 = ( VB->TexCoordPtr[1]->data[i][0] /
1147 VB->TexCoordPtr[1]->data[i][3] );
1148 t1 = ( VB->TexCoordPtr[1]->data[i][1] /
1149 VB->TexCoordPtr[1]->data[i][3] );
1150 u1 = ( VB->TexCoordPtr[1]->data[i][2] /
1151 VB->TexCoordPtr[1]->data[i][3] );
1152 break;
1153 case 3:
1154 s1 = VB->TexCoordPtr[1]->data[i][0];
1155 t1 = VB->TexCoordPtr[1]->data[i][1];
1156 u1 = VB->TexCoordPtr[1]->data[i][2];
1157 break;
1158 case 2:
1159 s1 = VB->TexCoordPtr[1]->data[i][0];
1160 t1 = VB->TexCoordPtr[1]->data[i][1];
1161 u1 = 0.0;
1162 break;
1163 case 1:
1164 s1 = VB->TexCoordPtr[1]->data[i][0];
1165 t1 = 0.0;
1166 u1 = 0.0;
1167 break;
1168 default:
1169 /* should never get here */
1170 s = t = u = 0.0;
1171 gl_problem(ctx, "unexpected texcoord size in dist_atten_antialiased_rgba_points()");
1172 }
1173 }
1174
1175 for (y=ymin;y<=ymax;y++) {
1176 for (x=xmin;x<=xmax;x++) {
1177 GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
1178 GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
1179 GLfloat dist2 = dx*dx + dy*dy;
1180 if (dist2<rmax2) {
1181 alpha = VB->ColorPtr->data[i][3];
1182 if (dist2>=rmin2) {
1183 GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
1184 /* coverage is in [0,256] */
1185 alpha = (alpha * coverage) >> 8;
1186 }
1187 alpha = (GLint) (alpha * alphaf);
1188 if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
1189 PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue, alpha, s, t, u, s1, t1, u1 );
1190 } else {
1191 PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha, s, t, u );
1192 }
1193 }
1194 }
1195 }
1196 PB_CHECK_FLUSH(ctx,PB);
1197 }
1198 }
1199 }
1200 else {
1201 /* Not texture mapped */
1202 for (i=first;i<=last;i++) {
1203 if (VB->ClipMask[i]==0) {
1204 GLint xmin, ymin, xmax, ymax;
1205 GLint x, y, z;
1206 GLint red, green, blue, alpha;
1207
1208 dsize=psize*dist[i];
1209 if(dsize>=ctx->Point.Threshold) {
1210 radius=(MIN2(dsize,ctx->Point.MaxSize)*0.5F);
1211 alphaf=1.0;
1212 } else {
1213 radius=(MAX2(ctx->Point.Threshold,ctx->Point.MinSize)*0.5F);
1214 dsize/=ctx->Point.Threshold;
1215 alphaf=(dsize*dsize);
1216 }
1217 rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
1218 rmax = radius + 0.7071F;
1219 rmin2 = rmin*rmin;
1220 rmax2 = rmax*rmax;
1221 cscale = 256.0F / (rmax2-rmin2);
1222
1223 xmin = (GLint) (VB->Win.data[i][0] - radius);
1224 xmax = (GLint) (VB->Win.data[i][0] + radius);
1225 ymin = (GLint) (VB->Win.data[i][1] - radius);
1226 ymax = (GLint) (VB->Win.data[i][1] + radius);
1227 z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
1228
1229 red = VB->ColorPtr->data[i][0];
1230 green = VB->ColorPtr->data[i][1];
1231 blue = VB->ColorPtr->data[i][2];
1232
1233 for (y=ymin;y<=ymax;y++) {
1234 for (x=xmin;x<=xmax;x++) {
1235 GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
1236 GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
1237 GLfloat dist2 = dx*dx + dy*dy;
1238 if (dist2<rmax2) {
1239 alpha = VB->ColorPtr->data[i][3];
1240 if (dist2>=rmin2) {
1241 GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
1242 /* coverage is in [0,256] */
1243 alpha = (alpha * coverage) >> 8;
1244 }
1245 alpha = (GLint) (alpha * alphaf);
1246 PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha )
1247 ;
1248 }
1249 }
1250 }
1251 PB_CHECK_FLUSH(ctx,PB);
1252 }
1253 }
1254 }
1255 }
1256
1257
1258 /*
1259 * Examine the current context to determine which point drawing function
1260 * should be used.
1261 */
1262 void gl_set_point_function( GLcontext *ctx )
1263 {
1264 GLboolean rgbmode = ctx->Visual->RGBAflag;
1265
1266 if (ctx->RenderMode==GL_RENDER) {
1267 if (ctx->NoRaster) {
1268 ctx->Driver.PointsFunc = null_points;
1269 return;
1270 }
1271 if (ctx->Driver.PointsFunc) {
1272 /* Device driver will draw points. */
1273 ctx->IndirectTriangles &= ~DD_POINT_SW_RASTERIZE;
1274 return;
1275 }
1276
1277 if (!ctx->Point.Attenuated) {
1278 if (ctx->Point.SmoothFlag && rgbmode) {
1279 ctx->Driver.PointsFunc = antialiased_rgba_points;
1280 }
1281 else if (ctx->Texture.ReallyEnabled) {
1282 if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
1283 ctx->Driver.PointsFunc = multitextured_rgba_points;
1284 }
1285 else {
1286 ctx->Driver.PointsFunc = textured_rgba_points;
1287 }
1288 }
1289 else if (ctx->Point.Size==1.0) {
1290 /* size=1, any raster ops */
1291 if (rgbmode)
1292 ctx->Driver.PointsFunc = size1_rgba_points;
1293 else
1294 ctx->Driver.PointsFunc = size1_ci_points;
1295 }
1296 else {
1297 /* every other kind of point rendering */
1298 if (rgbmode)
1299 ctx->Driver.PointsFunc = general_rgba_points;
1300 else
1301 ctx->Driver.PointsFunc = general_ci_points;
1302 }
1303 }
1304 else if(ctx->Point.SmoothFlag && rgbmode) {
1305 ctx->Driver.PointsFunc = dist_atten_antialiased_rgba_points;
1306 }
1307 else if (ctx->Texture.ReallyEnabled) {
1308 ctx->Driver.PointsFunc = dist_atten_textured_rgba_points;
1309 }
1310 else {
1311 /* every other kind of point rendering */
1312 if (rgbmode)
1313 ctx->Driver.PointsFunc = dist_atten_general_rgba_points;
1314 else
1315 ctx->Driver.PointsFunc = dist_atten_general_ci_points;
1316 }
1317 }
1318 else if (ctx->RenderMode==GL_FEEDBACK) {
1319 ctx->Driver.PointsFunc = gl_feedback_points;
1320 }
1321 else {
1322 /* GL_SELECT mode */
1323 ctx->Driver.PointsFunc = gl_select_points;
1324 }
1325
1326 }
1327