Quake3 BSP Lightmaps
I''m having trouble loading the lightmap textures from a quake3 BSP file with D3DX. I''m following the tutorial from GameTutorials and it uses gluBuild2DMipmaps to load them, but thats OpenGL. Is there a D3DX equivalent?
back when we all used dx7, it was
D3DXCreateTexture(...)
but that may have changed...
(and yes, i need to upgrade and get into dx8 development)
D3DXCreateTexture(...)
but that may have changed...
(and yes, i need to upgrade and get into dx8 development)
Here's my code to load Q3A lightmaps:
I gave you the whole source cause there are some subtleties.
If you ever release your source, let me know. I'm collecting links to Q3A BSP renders.
[edited by - RollingRock on December 23, 2002 11:54:28 PM]
for(int i=0;i < numlightmaps;i++) { D3DLOCKED_RECT lr; D3DXCreateTexture(d3ddevice,128,128,1,0,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,&lightmaptextures[i]) lightmaptextures[i]->LockRect(0,&lr,NULL,0); for(int j=0;j < 128*128;j++) { //swap the bytes to the way D3D likes it ((unsigned char*)lr.pBits)[j*4+0] = lightmapdata[128*128*3*i+j*3+2]; ((unsigned char*)lr.pBits)[j*4+1] = lightmapdata[128*128*3*i+j*3+1]; ((unsigned char*)lr.pBits)[j*4+2] = lightmapdata[128*128*3*i+j*3+0]; ((unsigned char*)lr.pBits)[j*4+3] = 255; } lightmaptextures[i]->UnlockRect(0); }
I gave you the whole source cause there are some subtleties.
If you ever release your source, let me know. I'm collecting links to Q3A BSP renders.
[edited by - RollingRock on December 23, 2002 11:54:28 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement