Skip to main content
gamedev.net
🔒 Locked

Initializing DDraw

Started by robinei 2 replies 250+ views
Original Post
robinei
robinei
I intend use ddraw to access the framebuffer directly, for the purpose of trying to write a simple triangle rasterizer, so it must be in system memory. How should one initialize ddraw for such a purpose? The usual primary/backbuffer scheme(or is that intended for fast hardware blits)? If so, which surface is then in fact in system memory, and should thus be used?
Muhammad Haggag
Muhammad Haggag
quote:
Original post by robinei
I intend use ddraw to access the framebuffer directly, for the purpose of trying to write a simple triangle rasterizer, so it must be in system memory.

(Ignore this point if you don''t use D3D).
- You can do that in Direct3D if you want. Just add the D3DPRESENT_LOCKABLE_BACKBUFFER flag to your presentationParameters.Flags, and then lock the back-buffer )with the D3DLOCK_NOSYSLOCK flag) and do all the software rendering you''d like.

quote:
How should one initialize ddraw for such a purpose? The usual primary/backbuffer scheme(or is that intended for fast hardware blits)?

The usual primary/backbuffer scheme. If you draw directly to the front-buffer, then the user''s going to see horrible flickering and tearing, as you render your scene step-by-step.

quote:
If so, which surface is then in fact in system memory, and should thus be used?

Just lock the back-buffer, write to it, unlock, flip, and you''re done.

Muhammad Haggag
Bitwise account: MHaggag -

robinei
robinei
Can I assume that the pitch of the backbuffer is equal to the screen width?
Muhammad Haggag
Muhammad Haggag
quote:
Original post by robinei
Can I assume that the pitch of the backbuffer is equal to the screen width?

No. You can''t assume the pitch of *any* surface that the card uses is the same as the width.

Muhammad Haggag
Bitwise account: MHaggag -

Topic Locked

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

Sign in to reply to this topic.