3 * Mesa 3-D graphics library
6 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 _mesa_PointSize( GLfloat size
)
39 GET_CURRENT_CONTEXT(ctx
);
40 ASSERT_OUTSIDE_BEGIN_END(ctx
);
43 _mesa_error( ctx
, GL_INVALID_VALUE
, "glPointSize" );
47 if (ctx
->Point
.Size
== size
)
50 FLUSH_VERTICES(ctx
, _NEW_POINT
);
51 ctx
->Point
.Size
= size
;
52 ctx
->Point
._Size
= CLAMP(size
,
53 ctx
->Const
.MinPointSize
,
54 ctx
->Const
.MaxPointSize
);
56 if (ctx
->Point
._Size
== 1.0F
)
57 ctx
->_TriangleCaps
&= ~DD_POINT_SIZE
;
59 ctx
->_TriangleCaps
|= DD_POINT_SIZE
;
61 if (ctx
->Driver
.PointSize
)
62 (*ctx
->Driver
.PointSize
)(ctx
, size
);
68 * Added by GL_NV_point_sprite
71 _mesa_PointParameteriNV( GLenum pname
, GLint param
)
73 const GLfloat value
= (GLfloat
) param
;
74 _mesa_PointParameterfvEXT(pname
, &value
);
79 * Added by GL_NV_point_sprite
82 _mesa_PointParameterivNV( GLenum pname
, const GLint
*params
)
84 const GLfloat value
= (GLfloat
) params
[0];
85 _mesa_PointParameterfvEXT(pname
, &value
);
91 * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
94 _mesa_PointParameterfEXT( GLenum pname
, GLfloat param
)
96 _mesa_PointParameterfvEXT(pname
, ¶m
);
102 * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters.
105 _mesa_PointParameterfvEXT( GLenum pname
, const GLfloat
*params
)
107 GET_CURRENT_CONTEXT(ctx
);
108 ASSERT_OUTSIDE_BEGIN_END(ctx
);
111 case GL_DISTANCE_ATTENUATION_EXT
:
112 if (ctx
->Extensions
.EXT_point_parameters
) {
113 const GLboolean tmp
= ctx
->Point
._Attenuated
;
114 if (TEST_EQ_3V(ctx
->Point
.Params
, params
))
117 FLUSH_VERTICES(ctx
, _NEW_POINT
);
118 COPY_3V(ctx
->Point
.Params
, params
);
120 /* Update several derived values now. This likely to be
121 * more efficient than trying to catch this statechange in
124 ctx
->Point
._Attenuated
= (params
[0] != 1.0 ||
128 if (tmp
!= ctx
->Point
._Attenuated
) {
129 ctx
->_TriangleCaps
^= DD_POINT_ATTEN
;
130 ctx
->_NeedEyeCoords
^= NEED_EYE_POINT_ATTEN
;
134 _mesa_error(ctx
, GL_INVALID_ENUM
,
135 "glPointParameterf[v]{EXT,ARB}(pname)");
139 case GL_POINT_SIZE_MIN_EXT
:
140 if (ctx
->Extensions
.EXT_point_parameters
) {
141 if (params
[0] < 0.0F
) {
142 _mesa_error( ctx
, GL_INVALID_VALUE
,
143 "glPointParameterf[v]{EXT,ARB}(param)" );
146 if (ctx
->Point
.MinSize
== params
[0])
148 FLUSH_VERTICES(ctx
, _NEW_POINT
);
149 ctx
->Point
.MinSize
= params
[0];
152 _mesa_error(ctx
, GL_INVALID_ENUM
,
153 "glPointParameterf[v]{EXT,ARB}(pname)");
157 case GL_POINT_SIZE_MAX_EXT
:
158 if (ctx
->Extensions
.EXT_point_parameters
) {
159 if (params
[0] < 0.0F
) {
160 _mesa_error( ctx
, GL_INVALID_VALUE
,
161 "glPointParameterf[v]{EXT,ARB}(param)" );
164 if (ctx
->Point
.MaxSize
== params
[0])
166 FLUSH_VERTICES(ctx
, _NEW_POINT
);
167 ctx
->Point
.MaxSize
= params
[0];
170 _mesa_error(ctx
, GL_INVALID_ENUM
,
171 "glPointParameterf[v]{EXT,ARB}(pname)");
175 case GL_POINT_FADE_THRESHOLD_SIZE_EXT
:
176 if (ctx
->Extensions
.EXT_point_parameters
) {
177 if (params
[0] < 0.0F
) {
178 _mesa_error( ctx
, GL_INVALID_VALUE
,
179 "glPointParameterf[v]{EXT,ARB}(param)" );
182 if (ctx
->Point
.Threshold
== params
[0])
184 FLUSH_VERTICES(ctx
, _NEW_POINT
);
185 ctx
->Point
.Threshold
= params
[0];
188 _mesa_error(ctx
, GL_INVALID_ENUM
,
189 "glPointParameterf[v]{EXT,ARB}(pname)");
193 case GL_POINT_SPRITE_R_MODE_NV
:
194 if (ctx
->Extensions
.NV_point_sprite
) {
195 GLenum value
= (GLenum
) params
[0];
196 if (value
!= GL_ZERO
&& value
!= GL_S
&& value
!= GL_R
) {
197 _mesa_error(ctx
, GL_INVALID_VALUE
,
198 "glPointParameterf[v]{EXT,ARB}(param)");
201 if (ctx
->Point
.SpriteRMode
== value
)
203 FLUSH_VERTICES(ctx
, _NEW_POINT
);
204 ctx
->Point
.SpriteRMode
= value
;
207 _mesa_error(ctx
, GL_INVALID_ENUM
,
208 "glPointParameterf[v]{EXT,ARB}(pname)");
213 _mesa_error( ctx
, GL_INVALID_ENUM
,
214 "glPointParameterf[v]{EXT,ARB}(pname)" );
218 if (ctx
->Driver
.PointParameterfv
)
219 (*ctx
->Driver
.PointParameterfv
)(ctx
, pname
, params
);