]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Vertex Shader for ARB OpenGL extension
authorouv <ouv@opencascade.com>
Fri, 2 Sep 2005 06:42:15 +0000 (06:42 +0000)
committerouv <ouv@opencascade.com>
Fri, 2 Sep 2005 06:42:15 +0000 (06:42 +0000)
resources/Vertex_Program_ARB.txt [new file with mode: 0755]

diff --git a/resources/Vertex_Program_ARB.txt b/resources/Vertex_Program_ARB.txt
new file mode 100755 (executable)
index 0000000..d017060
--- /dev/null
@@ -0,0 +1,58 @@
+!!ARBvp1.0
+
+# Constant Parameters
+PARAM mvp[4]     = { state.matrix.mvp }; # modelview projection matrix
+PARAM constColor = program.env[0];       # constant color (defined by the application)
+PARAM constSize  = program.env[1];       # constant size
+
+# constColor.x == 1.0
+# constColor.y == 1.0
+# constColor.z == 1.0
+# constColor.w == 1.0
+
+# constSize.x  == 1.0
+# constSize.y  == 10.0
+# constSize.z  == 100.0
+# constSize.w  == 1000.0
+
+# Per-vertex inputs
+ATTRIB inPosition = vertex.position;
+ATTRIB inColor    = vertex.color;
+
+# Per-vertex outputs
+OUTPUT outPosition = result.position;
+OUTPUT outColor    = result.color;
+OUTPUT outSize     = result.pointsize;
+
+DP4 outPosition.x, mvp[0], inPosition;   # Transform the x component of the per-vertex position into clip-space
+DP4 outPosition.y, mvp[1], inPosition;   # Transform the y component of the per-vertex position into clip-space
+DP4 outPosition.z, mvp[2], inPosition;   # Transform the z component of the per-vertex position into clip-space
+DP4 outPosition.w, mvp[3], inPosition;   # Transform the w component of the per-vertex position into clip-space
+
+# Color management
+
+TEMP color1;
+TEMP color2;
+
+#MOV color1, inColor.y;
+#DP4 color2, color1, color1;
+#MOV outColor, color1;
+
+MOV outColor, inColor;                   # Use the original per-vertex color specified
+#MOV outColor, constColor;                # Uncomment this to use the constant color stored at "program.env[0]"
+
+# Size management
+
+TEMP    size1;
+
+MOV     size1,     constSize;
+
+DP4     size1.x,   inColor,     inColor;
+MUL     size1.x,   size1.x,     constSize.y;
+
+#MUL     size1.x,   size1.x,     inColor.w;
+#MUL     size1.x,   size1.x,     constSize.y;
+
+MOV     outSize,   size1;
+
+END
\ No newline at end of file