bumby

01-17-2005, 08:01 AM

Hello,

I have just begun experimenting with the arb vertex program in order to see how they work.

I am simply trying to pass a float in to the program and use it to shrink/grow a quad...the float varies from 0.5 to 2.0. over time in 0.05 increments.

const char EXPANDTEST[]= "!!ARBvp1.0\

ATTRIB iPos = vertex.position;\

ATTRIB iNormal = vertex.normal;\

ATTRIB iColor = vertex.color;\

ATTRIB iTex = vertex.texcoord;\

ATTRIB iTex1 = vertex.texcoord[1];\

PARAM mfactor = program.env[0];\

PARAM mvp[4] = { state.matrix.mvp };\

PARAM mvpinv[4]={ state.matrix.modelview.invtrans};\

PARAM lightdir = state.light[0].position;\

PARAM halfdir = state.light[0].half;\

PARAM specexp = state.material.shininess;\

PARAM ambientcol = state.lightprod[0].ambient;\

PARAM diffusecol = state.lightprod[0].diffuse;\

PARAM speccol = state.lightprod[0].specular;\

OUTPUT oPos = result.position;\

OUTPUT oColor = result.color;\

OUTPUT oTex = result.texcoord;\

OUTPUT oTex1 = result.texcoord[1];\

TEMP xfnorm;\

TEMP temp;\

TEMP dots;\

TEMP res;\

TEMP tpos;\

\

MUL tpos,mfactor,iPos;\ BLING BLING!

DP4 oPos.x, mvp[0], tpos;\

DP4 oPos.y, mvp[1], tpos;\

DP4 oPos.z, mvp[2], tpos;\

DP4 oPos.w, mvp[3], tpos;\

\

DP3 xfnorm.x, mvpinv[0],iNormal;\

DP3 xfnorm.y, mvpinv[1],iNormal;\

DP3 xfnorm.z, mvpinv[2],iNormal;\

DP3 res.w, xfnorm,xfnorm;\

RSQ res.w,res.w;\

MUL res.xyz,res.w,xfnorm;\

MOV xfnorm,res;\

DP3 dots.x, xfnorm, lightdir;\

DP3 dots.y, xfnorm, halfdir;\

MOV dots.w, specexp.x;\

LIT dots,dots;\

MAD temp,dots.y,diffusecol,ambientcol;\

MAD oColor.xyz,dots.z,speccol,temp;\

\

MOV oColor.w,diffusecol.w;\

MOV oTex, iTex;\

MOV oTex1, iTex1;\

END";

I see no effect on the quad. I also tried simply multiplying the position by a constant directly:

ie changed:

MUL tpos,mfactor,iPos;\

to

MUL tpos,2.0,iPos;\

and it didnt work

although if i changed the 2.0 to 0.0 i see nothing..which makes sense.

There are no errors reported either by glGetString(GL_PROGRAM_ERROR_STRING_ARB)

or

glGetError()

Any idea why it wouldnt work?

Thanks,

Jeremy

I have just begun experimenting with the arb vertex program in order to see how they work.

I am simply trying to pass a float in to the program and use it to shrink/grow a quad...the float varies from 0.5 to 2.0. over time in 0.05 increments.

const char EXPANDTEST[]= "!!ARBvp1.0\

ATTRIB iPos = vertex.position;\

ATTRIB iNormal = vertex.normal;\

ATTRIB iColor = vertex.color;\

ATTRIB iTex = vertex.texcoord;\

ATTRIB iTex1 = vertex.texcoord[1];\

PARAM mfactor = program.env[0];\

PARAM mvp[4] = { state.matrix.mvp };\

PARAM mvpinv[4]={ state.matrix.modelview.invtrans};\

PARAM lightdir = state.light[0].position;\

PARAM halfdir = state.light[0].half;\

PARAM specexp = state.material.shininess;\

PARAM ambientcol = state.lightprod[0].ambient;\

PARAM diffusecol = state.lightprod[0].diffuse;\

PARAM speccol = state.lightprod[0].specular;\

OUTPUT oPos = result.position;\

OUTPUT oColor = result.color;\

OUTPUT oTex = result.texcoord;\

OUTPUT oTex1 = result.texcoord[1];\

TEMP xfnorm;\

TEMP temp;\

TEMP dots;\

TEMP res;\

TEMP tpos;\

\

MUL tpos,mfactor,iPos;\ BLING BLING!

DP4 oPos.x, mvp[0], tpos;\

DP4 oPos.y, mvp[1], tpos;\

DP4 oPos.z, mvp[2], tpos;\

DP4 oPos.w, mvp[3], tpos;\

\

DP3 xfnorm.x, mvpinv[0],iNormal;\

DP3 xfnorm.y, mvpinv[1],iNormal;\

DP3 xfnorm.z, mvpinv[2],iNormal;\

DP3 res.w, xfnorm,xfnorm;\

RSQ res.w,res.w;\

MUL res.xyz,res.w,xfnorm;\

MOV xfnorm,res;\

DP3 dots.x, xfnorm, lightdir;\

DP3 dots.y, xfnorm, halfdir;\

MOV dots.w, specexp.x;\

LIT dots,dots;\

MAD temp,dots.y,diffusecol,ambientcol;\

MAD oColor.xyz,dots.z,speccol,temp;\

\

MOV oColor.w,diffusecol.w;\

MOV oTex, iTex;\

MOV oTex1, iTex1;\

END";

I see no effect on the quad. I also tried simply multiplying the position by a constant directly:

ie changed:

MUL tpos,mfactor,iPos;\

to

MUL tpos,2.0,iPos;\

and it didnt work

although if i changed the 2.0 to 0.0 i see nothing..which makes sense.

There are no errors reported either by glGetString(GL_PROGRAM_ERROR_STRING_ARB)

or

glGetError()

Any idea why it wouldnt work?

Thanks,

Jeremy