Draw to a texture help

Started by
2 comments, last by darrin 23 years, 6 months ago
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
Advertisement
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.


Author of Power Render (http:/www.powerrender.com)
Heheh... does OpenGl have that issue?
Thanks Chris,
Now works perfectly on both cards.



Cheers
Darrin

This topic is closed to new replies.

Advertisement