Deferred shading - light volume

I’ve successfully implemented a deferred shading demos.

I’m trying to optimize it and so I’d like to use light volume.

So for directional light, I use a fullscreen quad like this :

glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_BLEND);

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();

glBegin (GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(1.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 0.0f);
glEnd();

// … restore matrix

Now for a point light, I have got some code to draw a sphere but I’m a bit lost :

Do I need some special texture coordinate or can I just send the vertices and use GLSL for proper lighting ?

Thanks

just the vertex of the sphere. It’s used to get the screen pos and exclude unnecessary pixel.

Thanks,

I’ve just noticed your post about the same subject. This might help me.

Problem:Light volume projection & Deferred Shading