View Full Version : Tell me what vertex programs can do =D

06-13-2002, 05:41 PM
I'm so stoked about the Cg toolkit. Spider3D uses weights now and it sounds like vertex programs can do that. My software method is naturally slow...plus deforming the mesh also means that I have to recreate the tangents and binormals at the deformed vertices.

Since when has weights even been included as a vertex element? Is that an extension thing?

06-13-2002, 06:14 PM
The weight register (ATTR1) has always been here since GL_NV_vertex_program was introduced.

The vertex weight is the Vertex Attribute 1. So if in a Cg program you have this:

struct vtxData : application2vertex
float4 pos;
float3 normal;
float3 color;
float3 weight;

Then your bind would be (of course this would be specified before that struct i declared):
#pragma bind vtxData.weight = ATTR1

Or you could just do something like this instead of the pragma bind thing:
cgGLBindVarying3fv(ProgramIter, WeightBind, weight);

Also, you can recompute the binormal and tangent in the vertex program (or Cg now if you like). I have seen an example of this being done somewhere, I forget where though.


06-13-2002, 07:26 PM
Awesome! I can't wait to jump into this stuff!