ReactOS 0.4.15-dev-7788-g1ad9096
points.c File Reference
#include "context.h"
#include "feedback.h"
#include "dlist.h"
#include "macros.h"
#include "pb.h"
#include "span.h"
#include "texstate.h"
#include "types.h"
#include "vb.h"
#include "mmath.h"
Include dependency graph for points.c:

Go to the source code of this file.

Functions

void gl_PointSize (GLcontext *ctx, GLfloat size)
 
static void feedback_points (GLcontext *ctx, GLuint first, GLuint last)
 
static void select_points (GLcontext *ctx, GLuint first, GLuint last)
 
void size1_ci_points (GLcontext *ctx, GLuint first, GLuint last)
 
static void size1_rgba_points (GLcontext *ctx, GLuint first, GLuint last)
 
static void general_ci_points (GLcontext *ctx, GLuint first, GLuint last)
 
static void general_rgba_points (GLcontext *ctx, GLuint first, GLuint last)
 
static void textured_rgba_points (GLcontext *ctx, GLuint first, GLuint last)
 
static void antialiased_rgba_points (GLcontext *ctx, GLuint first, GLuint last)
 
static void null_points (GLcontext *ctx, GLuint first, GLuint last)
 
void gl_set_point_function (GLcontext *ctx)
 

Function Documentation

◆ antialiased_rgba_points()

static void antialiased_rgba_points ( GLcontext ctx,
GLuint  first,
GLuint  last 
)
static

Definition at line 430 of file points.c.

432{
433 struct vertex_buffer *VB = ctx->VB;
434 struct pixel_buffer *PB = ctx->PB;
435 GLuint i;
436 GLfloat radius, rmin, rmax, rmin2, rmax2, cscale;
437
438 radius = CLAMP( ctx->Point.Size, MIN_POINT_SIZE, MAX_POINT_SIZE ) * 0.5F;
439 rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
440 rmax = radius + 0.7071F;
441 rmin2 = rmin*rmin;
442 rmax2 = rmax*rmax;
443 cscale = 256.0F / (rmax2-rmin2);
444
445 if (ctx->Texture.Enabled) {
446 for (i=first;i<=last;i++) {
447 if (VB->ClipMask[i]==0) {
448 GLint xmin, ymin, xmax, ymax;
449 GLint x, y, z;
451 GLfloat s, t, u;
452
453 xmin = (GLint) (VB->Win[i][0] - radius);
454 xmax = (GLint) (VB->Win[i][0] + radius);
455 ymin = (GLint) (VB->Win[i][1] - radius);
456 ymax = (GLint) (VB->Win[i][1] + radius);
457 z = (GLint) (VB->Win[i][2] + ctx->PointZoffset);
458
459 red = VB->Color[i][0];
460 green = VB->Color[i][1];
461 blue = VB->Color[i][2];
462 s = VB->TexCoord[i][0] / VB->TexCoord[i][3];
463 t = VB->TexCoord[i][1] / VB->TexCoord[i][3];
464 u = VB->TexCoord[i][2] / VB->TexCoord[i][3];
465
466 for (y=ymin;y<=ymax;y++) {
467 for (x=xmin;x<=xmax;x++) {
468 GLfloat dx = x/*+0.5F*/ - VB->Win[i][0];
469 GLfloat dy = y/*+0.5F*/ - VB->Win[i][1];
470 GLfloat dist2 = dx*dx + dy*dy;
471 if (dist2<rmax2) {
472 alpha = VB->Color[i][3];
473 if (dist2>=rmin2) {
474 GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
475 /* coverage is in [0,256] */
476 alpha = (alpha * coverage) >> 8;
477 }
479 }
480 }
481 }
483 }
484 }
485 }
486 else {
487 /* Not texture mapped */
488 for (i=first;i<=last;i++) {
489 if (VB->ClipMask[i]==0) {
490 GLint xmin, ymin, xmax, ymax;
491 GLint x, y, z;
493
494 xmin = (GLint) (VB->Win[i][0] - radius);
495 xmax = (GLint) (VB->Win[i][0] + radius);
496 ymin = (GLint) (VB->Win[i][1] - radius);
497 ymax = (GLint) (VB->Win[i][1] + radius);
498 z = (GLint) (VB->Win[i][2] + ctx->PointZoffset);
499
500 red = VB->Color[i][0];
501 green = VB->Color[i][1];
502 blue = VB->Color[i][2];
503
504 for (y=ymin;y<=ymax;y++) {
505 for (x=xmin;x<=xmax;x++) {
506 GLfloat dx = x/*+0.5F*/ - VB->Win[i][0];
507 GLfloat dy = y/*+0.5F*/ - VB->Win[i][1];
508 GLfloat dist2 = dx*dx + dy*dy;
509 if (dist2<rmax2) {
510 alpha = VB->Color[i][3];
511 if (dist2>=rmin2) {
512 GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
513 /* coverage is in [0,256] */
514 alpha = (alpha * coverage) >> 8;
515 }
517 }
518 }
519 }
521 }
522 }
523 }
524}
#define MAX_POINT_SIZE
Definition: config.h:113
#define MIN_POINT_SIZE
Definition: config.h:112
#define PB
float GLfloat
Definition: gl.h:161
GLclampf green
Definition: gl.h:1740
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
GLdouble s
Definition: gl.h:2039
unsigned int GLuint
Definition: gl.h:159
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLclampf GLclampf blue
Definition: gl.h:1740
GLdouble GLdouble t
Definition: gl.h:2047
int GLint
Definition: gl.h:156
const GLint * first
Definition: glext.h:5794
GLdouble GLdouble z
Definition: glext.h:5874
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
#define red
Definition: linetest.c:67
static UINT UINT last
Definition: font.c:45
#define PB_WRITE_TEX_PIXEL(PB, X, Y, Z, R, G, B, A, S, T, U)
Definition: pb.h:150
#define PB_CHECK_FLUSH(CTX, PB)
Definition: pb.h:167
#define PB_WRITE_RGBA_PIXEL(PB, X, Y, Z, R, G, B, A)
Definition: pb.h:126
#define CLAMP(f, min, max)
Definition: tif_color.c:177
struct vertex_buffer * VB
Definition: tritemp.h:139

Referenced by gl_set_point_function().

◆ feedback_points()

static void feedback_points ( GLcontext ctx,
GLuint  first,
GLuint  last 
)
static

Definition at line 127 of file points.c.

128{
129 struct vertex_buffer *VB = ctx->VB;
130 GLuint i;
131 GLfloat invRedScale = ctx->Visual->InvRedScale;
132 GLfloat invGreenScale = ctx->Visual->InvGreenScale;
133 GLfloat invBlueScale = ctx->Visual->InvBlueScale;
134 GLfloat invAlphaScale = ctx->Visual->InvAlphaScale;
135
136 for (i=first;i<=last;i++) {
137 if (VB->ClipMask[i]==0) {
138 GLfloat x, y, z, w, invq;
139 GLfloat color[4], texcoord[4];
140
141 x = VB->Win[i][0];
142 y = VB->Win[i][1];
143 z = VB->Win[i][2] / DEPTH_SCALE;
144 w = VB->Clip[i][3];
145
146 /* convert color from integer back to a float in [0,1] */
147 if (ctx->Light.ShadeModel==GL_SMOOTH) {
148 /* smooth shading - colors are in fixed point */
149 color[0] = FixedToFloat(VB->Color[i][0]) * invRedScale;
150 color[1] = FixedToFloat(VB->Color[i][1]) * invGreenScale;
151 color[2] = FixedToFloat(VB->Color[i][2]) * invBlueScale;
152 color[3] = FixedToFloat(VB->Color[i][3]) * invAlphaScale;
153 }
154 else {
155 /* flat shading - colors are integers */
156 color[0] = VB->Color[i][0] * invRedScale;
157 color[1] = VB->Color[i][1] * invGreenScale;
158 color[2] = VB->Color[i][2] * invBlueScale;
159 color[3] = VB->Color[i][3] * invAlphaScale;
160 }
161 invq = 1.0F / VB->TexCoord[i][3];
162 texcoord[0] = VB->TexCoord[i][0] * invq;
163 texcoord[1] = VB->TexCoord[i][1] * invq;
164 texcoord[2] = VB->TexCoord[i][2] * invq;
165 texcoord[3] = VB->TexCoord[i][3];
166
169 (GLfloat) VB->Index[i], texcoord );
170 }
171 }
172}
#define DEPTH_SCALE
Definition: config.h:146
void gl_feedback_vertex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w, const GLfloat color[4], GLfloat index, const GLfloat texcoord[4])
Definition: feedback.c:161
#define FEEDBACK_TOKEN(CTX, T)
Definition: feedback.h:39
#define FixedToFloat(X)
Definition: fixed.h:52
#define GL_POINT_TOKEN
Definition: gl.h:397
#define GL_SMOOTH
Definition: gl.h:339
GLuint color
Definition: glext.h:6243
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102

Referenced by gl_set_point_function().

◆ general_ci_points()

static void general_ci_points ( GLcontext ctx,
GLuint  first,
GLuint  last 
)
static

Definition at line 257 of file points.c.

258{
259 struct vertex_buffer *VB = ctx->VB;
260 struct pixel_buffer *PB = ctx->PB;
261 GLuint i;
262 GLint isize;
263
264 isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
265
266 for (i=first;i<=last;i++) {
267 if (VB->ClipMask[i]==0) {
268 GLint x, y, z;
269 GLint x0, x1, y0, y1;
270 GLint ix, iy;
271
272 x = (GLint) VB->Win[i][0];
273 y = (GLint) VB->Win[i][1];
274 z = (GLint) (VB->Win[i][2] + ctx->PointZoffset);
275
276 if (isize&1) {
277 /* odd size */
278 x0 = x - isize/2;
279 x1 = x + isize/2;
280 y0 = y - isize/2;
281 y1 = y + isize/2;
282 }
283 else {
284 /* even size */
285 x0 = (GLint) (x + 0.5F) - isize/2;
286 x1 = x0 + isize-1;
287 y0 = (GLint) (y + 0.5F) - isize/2;
288 y1 = y0 + isize-1;
289 }
290
291 PB_SET_INDEX( ctx, PB, VB->Index[i] );
292
293 for (iy=y0;iy<=y1;iy++) {
294 for (ix=x0;ix<=x1;ix++) {
295 PB_WRITE_PIXEL( PB, ix, iy, z );
296 }
297 }
299 }
300 }
301}
GLint y0
Definition: linetemp.h:96
GLint x0
Definition: linetemp.h:95
#define PB_SET_INDEX(CTX, PB, I)
Definition: pb.h:105
#define PB_WRITE_PIXEL(PB, X, Y, Z)
Definition: pb.h:116
int iy
Definition: tritemp.h:491
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708

Referenced by gl_set_point_function().

◆ general_rgba_points()

static void general_rgba_points ( GLcontext ctx,
GLuint  first,
GLuint  last 
)
static

Definition at line 307 of file points.c.

308{
309 struct vertex_buffer *VB = ctx->VB;
310 struct pixel_buffer *PB = ctx->PB;
311 GLuint i;
312 GLint isize;
313
314 isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
315
316 for (i=first;i<=last;i++) {
317 if (VB->ClipMask[i]==0) {
318 GLint x, y, z;
319 GLint x0, x1, y0, y1;
320 GLint ix, iy;
321
322 x = (GLint) VB->Win[i][0];
323 y = (GLint) VB->Win[i][1];
324 z = (GLint) (VB->Win[i][2] + ctx->PointZoffset);
325
326 if (isize&1) {
327 /* odd size */
328 x0 = x - isize/2;
329 x1 = x + isize/2;
330 y0 = y - isize/2;
331 y1 = y + isize/2;
332 }
333 else {
334 /* even size */
335 x0 = (GLint) (x + 0.5F) - isize/2;
336 x1 = x0 + isize-1;
337 y0 = (GLint) (y + 0.5F) - isize/2;
338 y1 = y0 + isize-1;
339 }
340
342 VB->Color[i][0],
343 VB->Color[i][1],
344 VB->Color[i][2],
345 VB->Color[i][3] );
346
347 for (iy=y0;iy<=y1;iy++) {
348 for (ix=x0;ix<=x1;ix++) {
349 PB_WRITE_PIXEL( PB, ix, iy, z );
350 }
351 }
353 }
354 }
355}
#define PB_SET_COLOR(CTX, PB, R, G, B, A)
Definition: pb.h:89

Referenced by gl_set_point_function().

◆ gl_PointSize()

void gl_PointSize ( GLcontext ctx,
GLfloat  size 
)

Definition at line 91 of file points.c.

92{
93 if (size<=0.0) {
94 gl_error( ctx, GL_INVALID_VALUE, "glPointSize" );
95 return;
96 }
97 if (INSIDE_BEGIN_END(ctx)) {
98 gl_error( ctx, GL_INVALID_OPERATION, "glPointSize" );
99 return;
100 }
101 ctx->Point.Size = size;
102 ctx->NewState |= NEW_RASTER_OPS;
103}
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define NEW_RASTER_OPS
Definition: types.h:1233
#define GL_INVALID_VALUE
Definition: gl.h:695
#define GL_INVALID_OPERATION
Definition: gl.h:696
GLsizeiptr size
Definition: glext.h:5919
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135

Referenced by execute_list(), and init_exec_pointers().

◆ gl_set_point_function()

void gl_set_point_function ( GLcontext ctx)

Definition at line 541 of file points.c.

542{
543 GLboolean rgbmode = ctx->Visual->RGBAflag;
544
545 if (ctx->RenderMode==GL_RENDER) {
546 if (ctx->NoRaster) {
547 ctx->Driver.PointsFunc = null_points;
548 return;
549 }
550 if (ctx->Driver.PointsFunc) {
551 /* Device driver will draw points. */
552 ctx->Driver.PointsFunc = ctx->Driver.PointsFunc;
553 }
554 else {
555 if (ctx->Point.SmoothFlag && rgbmode) {
556 ctx->Driver.PointsFunc = antialiased_rgba_points;
557 }
558 else if (ctx->Texture.Enabled) {
559 ctx->Driver.PointsFunc = textured_rgba_points;
560 }
561 else if (ctx->Point.Size==1.0) {
562 /* size=1, any raster ops */
563 if (rgbmode)
564 ctx->Driver.PointsFunc = size1_rgba_points;
565 else
566 ctx->Driver.PointsFunc = size1_ci_points;
567 }
568 else {
569 /* every other kind of point rendering */
570 if (rgbmode)
571 ctx->Driver.PointsFunc = general_rgba_points;
572 else
573 ctx->Driver.PointsFunc = general_ci_points;
574 }
575 }
576 }
577 else if (ctx->RenderMode==GL_FEEDBACK) {
578 ctx->Driver.PointsFunc = feedback_points;
579 }
580 else {
581 /* GL_SELECT mode */
582 ctx->Driver.PointsFunc = select_points;
583 }
584
585}
#define GL_RENDER
Definition: gl.h:388
#define GL_FEEDBACK
Definition: gl.h:387
unsigned char GLboolean
Definition: gl.h:151
static void general_rgba_points(GLcontext *ctx, GLuint first, GLuint last)
Definition: points.c:307
static void select_points(GLcontext *ctx, GLuint first, GLuint last)
Definition: points.c:179
static void general_ci_points(GLcontext *ctx, GLuint first, GLuint last)
Definition: points.c:257
static void antialiased_rgba_points(GLcontext *ctx, GLuint first, GLuint last)
Definition: points.c:430
static void feedback_points(GLcontext *ctx, GLuint first, GLuint last)
Definition: points.c:127
void size1_ci_points(GLcontext *ctx, GLuint first, GLuint last)
Definition: points.c:195
static void null_points(GLcontext *ctx, GLuint first, GLuint last)
Definition: points.c:531
static void size1_rgba_points(GLcontext *ctx, GLuint first, GLuint last)
Definition: points.c:226
static void textured_rgba_points(GLcontext *ctx, GLuint first, GLuint last)
Definition: points.c:363

Referenced by gl_update_state().

◆ null_points()

static void null_points ( GLcontext ctx,
GLuint  first,
GLuint  last 
)
static

Definition at line 531 of file points.c.

532{
533}

Referenced by gl_set_point_function().

◆ select_points()

static void select_points ( GLcontext ctx,
GLuint  first,
GLuint  last 
)
static

Definition at line 179 of file points.c.

180{
181 struct vertex_buffer *VB = ctx->VB;
182 GLuint i;
183
184 for (i=first;i<=last;i++) {
185 if (VB->ClipMask[i]==0) {
186 gl_update_hitflag( ctx, VB->Win[i][2] / DEPTH_SCALE );
187 }
188 }
189}
void gl_update_hitflag(GLcontext *ctx, GLfloat z)
Definition: feedback.c:240

Referenced by gl_set_point_function().

◆ size1_ci_points()

void size1_ci_points ( GLcontext ctx,
GLuint  first,
GLuint  last 
)

Definition at line 195 of file points.c.

196{
197 struct vertex_buffer *VB = ctx->VB;
198 struct pixel_buffer *PB = ctx->PB;
199 GLfloat *win;
200 GLint *pbx = PB->x, *pby = PB->y;
201 GLdepth *pbz = PB->z;
202 GLuint *pbi = PB->i;
203 GLuint pbcount = PB->count;
204 GLuint i;
205
206 win = &VB->Win[first][0];
207 for (i=first;i<=last;i++) {
208 if (VB->ClipMask[i]==0) {
209 pbx[pbcount] = (GLint) win[0];
210 pby[pbcount] = (GLint) win[1];
211 pbz[pbcount] = (GLint) (win[2] + ctx->PointZoffset);
212 pbi[pbcount] = VB->Index[i];
213 pbcount++;
214 }
215 win += 3;
216 }
217 PB->count = pbcount;
219}
GLint GLdepth
Definition: types.h:218
static real win[4][36]
_Inout_ PERBANDINFO * pbi
Definition: winddi.h:3917

Referenced by gl_set_point_function().

◆ size1_rgba_points()

static void size1_rgba_points ( GLcontext ctx,
GLuint  first,
GLuint  last 
)
static

Definition at line 226 of file points.c.

227{
228 struct vertex_buffer *VB = ctx->VB;
229 struct pixel_buffer *PB = ctx->PB;
230 GLuint i;
231
232 for (i=first;i<=last;i++) {
233 if (VB->ClipMask[i]==0) {
234 GLint x, y, z;
236
237 x = (GLint) VB->Win[i][0];
238 y = (GLint) VB->Win[i][1];
239 z = (GLint) (VB->Win[i][2] + ctx->PointZoffset);
240
241 red = VB->Color[i][0];
242 green = VB->Color[i][1];
243 blue = VB->Color[i][2];
244 alpha = VB->Color[i][3];
245
247 }
248 }
250}

Referenced by gl_set_point_function().

◆ textured_rgba_points()

static void textured_rgba_points ( GLcontext ctx,
GLuint  first,
GLuint  last 
)
static

Definition at line 363 of file points.c.

364{
365 struct vertex_buffer *VB = ctx->VB;
366 struct pixel_buffer *PB = ctx->PB;
367 GLuint i;
368
369 for (i=first;i<=last;i++) {
370 if (VB->ClipMask[i]==0) {
371 GLint x, y, z;
372 GLint x0, x1, y0, y1;
373 GLint ix, iy;
374 GLint isize;
376 GLfloat s, t, u;
377
378 x = (GLint) VB->Win[i][0];
379 y = (GLint) VB->Win[i][1];
380 z = (GLint) (VB->Win[i][2] + ctx->PointZoffset);
381
382 isize = (GLint)
383 (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F);
384 if (isize<1) {
385 isize = 1;
386 }
387
388 if (isize&1) {
389 /* odd size */
390 x0 = x - isize/2;
391 x1 = x + isize/2;
392 y0 = y - isize/2;
393 y1 = y + isize/2;
394 }
395 else {
396 /* even size */
397 x0 = (GLint) (x + 0.5F) - isize/2;
398 x1 = x0 + isize-1;
399 y0 = (GLint) (y + 0.5F) - isize/2;
400 y1 = y0 + isize-1;
401 }
402
403 red = VB->Color[i][0];
404 green = VB->Color[i][1];
405 blue = VB->Color[i][2];
406 alpha = VB->Color[i][3];
407 s = VB->TexCoord[i][0] / VB->TexCoord[i][3];
408 t = VB->TexCoord[i][1] / VB->TexCoord[i][3];
409 u = VB->TexCoord[i][2] / VB->TexCoord[i][3];
410
411/* don't think this is needed
412 PB_SET_COLOR( red, green, blue, alpha );
413*/
414
415 for (iy=y0;iy<=y1;iy++) {
416 for (ix=x0;ix<=x1;ix++) {
417 PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u );
418 }
419 }
421 }
422 }
423}

Referenced by gl_set_point_function().