• Advertisement


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

Plotting Pixels on a Direct3D Texture

This topic is 6818 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

Hi all !!

How can I plot pixels on a Direct3D Texture ?? I simply do that:

unsigned char color = 64;

unsigned char* bits = (unsigned char*)TextureSurface;
bits[y*pitch+x] = unsigned char color;

The texture is 8-Bit Palettized. The Texture has a greyscale palette.

On Voodoo cards, this works fine, but on my TNT I get strange colors. I think that is, because the TNT cannot use 8-Bit. How can I plot pixels for the TNT.

If this would work, I only could use 8-Bit. What about 16-Bit Textures, for example RGB565. How can I plot pixels in this texture-format ??

Thanks, Phillip

Share this post

Link to post
Share on other sites
I'm not sure, but why not simply use and RGB() struct ? You've got to use an USHORT because of the 16 bit. And remember each color component has the maximum value 31.


#define RGB16BIT(r,g,b) ((b%32)+(g%32)<<5)+((r%32)<<10)

TextureMemory[...] = (USHORT) RGB16BIT(r,g,b);

That should work.


Skullpture Entertainment

Share this post

Link to post
Share on other sites

  • Advertisement