diff options
author | Brian Paul <[email protected]> | 2009-05-28 12:31:18 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-05-28 12:31:18 -0600 |
commit | fe86e508967bd7b63902928033247e145103f60c (patch) | |
tree | c267f0199e2e850c06d6e04ce770e6840e840104 /src/mesa/main/light.c | |
parent | 89966cdb1b5974059c32308d74b5bb09943a6fa1 (diff) |
mesa: exec/dlist functions for glProvokingVertexEXT()
Diffstat (limited to 'src/mesa/main/light.c')
-rw-r--r-- | src/mesa/main/light.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index ac604fd12cc..0f0d831feef 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.0 + * Version: 7.5 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -64,6 +65,37 @@ _mesa_ShadeModel( GLenum mode ) /** + * Set the provoking vertex (the vertex which specifies the prim's + * color when flat shading) to either the first or last vertex of the + * triangle or line. + */ +void GLAPIENTRY +_mesa_ProvokingVertexEXT(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE&VERBOSE_API) + _mesa_debug(ctx, "glProvokingVertexEXT 0x%x\n", mode); + + switch (mode) { + case GL_FIRST_VERTEX_CONVENTION_EXT: + case GL_LAST_VERTEX_CONVENTION_EXT: + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glProvokingVertexEXT(0x%x)", mode); + return; + } + + if (ctx->Light.ProvokingVertex == mode) + return; + + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.ProvokingVertex = mode; +} + + +/** * Helper function called by _mesa_Lightfv and _mesa_PopAttrib to set * per-light state. * For GL_POSITION and GL_SPOT_DIRECTION the params position/direction @@ -1348,6 +1380,7 @@ _mesa_init_lighting( GLcontext *ctx ) init_lightmodel( &ctx->Light.Model ); init_material( &ctx->Light.Material ); ctx->Light.ShadeModel = GL_SMOOTH; + ctx->Light.ProvokingVertex = GL_LAST_VERTEX_CONVENTION_EXT; ctx->Light.Enabled = GL_FALSE; ctx->Light.ColorMaterialFace = GL_FRONT_AND_BACK; ctx->Light.ColorMaterialMode = GL_AMBIENT_AND_DIFFUSE; |