Jump to content
  • Advertisement

Archived

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

fdklana

How does pitch work???

This topic is 6266 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 everyone...I have a simple but...I am currently confused on how it works..anyway here I go. I was just using the regular way to init my d3d device(I am using directx8) and the thing is I am having problems drawing to the back buffer due to the fact that I don''t know what to divide the pitch by to get the right offset amount. You know for 32 bits you divide the pitch by 4 meaning your accessing 32 bits at a time...well what about a format of R5G6B5 what do you divide the pitch by...the reason I am asking this is because I am getting some funny results dividing by 2???....I thought that you divide by 4 because you want to convert the pitch to 4 bytes each??? anyway can anyone help me explain what is pitch and how to properly format it.....I am doing this because I am adding transparency to my engine and I want to use this method of doing it ....Any help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
5+6+5 = 16 = 16bits.

8bits = 1 byte.

1 DWORD = 4 bytes = 32bits
1 WORD = 2 bytes = 16bits

So divide by 2 if you want to access a pixel at a time 16 bit.

But how much you divide by depends on the size of the data type you use to access the memory. For 16bit, this is WORD, for 32bit this is DWORD.

[BTW: I assume you have some valid reason for locking the backbuffer and playing with pixels - it''s the worst way to do graphics on modern PCs - everything is totally serialised - bad...]

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
What you want to do is cast a (DWORD*) pointer to your pitch for processing . ALso Pitch is the piece of memory for display that never gets displayed . Kinda like you can be a millionaire, you carry around 50 bux on you at all times, but the rest of your money is in the bank.

Eric Wright o0Programmer0o

AcidRain Productions

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!