shithub: tinygl

Download patch

ref: 3786df909030d292fc7d0079748ac8ec66c29999
parent: 81619731cbb51492b2b3b75812af6c893ec924fe
author: David <gek@katherine>
date: Fri Feb 12 12:09:15 EST 2021

Bug fix update- Per vertex color and lighting is now actually fixed.

binary files a/capture.gif b/capture.gif differ
--- a/src/SDL_Examples/gears.c
+++ b/src/SDL_Examples/gears.c
@@ -203,7 +203,7 @@
     glNewList(gear1, GL_COMPILE);
     glMaterialfv( GL_FRONT, GL_DIFFUSE, blue );
     //glColor3fv(red);
-    gear( 1.0, 4.0, 1.0, 20, 0.7 );
+    gear( 1.0, 4.0, 1.0, 20, 0.7 ); //The largest gear.
     glEndList();
 
     gear2 = glGenLists(1);
@@ -210,7 +210,7 @@
     glNewList(gear2, GL_COMPILE);
     glMaterialfv( GL_FRONT, GL_DIFFUSE, red );
     //glColor3fv(green);
-    gear( 0.5, 2.0, 2.0, 10, 0.7 );
+    gear( 0.5, 2.0, 2.0, 10, 0.7 ); //The small gear with the smaller hole, to the right.
     glEndList();
 
     gear3 = glGenLists(1);
@@ -217,7 +217,7 @@
     glNewList(gear3, GL_COMPILE);
     glMaterialfv( GL_FRONT, GL_DIFFUSE, green );
     //glColor3fv(blue);
-    gear( 1.3, 2.0, 0.5, 10, 0.7 );
+    gear( 1.3, 2.0, 0.5, 10, 0.7 ); //The small gear above with the large hole.
     glEndList();
     glEnable( GL_NORMALIZE );
 }
--- a/src/light.c
+++ b/src/light.c
@@ -52,7 +52,7 @@
     m->shininess_i = (v[0]/128.0f)*SPECULAR_BUFFER_RESOLUTION;
     break;
   case GL_AMBIENT_AND_DIFFUSE:
-  printf("\nRECEIVED AMBIENT AND DIFFUSE COLOR %f, %f, %f, %f", v[0], v[1], v[2], v[3]);
+  //printf("\nRECEIVED AMBIENT AND DIFFUSE COLOR %f, %f, %f, %f", v[0], v[1], v[2], v[3]);
     for(i=0;i<4;i++)
       m->diffuse.v[i]=v[i];
     //c->current_color.X=v[0];
--- a/src/zbuffer.c
+++ b/src/zbuffer.c
@@ -127,24 +127,6 @@
     // Return value is in format:  0xBBGGRRAA
 }
 
-inline PIXEL pxARGB(PIXEL x)
-{
-
-    return
-    // Source is in format: 0xAABBGGRR
-        ((x & 0xFF000000) >>  0) | //______BB
-        ((x & 0x00FF0000) >> 16) | //____RR__
-        ((x & 0x0000FF00) <<  0) | //__GG____
-        ((x & 0x000000FF) << 16);  //AA______
-    // Return value is in format:  0xAARRGGBB
-}
-/*
-static void ZB_ARGB(Zbuffer* zb){
-	for(int i = 0; i < zb->xsize * zb->ysize; i++){
-		zb->pbuf[i] = pxARGB()
-	}
-}
-*/
 static void ZB_copyBuffer(ZBuffer * zb,
                           void *buf,
                           int linesize)