Archived

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

darrin

Draw to a texture help

Recommended Posts

darrin    122
Hi, I have been working on a menu system, which involves taking sections of a PCX & drawing them over the top of a texture in texture memory. I had it working nicely at home (Viper2) using the TEXTURE_P_8 format, just copying the new data in as same format, but my machine at work (Matrox G400) either doesn''t support P8 Textures, or I am doing something wrong. The texture seems to be reverting to the TEXTURE_RGB_565 format, which of course means anything I draw to it looks like crap. Anyone managed to get the above sort of thing working nicely? ie Copying data to a texture. Cheers Darrin

Share this post


Link to post
Share on other sites
ChrisE    184
Ah the joys of DirectX and different hardware

If you want it to work on every card, you must get the pixel format of the surface you''re drawing on and convert the colors to that format.

You can''t rely on 8 bit texture support. It''s not even safe to assume RGB 565. Some cards have RGB 555 and the bit order could be different.

Look in \examples\lightmap\lmaputil.c for a function called GetRGBInfo for an idea how to get and use the pixel format information.


Share this post


Link to post
Share on other sites