This topic is now archived and is closed to further replies.


Texgen inside a vertex program...

Recommended Posts

Hey, I''m trying to make my tengens for projective texturing inside a vertex program... This is my code !!ARBvp1.0 # Vertex Input ATTRIB vPos = vertex.position; # Output OUTPUT ot0 = result.texcoord[0]; OUTPUT ot1 = result.texcoord[1]; # Modelview Projection Matrix PARAM mvp[4] = {state.matrix.mvp}; PARAM tex[4] = {state.matrix.texture}; PARAM texgenS = state.texgen[0].object.s; PARAM texgenT = state.texgen[0].object.t; PARAM texgenR = state.texgen[0].object.r; PARAM texgenQ = state.texgen[0].object.q; # Transform Vertex Position Into Clip Space TEMP clipSpace; DP4 clipSpace.x, mvp[0], vPos; DP4 clipSpace.y, mvp[1], vPos; DP4 clipSpace.z, mvp[2], vPos; DP4 clipSpace.w, mvp[3], vPos; TEMP texCoords; DP4 texCoords.x, texgenS, vPos; DP4 texCoords.y, texgenT, vPos; DP4 texCoords.z, texgenR, vPos; DP4 texCoords.w, texgenQ, vPos; DP4 texCoords.x, tex[0], texCoords; DP4 texCoords.y, tex[1], texCoords; DP4 texCoords.z, tex[2], texCoords; DP4 texCoords.w, tex[3], texCoords; # Performs the eqaution # g = p1 * xo + p2 * yo + p3 * yo + p4 * wo # Afterwards transforms by the texture matrix MOV result.position, clipSpace; MOV ot0, vPos; MOV ot1, texCoords; MOV result.color, texCoords; END I don''t know where the mistakes are, but the translation is all wrong... Plz help

Share this post

Link to post
Share on other sites