Beginer questions ...

Started by
1 comment, last by Hadi Rezaie 22 years, 8 months ago
Hi all, I have problem in understanding some falgs in DDSURFACEDESC2 and LPDIRECTDRAWSURFACE: Q1: Primary surface is surface for displaying bitmap or image in screen ... So, we must first load bitmap or image in offscreen surface then i must move image to primary surface. Is it true ??? Q2: For creating Primary surface: DDSURFACEDESC ddsd; memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; lpDD->Create(&ddsd, &lpDDSP, NULL); // IT WAS TRUE ? IT WAS PRIMARY SURFACE ??? ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; ddsd.dwWidth = 320; ddsd.dwHeight = 240; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; lpDD->CreateSurface(&ddsd, &lpDDSB, NULL); // IT WAS TRUE ? IT WAS OFFSCREEN SURFACE ??? But i got other source code about creating thease surfaces: DDSURFACEDESC2 ddsd; memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; ddsd.dwBackBufferCount = 1; lpDD->Create(&ddsd, &lpDDSP, NULL); // ????????? ddsd.dwCaps = DDSCAPS_BACKBUFFER; lpDDP->GetAttachedSurface(&ddsd, &lpDDB); lpDD->CreateSurface(&ddsd, &lpDDSB, NULL); // ????????? So, please explain to me about above source codes, i mean what is different between thease code in creating Back surface and Primary surface ? and explain about thease flags: DDSCAPS_FLIP and DDSCAPS_COMPLEX and DDSCAPS_BACKBUFFER ... and explain about GetAttachedSurface function ... I''m now confuse Hadi Rezaie
Hadi Rezaie
Advertisement
All right, I''ll try to answer your question with as much precision as I can. You first example using DDSD_OFFSCREENSURFACE, creates a surface which is totally apart from the Primary Surface. It''s not attached to it so using the flip(); won''t work. The second example where they create a DDSD_BACKBUFFER, creates a surface that is sort of linked to the primary surface. Ok, it''s not really linked but the address of the buffer pointer is kept by DX in order to do flipping( that''s why I say they are linked ). Now, with that said, if you plan on doing animation and such, I woul recommend you use the Backbuffer example. It''s alot quicker to flip() the surface than to blit(). Anyhow, those are my views on your point.



"And that''s the bottom line cause I said so!"

Cyberdrek
Headhunter Soft
A division of DLC Multimedia

Resist Windows XP''s Invasive Production Activation Technology!

"gitty up" -- Kramer
[Cyberdrek | ]
Hi again,
It mean: flip() is equal with blit() in performance ?


Hadi Rezaie
Hadi Rezaie

This topic is closed to new replies.

Advertisement