PDA

View Full Version : Lightmapz



Tea
05-11-2003, 12:02 AM
My card (some kind of S3) dont support multitexturing, but im creating cool game, and i wanna make cool maps. But without lightmaps it will look crap. What i should to do , ppl? (BTW i can play q2 with lightmaps, so should be some kind of solution)..
thanks

cragwolf
05-11-2003, 05:07 AM
You have two textures, the lightmap and your base texture. You could render in two passes, first pass with the lightmap texture, and second pass with the base texture using a blend function (i.e. glBlendFunc(GL_ZERO, GL_SRC_COLOR)). Remember just before first pass to call glBindTexture with your lightmap, and just before second pass call glBindTexture with your base texture. And don't forget to enable and disable GL_BLEND at the right places. That's one way.

Tea
05-13-2003, 03:09 AM
rebind with another texture? Do i need to create another polygon to do second pass?

cragwolf
05-13-2003, 01:10 PM
Well, you have to draw your polygon(s) again on second pass. Let's say you have compiled your polygon drawing into a display list called iDraw. Then your code should look something like this:



glBindTexture(GL_TEXTURE_2D, iLightMap);
glCallList(iDraw);
glBindTexture(GL_TEXTURE_2D, iBaseTexture);
glEnable(GL_BLEND);
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
glCallList(iDraw);
glDisable(GL_BLEND);

That's it.