I’ve recently been replacing all my per-vertex setup code with vertex programs using ARB_vp. For each polygon I have a matrix to transform from world space to texture space for bump mapping, and so before rendering each polygon with glDrawElements, I do the following:
// Put poly's onb into vertex program constant memory glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, 4, &poly->onb().tangent().x()); glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, 5, &poly->onb().binormal().x()); glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, 6, &poly->onb().normal().x());
But I’m not sure about the speed of updating the vertex program constant memory, especially for every polygon. Is it fast? Is there a better way to update it? Can I set all three at once?
And on a slightly different topic … is it worth replacing the cpu per-vertex setup with a vertex program on cards like the GeForce 1? Because it would have to emulate the vp in software anyway … and then couldn’t use the hardware accelerated texture matrix and transform unit.
Thanks in advance,