vp: add simple vertex transform test
authorKeith Whitwell <keith@tungstengraphics.com>
Tue, 14 Oct 2008 12:52:38 +0000 (13:52 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Tue, 14 Oct 2008 13:18:32 +0000 (14:18 +0100)
progs/vp/vp-tris.c
progs/vp/xform.txt [new file with mode: 0644]

index 3fe35f7e3e6f3a76752c41af5b592999ee55de37..58014dd48de6d74e26df489e4cf2ff546dc34f9e 100644 (file)
@@ -155,6 +155,17 @@ static void Init( void )
       printf("errorpos: %d\n", errorpos);
       printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
    }
+
+   {
+      const float Ambient[4] = { 0.0, 1.0, 0.0, 0.0 };
+      const float Diffuse[4] = { 1.0, 0.0, 0.0, 0.0 };
+      const float Specular[4] = { 0.0, 0.0, 1.0, 0.0 };
+      const float Emission[4] = { 0.0, 0.0, 0.0, 1.0 };
+      glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, Ambient);
+      glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Diffuse);
+      glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Specular);
+      glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Emission);
+   }
 }
 
 
diff --git a/progs/vp/xform.txt b/progs/vp/xform.txt
new file mode 100644 (file)
index 0000000..d1548f1
--- /dev/null
@@ -0,0 +1,11 @@
+!!ARBvp1.0
+PARAM Emission = state.material.emission; 
+PARAM Ambient = state.material.ambient; 
+PARAM Diffuse = state.material.diffuse; 
+PARAM Specular = state.material.specular; 
+DP4  result.position.x, Ambient, vertex.position;
+DP4  result.position.y, Diffuse, vertex.position;
+DP4  result.position.z, Specular, vertex.position;
+DP4  result.position.w, Emission, vertex.position;
+MOV  result.color, vertex.color;
+END