I think I wasn't clear anought sorry, I use bot, component and scene nodes.
The component is the entity manager.
And the world contains components (entity managers) and systems which updates the entities and components that I use to draw the scene.
I need to use shaders because otherwise if I render 3D vertices with semi-transparent texture (like glass or water per example), semi-transparent object pixels hides opaque pixels.
The first fragment shader solve the first part of the problem : if the z component of the pixel that I want to draw is greater or equal to the z component of the current framebuffer's pixel I perfom an alpha test, and I only draw the pixel on the depth texture if its alpha component is greater or equal than the alpha component of the current framebuffer's pixel.
GL_GREATER_OR_EQUAL is not avalaible for the opengl alpha test, you've to specify a precis value, this is why I can't use the opengl alpha test.
I can't use the GL_DEPTH_COMPONENT because I need to also have the alpha value of the depth texture. (And not only the z value)
The second fragment shader solve the second part of the problem if the z component of the pixel that I want to draw is less greater than the z component of the current framebuffer's pixel.
If the alpha component of the current framebuffer's pixel is less greater than the alpha component of the pixel that I want to draw, I draw nevertheless the pixel.
I don't really knows how vbo's work but I think I'll use them later. ^^ (I'm always confunding VBO and FBO. :@)
For the zfar I can solve the problem if I normalize the z coordinate in the shader. ^^
I thought that it was already done and that the z value was between 0 and 1 but it doesn't seems to be the case, so, I think I just need to do this in the projection matrix.
I have different proportions with perspective and orthographic projections (screen coordinates are between 0 and screewidth with orthographic projection and between -1 and 1 with perspective projection so, I think I have to normalize them in the projection matrix for orthographic projection to pass from viewport coordinates to normalized coordinates)
I thing that's it's what Laurent does it in his projection matrix. (Because I didn't have this problemwith SFML matrix)
Thanks for your answers, but some points are still obscure to me. (It also do this for lurning purpose)
I hope that I've answered to your questions, but I need to read a thrad about modern GLSL, the threads that I've read was made several years ago so I use deprecated functions.