Hi all,
I have a problem with the generation of lightmap…
i created a texture id (in my init) for all object that use lightmap
code in init:
glGenTextures(1, &textLight);
glBindTexture(GL_TEXTURE_2D, textLight);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(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);
but when i refill this texture it is very slow
code in the objects:
glBindTexture(GL_TEXTURE_2D, textLight);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, LIGHTMAPSIZE, LIGHTMAPSIZE, GL_RGB, GL_UNSIGNED_BYTE, dataLight);
if i use a texture id for a single objects framerate is very fast, but i can’t do it because it use very video card memory expansive (a texture is 8*8, 1000 object = 64 mega!)
i think the problem is
glBindTexture(GL_TEXTURE_2D, textLight);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, LIGHTMAPSIZE, LIGHTMAPSIZE, GL_RGB, GL_UNSIGNED_BYTE, dataLight);