Quake II Bsp-files

how do you generate the texture coordinates for the lightmaps in quake II?

Are you talking about getting the lightmap texture coordinates of a prelit bsp file, or the actual process of creating the lightmaps?

I’m trying to make a quake II bsp-viewer, so all the data (BSP/PVS/Radiosity) is allready computed. I’ve got it all working so far, but i can’t find out how the texture coordinates for the lightmaps are calculated. I looked the source code of different Quake II bsp viewers, (they seem to use a different method each time (using the average of the texturecoordinates boundries or the minimum), but i tried both of them and none of them work. It looks like a normal quake II level, but every face has a color blended over it. (If it’s not clear, i’ll make a screenshot.)

If I’m not mistaken, Q2 lightmap coordinates are created in exactly the same way that Q1 lightmap coordinates are. I’d suggest taking a peek at the Q1 source code. The gl_rsurf.c file in particular (It’s too much to post).