2 problems!!!

Started by
16 comments, last by flukus 21 years, 4 months ago
OK the first problem I''m having is that my program seems to exit itse;f at this line: lpddsprimary->GetAttachedSurface(&ddsd.ddsCaps, &lpddsback); It was working absolutely fine befor but I changed a few things around that started causing the error, I''m pretty sure everythings back to how it was but the error is still occuring. I know I should write some debug code for this but unfortuneatly I don''t have msdn installed on this computer. Now for the second and main problem that I''m having. I was under the immpression that when you write to the back buffer and call Flip() then directx handled all the page flipping for you but everytime I process another frame the surface I''m writing too alternates. Can anyone help with this?
Advertisement
Could it be that you overwrite some memory before that call that invalidates the pointer?

Try with

if (FAILED(lpddsprimary->GetAttachedSurface(&ddsd.ddsCaps, &lpddsback)))
{
someMessage;
}

and see if the call fails. For the second one I don''t use DX7 which I think you are using.
It doesn''t fail, but it doesn''t get past that line either, which has me stumped.
is this in windowed or fullscreen mode?
<a href="http://www.purplenose.com>purplenose.com
Full screen.
are you specifying DDSCAPS_BACKBUFFER in your dwCaps, and 0 for dwCaps2, 3, and 4?
"are you specifying DDSCAPS_BACKBUFFER in your dwCaps"

Yes

"and 0 for dwCaps2, 3, and 4? "

I''m not sure I understand but here is my initialization code:


//clear dd surface desc
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
//enable valid fields
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.dwBackBufferCount = 1;
//request primary surface with backbuffer
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP | DDSCAPS_BACKBUFFER;
//CREATE PRIMARY SURFACE
lpdd->CreateSurface(&ddsd, &lpddsprimary, NULL);

ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;

//get the attached backbuffer surface
lpddsprimary->GetAttachedSurface(&ddsd.ddsCaps, &lpddsback);
i think you need to take out the DDSCAPS_BACKBUFFER from your CreateSurface call for your primary. you''re telling DX to create a surface that''s both a primary and a secondary. it will automatically create the backbuffer(s) for you based upon the back buffer count setting. that''s what the GetAttachedSurface call is for, to retrieve the pointer to the backbuffer that was created during the CreateSurface call.
also, if this is 3D you need to add DDSCAPS_3DDEVICE to your dwCaps.
"i think you need to take out the DDSCAPS_BACKBUFFER from your CreateSurface call for your primary. you''re telling DX to create a surface that''s both a primary and a secondary. it will automatically create the backbuffer(s) for you based upon the back buffer count setting. that''s what the GetAttachedSurface call is for, to retrieve the pointer to the backbuffer that was created during the CreateSurface call. "

That might solve the flipping errors but I can''t test it out yet becuase it still crashes on GetAttachedSurface line.

This topic is closed to new replies.

Advertisement