Fix a two-sided lighting bug (fixes samples/wave.c)
authorBrian <brian.paul@tungstengraphics.com>
Wed, 16 Jan 2008 15:30:00 +0000 (08:30 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Wed, 16 Jan 2008 15:30:00 +0000 (08:30 -0700)
src/mesa/state_tracker/st_atom_rasterizer.c

index 35fd5064581273cb4858ba927a52f59cfa65ced4..beae36bca00441adef7e38c78687f4ff23566201 100644 (file)
@@ -110,7 +110,14 @@ static void update_raster_state( struct st_context *st )
     * GL_VERTEX_PROGRAM_TWO_SIDE is set).  Note the logic here.
     */
    if (ctx->VertexProgram._Current) {
-      raster.light_twoside = ctx->VertexProgram.TwoSideEnabled;
+      if (ctx->VertexProgram._Enabled) {
+         /* user-defined program */
+         raster.light_twoside = ctx->VertexProgram.TwoSideEnabled;
+      }
+      else {
+         /* TNL-generated program */
+         raster.light_twoside = ctx->Light.Enabled && ctx->Light.Model.TwoSide;
+      }
    }
    else if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) {
       raster.light_twoside = 1;