Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rocknroll60s

Quake3 BSP Lightmaps

This topic is 5751 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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)

Share this post


Link to post
Share on other sites
Here's my code to load Q3A lightmaps:


    

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]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!