🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

16bit custom surfaces mechanism, how to?

Started by
2 comments, last by Sphet 24 years, 8 months ago
Instead of malloc()ing your own memory, can't you just create a normal DDraw surface in sys memory using the DDSCAPS_SYSTEMMEMORY flag?

That being said, the best way to do alpha blits is to let the 3D card do it for you, via D3DIM.

Mason McCuskey
Spin Studios
www.spin-studios.com

Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!
Advertisement
Mason,

I suppose you are right, but I don't have a 3D card and am working on a 2D project.

Having the surface as a sysmem DDraw surface would work, I suppose, but i am still stuck with this:

read/write->sysmen

sysmem->BLT->backBuffer

backBuffer->Flip()

is this correct?

or should I do

read/write->sysmem

sysmem->Blt->Primary

?

Hey there.. I've been working something out in my head for awhile and want to know if it fits what others are doing.. I can do all of the DirectDraw things without any problem, its simply pulling it all together I am trying to sort out.

I want to use 16 bpp, so I create my Primary and Backbuffer surfaces, great.

I want to use transparency, so there will be pixel reads, and pixel reads from VRAM are horrible, so my compositing page can't be in VRAM. No problem.

I make my own off-screen surfaces with malloc, making sure they are aligned to the backbuffers lPitch value to increase block copies.

I compose my frame to my offscreen surface, get a lock to DDBackBuffer, memcpy my offscreen to the DDBackBuffer, Unlock and Flip().

is this how I should do it? Or should I blast the composited offscreen image of my own directly to the Primary? Will I get too much tearing?

What are my options here? What mechanisms are others using?

if the user has crappy video card that can't handle that much data, you should do all blitting, reading, and writing in system memory. then at last moment blit to backbuffer or frontbuffer.

all Flip does is change some video registers, so it's extremely fast. also, Flip eliminates tearing, so unless you can't even fit the backbuffer into video memory, you should blit to backbuffer and flip


This topic is closed to new replies.

Advertisement