Jump to content
  • Advertisement


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

Phillip Schuster

Plotting Pixels on a Direct3D Texture

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

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!