ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

points.c
Go to the documentation of this file.
00001 
00006 /*
00007  * Mesa 3-D graphics library
00008  * Version:  7.1
00009  *
00010  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
00011  *
00012  * Permission is hereby granted, free of charge, to any person obtaining a
00013  * copy of this software and associated documentation files (the "Software"),
00014  * to deal in the Software without restriction, including without limitation
00015  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00016  * and/or sell copies of the Software, and to permit persons to whom the
00017  * Software is furnished to do so, subject to the following conditions:
00018  *
00019  * The above copyright notice and this permission notice shall be included
00020  * in all copies or substantial portions of the Software.
00021  *
00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00023  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00024  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00025  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00026  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00027  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00028  */
00029 
00030 
00031 #include "glheader.h"
00032 #include "context.h"
00033 #include "macros.h"
00034 #include "points.h"
00035 #include "texstate.h"
00036 #include "mtypes.h"
00037 
00038 
00044 void GLAPIENTRY
00045 _mesa_PointSize( GLfloat size )
00046 {
00047    GET_CURRENT_CONTEXT(ctx);
00048    ASSERT_OUTSIDE_BEGIN_END(ctx);
00049 
00050    if (size <= 0.0) {
00051       _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" );
00052       return;
00053    }
00054 
00055    if (ctx->Point.Size == size)
00056       return;
00057 
00058    FLUSH_VERTICES(ctx, _NEW_POINT);
00059    ctx->Point.Size = size;
00060 
00061    if (ctx->Driver.PointSize)
00062       ctx->Driver.PointSize(ctx, size);
00063 }
00064 
00065 
00066 #if _HAVE_FULL_GL
00067 
00068 
00069 void GLAPIENTRY
00070 _mesa_PointParameteri( GLenum pname, GLint param )
00071 {
00072    const GLfloat value = (GLfloat) param;
00073    _mesa_PointParameterfv(pname, &value);
00074 }
00075 
00076 
00077 void GLAPIENTRY
00078 _mesa_PointParameteriv( GLenum pname, const GLint *params )
00079 {
00080    GLfloat p[3];
00081    p[0] = (GLfloat) params[0];
00082    if (pname == GL_DISTANCE_ATTENUATION_EXT) {
00083       p[1] = (GLfloat) params[1];
00084       p[2] = (GLfloat) params[2];
00085    }
00086    _mesa_PointParameterfv(pname, p);
00087 }
00088 
00089 
00090 void GLAPIENTRY
00091 _mesa_PointParameterf( GLenum pname, GLfloat param)
00092 {
00093    _mesa_PointParameterfv(pname, &param);
00094 }
00095 
00096 
00097 void GLAPIENTRY
00098 _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
00099 {
00100    GET_CURRENT_CONTEXT(ctx);
00101    ASSERT_OUTSIDE_BEGIN_END(ctx);
00102 
00103    switch (pname) {
00104       case GL_DISTANCE_ATTENUATION_EXT:
00105          if (ctx->Extensions.EXT_point_parameters) {
00106             if (TEST_EQ_3V(ctx->Point.Params, params))
00107            return;
00108         FLUSH_VERTICES(ctx, _NEW_POINT);
00109             COPY_3V(ctx->Point.Params, params);
00110             ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
00111                                       ctx->Point.Params[1] != 0.0 ||
00112                                       ctx->Point.Params[2] != 0.0);
00113 
00114             if (ctx->Point._Attenuated)
00115                ctx->_TriangleCaps |= DD_POINT_ATTEN;
00116             else
00117                ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
00118          }
00119          else {
00120             _mesa_error(ctx, GL_INVALID_ENUM,
00121                         "glPointParameterf[v]{EXT,ARB}(pname)");
00122             return;
00123          }
00124          break;
00125       case GL_POINT_SIZE_MIN_EXT:
00126          if (ctx->Extensions.EXT_point_parameters) {
00127             if (params[0] < 0.0F) {
00128                _mesa_error( ctx, GL_INVALID_VALUE,
00129                             "glPointParameterf[v]{EXT,ARB}(param)" );
00130                return;
00131             }
00132             if (ctx->Point.MinSize == params[0])
00133                return;
00134             FLUSH_VERTICES(ctx, _NEW_POINT);
00135             ctx->Point.MinSize = params[0];
00136          }
00137          else {
00138             _mesa_error(ctx, GL_INVALID_ENUM,
00139                         "glPointParameterf[v]{EXT,ARB}(pname)");
00140             return;
00141          }
00142          break;
00143       case GL_POINT_SIZE_MAX_EXT:
00144          if (ctx->Extensions.EXT_point_parameters) {
00145             if (params[0] < 0.0F) {
00146                _mesa_error( ctx, GL_INVALID_VALUE,
00147                             "glPointParameterf[v]{EXT,ARB}(param)" );
00148                return;
00149             }
00150             if (ctx->Point.MaxSize == params[0])
00151                return;
00152             FLUSH_VERTICES(ctx, _NEW_POINT);
00153             ctx->Point.MaxSize = params[0];
00154          }
00155          else {
00156             _mesa_error(ctx, GL_INVALID_ENUM,
00157                         "glPointParameterf[v]{EXT,ARB}(pname)");
00158             return;
00159          }
00160          break;
00161       case GL_POINT_FADE_THRESHOLD_SIZE_EXT:
00162          if (ctx->Extensions.EXT_point_parameters) {
00163             if (params[0] < 0.0F) {
00164                _mesa_error( ctx, GL_INVALID_VALUE,
00165                             "glPointParameterf[v]{EXT,ARB}(param)" );
00166                return;
00167             }
00168             if (ctx->Point.Threshold == params[0])
00169                return;
00170             FLUSH_VERTICES(ctx, _NEW_POINT);
00171             ctx->Point.Threshold = params[0];
00172          }
00173          else {
00174             _mesa_error(ctx, GL_INVALID_ENUM,
00175                         "glPointParameterf[v]{EXT,ARB}(pname)");
00176             return;
00177          }
00178          break;
00179       case GL_POINT_SPRITE_R_MODE_NV:
00180          /* This is one area where ARB_point_sprite and NV_point_sprite
00181       * differ.  In ARB_point_sprite the POINT_SPRITE_R_MODE is
00182       * always ZERO.  NV_point_sprite adds the S and R modes.
00183       */
00184          if (ctx->Extensions.NV_point_sprite) {
00185             GLenum value = (GLenum) params[0];
00186             if (value != GL_ZERO && value != GL_S && value != GL_R) {
00187                _mesa_error(ctx, GL_INVALID_VALUE,
00188                            "glPointParameterf[v]{EXT,ARB}(param)");
00189                return;
00190             }
00191             if (ctx->Point.SpriteRMode == value)
00192                return;
00193             FLUSH_VERTICES(ctx, _NEW_POINT);
00194             ctx->Point.SpriteRMode = value;
00195          }
00196          else {
00197             _mesa_error(ctx, GL_INVALID_ENUM,
00198                         "glPointParameterf[v]{EXT,ARB}(pname)");
00199             return;
00200          }
00201          break;
00202       case GL_POINT_SPRITE_COORD_ORIGIN:
00203          if (ctx->Extensions.ARB_point_sprite || ctx->Extensions.NV_point_sprite) {
00204             GLenum value = (GLenum) params[0];
00205             if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) {
00206                _mesa_error(ctx, GL_INVALID_VALUE,
00207                            "glPointParameterf[v]{EXT,ARB}(param)");
00208                return;
00209             }
00210             if (ctx->Point.SpriteOrigin == value)
00211                return;
00212             FLUSH_VERTICES(ctx, _NEW_POINT);
00213             ctx->Point.SpriteOrigin = value;
00214          }
00215          else {
00216             _mesa_error(ctx, GL_INVALID_ENUM,
00217                         "glPointParameterf[v]{EXT,ARB}(pname)");
00218             return;
00219          }
00220          break;
00221       default:
00222          _mesa_error( ctx, GL_INVALID_ENUM,
00223                       "glPointParameterf[v]{EXT,ARB}(pname)" );
00224          return;
00225    }
00226 
00227    if (ctx->Driver.PointParameterfv)
00228       (*ctx->Driver.PointParameterfv)(ctx, pname, params);
00229 }
00230 #endif
00231 
00232 
00233 
00242 void
00243 _mesa_init_point(GLcontext *ctx)
00244 {
00245    GLuint i;
00246 
00247    ctx->Point.SmoothFlag = GL_FALSE;
00248    ctx->Point.Size = 1.0;
00249    ctx->Point.Params[0] = 1.0;
00250    ctx->Point.Params[1] = 0.0;
00251    ctx->Point.Params[2] = 0.0;
00252    ctx->Point._Attenuated = GL_FALSE;
00253    ctx->Point.MinSize = 0.0;
00254    ctx->Point.MaxSize
00255       = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA);
00256    ctx->Point.Threshold = 1.0;
00257    ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */
00258    ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */
00259    ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */
00260    for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
00261       ctx->Point.CoordReplace[i] = GL_FALSE; /* GL_ARB/NV_point_sprite */
00262    }
00263 }

Generated on Fri May 25 2012 04:18:31 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.