Vertex Extrusion

I have a problem generating the extruded vertex with a vertex program.
There’s an array of indexex that point to the vertexes I need to extrude.
(…the only parameter I pass is the light position…)

static inline void DrawShadowVolume( _Object &Obj )
{
for(int End=0 ; End<Obj.NProfile-2 ; End+=2) if(Obj.Profile[End]>=0)break;
int P;

if (VProgram)
	{
	glBindProgramARB(GL_VERTEX_PROGRAM_ARB, ShadowVolumeVP);
	glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, 0, Scene.Light[0].Position );
	}

glBegin( GL_QUAD_STRIP );

for(int i=End ; i&lt;Obj.NProfile-2 ; i+=2) 
	{
	if ((P=Obj.Profile[i])&lt;0) break;

	glVertex3fv(Scene.VBuffer[P].Coord);
	
	if (VProgram)
		{
		glEnable(GL_VERTEX_PROGRAM_ARB);
		glVertex3fv(Scene.VBuffer[P].Coord);
		glDisable(GL_VERTEX_PROGRAM_ARB);
		}
	
	else glVertex3fv(Obj.Shadow[P-Obj.Offset].Coord);
	}
	

glVertex3fv(Scene.VBuffer[Obj.Profile[End]].Coord);

if (VProgram)
	{
	glEnable(GL_VERTEX_PROGRAM_ARB);
	glVertex3fv(Scene.VBuffer[Obj.Profile[End]].Coord);
	glDisable(GL_VERTEX_PROGRAM_ARB);
	}

else glVertex3fv(Obj.Shadow[Obj.Profile[i-1]-Obj.Offset].Coord);

glEnd();
}

…and this is my vertex program:
(…compiled with Cg…)

!!ARBvp1.0

ARB_vertex_program generated by NVIDIA Cg compiler

cgc version 1.5.0001, build date Sep 12 2002 15:50:03

command line args: Frenz.cg -profile arbvp1

nv30vp backend compiling ‘main’ program

PARAM c5 = { 1024, 1, 0, 0 };
#vendor NVIDIA Corporation
#version 1.0.1
#profile arbvp1
#program main
#semantic main.ModelViewProj : C0
#semantic main.LightPosition
#var float3 Position : $vin.POSITION : POSITION : 0 : 1
#var float4x4 ModelViewProj : C0 : c[0], 4 : 1 : 1
#var float3 LightPosition : : c[4] : 2 : 1
#var float4 Position : $vout.TEX0 : TEX0 : -1 : 1
TEMP R0, R1;
ATTRIB v16 = vertex.position;
PARAM c0[4] = { program.local[0…3] };
PARAM c4 = program.local[4];
ADD R0, v16.xyzx, -c4.xyzx;
MAD R1.xyz, R0.xyzx, c5.x, v16.xyzx;
MOV R1.w, c5.y;
DP4 R0.x, c0[0], R1;
DP4 R0.y, c0[1], R1;
DP4 R0.z, c0[2], R1;
DP4 R0.w, c0[3], R1;
MOV result.texcoord[0], R0;
END

Thanks , Frenz

you can’t enable vertexprogram per vertex (inside glBegin/glEnd), i’m 99.9999% sure…

actually 100%, as you can’t call glEnable/glDisable in between glBegin/glEnd…

Ok thank you …but how could I draw a QUAD_STRIP with a sequence of VertexBuffer Vertex and Extruded Vertex?

use the 4th component of the verices as a flag (1.0f, 0.0f) where 1.0 = extrude… and multiply the extrusion value with this flag…

Thank you …and merry christmas!!