Archived

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

Choff

Need help with writing to a surface

Recommended Posts

Hi, I''m teaching myself direct draw progrmming by writing a game. I''m using the book "Windows 95 programming for dumbies" As a guid and updating all the code to for direct input 8 and 16 bit graphics. I''m creating a video mode o 1024x768x16. I have directx 8 installed and a Voodoo 3 video card. The problem I''m having is when I try to write directly to the surface buffers. I''m holding a global pointer (word *) to the surface and locking it before I start writing to the surface. I then get the pitch value and surface address from the surface info structure. The pitch value is also saved in a global WORD. Any code that advances my WORD* accross the surface doesn''t line up properly example: lpPointerToSurface = lpPointerToSurface + x +(y*pitch); This code only works if I devide the pitch by 2 before I use it. If I use a 1024x768x8 surface, convert all the surface pointers to BYTE pointers (or UCHAR pointers) advancing my pointer works fine and I don''t have to devide the pitch by 2. I know this is just a STUPID oversite on my part. Any insite would help. feel free to email me please choff_2001@hotmail.com . big kid with adult powers

Share this post


Link to post
Share on other sites
IIRC the pitch is always specified in bytes, so there is nothing strange with having to divide it with 2 if you want a count of words.

Share this post


Link to post
Share on other sites
thanks for the reply!

That was bugging me... I didn''t reallize that the pitch is always returned as the number of bytes... makes sense now

Share this post


Link to post
Share on other sites