Skip to main content
gamedev.net
🔒 Locked

Surface problems

Started by Indy_Jones 0 replies 150+ views
Original Post
Indy_Jones
Indy_Jones
Hi! I''ve the following problem: My program runs in mode 320x240x8 fullscreen, uses it''s own palette and has 2 surfaces to flip. I create in the drawing routine small surfaces (8x8) that are blitted to the backbuffer. My problem is: the lPitch of one of these surfaces is 64. I don''t know why - i thought it should be 8 (8 x 1 byte per line). Something simmilar is with the primary surface. It has a lPitch of 640 (instead of 320 * 1 byte). That makes quite some troubles for me cause i access surface memory directly to draw anything. Anyone knows a solution for this? I use DXSDK 7 and my machine is running Windows 2000 with DirectX 8 (with an old ATI Rage Pro). Thx for any help Martin
Ravenshadow
Ravenshadow
Remember the lpitch is the width of a surface line in memory.
When DirectX creates your surface it fits it in memory as best
it can. It figures in bytes boundaries, how much mem you have
left, etc.
So whatever it pads onto the end of your lines you''re
just gonna have to live with. So when you''re blitting stuff
with routines you''ve written yourself you just gotta remember
that instead of using

surface_ptr[(y * x_width) + x]

to get at a particular pixel you need to use

surface_ptr[(y * lpitch) + x]

Its really not that big of a deal (especially if you''re running
in 320x240x8.) Mem requirements for your surfaces will be fairly
small.

--Ravenshadow

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.