Thanks a lot for showing me right direction. 
However is still have implementation problems/questions.
Ive started implementing this with FBOs and i imagine it should work in following way:
I have 2 FBOs :
FBO_render - used to get part of image with 8 lights (or less )
FBO_Accum - used to accumumulate image after rendering to FBO_render. So imagine it would work like that:
i=0;
while( i < number of lights )
{
render scene with lights from i to i+ max(7, number of lights -i) to FBO_render
i += max(7, number of lights -i);
FBO_Accum = FBO_Accum + FBO_render;
}
FBO_Accum would be final picture.
The question is if and how i can perform FBO_Accum = FBO_Accum + FBO_render; operation
using shaders ( i havent writen single shader in my life and its not very clear if its possible). ‘+’ in this context means adding colors components of relevant texels.
Second question:
Also i’ve tried to render to FBO scene with lights with intensity > 1 and and then rendering texture (of this FBO) to the screen. Unfortunetely it doesnt work (ive got black screen). However it works fine with lights intensity <= 1. Here is initialisation of FBO :
void OpenGlRenderer::initFrameBufferDepthBuffer(void)
{
glGenRenderbuffersEXT(1, &iDepthBuffer); // Generate one render buffer and store the ID in iDepthBuffer
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, iDepthBuffer); // Bind the iDepthBuffer render buffer
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, OPT.m_nWidth, OPT.m_nHeight); // Set the render buffer storage to be a depth component, with a width and height of the window
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, iDepthBuffer); // Set the render buffer of this buffer to the depth buffer
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); // Unbind the render buffer
}
void OpenGlRenderer::initFrameBufferTexture(void)
{
glGenTextures(1, &iTextureImg); // Generate one texture
glBindTexture(GL_TEXTURE_2D, iTextureImg); // Bind the texture iTextureImg
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, OPT.m_nWidth, OPT.m_nHeight, 0, GL_RGB, GL_FLOAT, NULL); // Create a standard texture with the width and height of our window
// Setup the basic texture parameters
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
// Unbind the texture
glBindTexture(GL_TEXTURE_2D, 0);
}
void OpenGlRenderer::initFrameBuffer(void)
{
initFrameBufferDepthBuffer(); // Initialize our frame buffer depth buffer
initFrameBufferTexture(); // Initialize our frame buffer texture
glGenFramebuffersEXT(1, &iFrameBufferAccumulation); // Generate one frame buffer and store the ID in iFrameBufferAccumulation
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, iFrameBufferAccumulation); // Bind our frame buffer
}
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, iTextureImg, 0); // Attach the texture fbo_texture to the color buffer in our frame buffer
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, iDepthBuffer); // Attach the depth buffer iDepthBuffer to our frame buffer
checkFramebufferStatus();
}
and for lights initialisation:
for(int i= iIndeksFrom; i< iIndeksFrom+iLightsToUse; ++i )
{
LightDiffusse[0] = xLights[i].Bradio.x /*0.0025/;
LightDiffusse[1] = xLights[i].Bradio.y /*0.0025/;
LightDiffusse[2] = xLights[i].Bradio.z /*0.0025/;
LightDiffusse[3] = 1;
float XR = xLights[i].Bradio.x;
float YR = xLights[i].Bradio.y;
float ZR = xLights[i].Bradio.z;
LightSpotNormal[0] = xLights[i].v_n.x;
LightSpotNormal[1] = xLights[i].v_n.y;
LightSpotNormal[2] = xLights[i].v_n.z;
LightSpotPosition[0] = xLights[i].pos.x;
LightSpotPosition[1] = xLights[i].pos.y;
LightSpotPosition[2] = xLights[i].pos.z;
float XP = xLights[i].pos.x;
float YP = xLights[i].pos.y;
float ZP = xLights[i].pos.z;
glLightfv( OpenGlLights[iLightIndeks], GL_DIFFUSE, LightDiffusse);
glLightfv( OpenGlLights[iLightIndeks], GL_POSITION, LightSpotPosition);
glLightfv( OpenGlLights[iLightIndeks], GL_SPOT_DIRECTION, LightSpotNormal );
glLightf( OpenGlLights[iLightIndeks], GL_SPOT_CUTOFF , 90);
glLightf( OpenGlLights[iLightIndeks], GL_QUADRATIC_ATTENUATION, 1);
iLightIndeks++;
}
Where xLights[i].Bradio.x, xLights[i].Bradio.y, xLights[i].Bradio.z are usually around 400
Can someone help me out?
Thanks in advance.