lightmap storing

im about to add light maps to my little engine, since each wall in my engine consists two triangles only(so gourad shading sucks here), and the walls are always perp to the axis system, it wont be so hard, maybe even pretty easy, but i need to know how how write the rgb values for each pixel in each lightmap, after i calculated it, into a bmp file, or another format or my own format, is there any opengl command, maybe gluSubImage or something like that.
thnx for the help.

[This message has been edited by okapota (edited 12-24-2000).]

well??, i wont be able to start my lightmaps like that, please make a suggestion .

i found the way to read pixels from the frame buffer into a texture, so i can switch to ortho projection, and place the camera so the wall fits exactly to the screen, render it with my own per-pixel lighting and write it into a texture, but how do i save the texture after that, and how do i place the camera to make the wall fit to the screen?

You can save the texture as a file by reading back the frame buffer with glReadPixels(). I personally would probably use an orthographic projection to get the texture to fit the screen.

ok, but what fov should i use, and how far?, is there any formula you can think of?, i can figure this out alone, but how do i save the information from ReadPixels() into a file?

Umm… there is no FOV in ortho projection.

If you calculate the total surface area of
all your walls, ceilings and floors, and
then divide your total allocated lightmap
texture memory in that number, you find out
how much memory you can spend per wall “unit”

If you’re using LUMINANCE or ALPHA for the
light map, you get one byte per lightmap
pixel. Typically, you’ll find a wall unit
gets around 16x16 pixels or so; if you make
it much bigger you start to chew texture
memory at an alarming rate. (I’m assuming
units of meters here.)

I’m new to C but, what you’ll want to do is stream the texture to a file (fstream.h)… ask some others for more info on this… i could give rudimentory information but others would be able to help more.
(btw, other than just texture data you’ll also want image info (format,x,y,bpp)


what was i thinkig, no fov, you are right, well actually i wasnt really thinking, but the i dea you gave me about the computaion of the memory is greate, thnx.