Original Post
i've finally finished my shadow volumes demo (i've been working on it for toooo loooong..), now i have my scene and my models perfectly shadowed, using both depth pass and depth fail when needed :) Now i'm trying to get things speed up: in a nutshell, after i've found an object's silouhette, i draw it in immediate mode: this works good, but there is a way to get things better? I've tryied using vertex buffers, but this way the fps drops down: some advices?
for(every mesh){
for(current mesh->numOfEdges){
.....silouhette finding algo....
v1 = mesh->pvert[ i1 ].v;
v2 = mesh->pvert[ i2 ].v;
v3 = ExtendVertex(&v1,lightpos,INFINITY);
v4 = ExtendVertex(&v2,lightpos,INFINITY);
glBegin(GL_QUADS);
glVertex3f( v1.x, v1.y, v1.z );
glVertex3f( v2.x, v2.y, v2.z );
glVertex3f( v4.x, v4.y, v4.z );
glVertex3f( v3.x, v3.y, v3.z );
glEnd();
}
}
vector<tVertex> ShadowVertices;
for(every mesh){
for(current mesh->numOfEdges){
.....silouhette finding algo....
v1 = mesh->pvert[ i1 ].v;
v2 = mesh->pvert[ i2 ].v;
v3 = ExtendVertex(&v1,lightpos,INFINITY);
v4 = ExtendVertex(&v2,lightpos,INFINITY);
ShadowVertices.push_back(v1);
ShadowVertices.push_back(v2);
ShadowVertices.push_back(v4);
ShadowVertices.push_back(v3);
}
}
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer (3, GL_FLOAT, sizeof(tVertex), &ShadowVertices[0]);
glDrawArrays(GL_QUADS, 0, ShadowVertices.size());
glDisableClientState(GL_VERTEX_ARRAY);