• Advertisement

Archived

This topic is now archived and is closed to further replies.

This is confusin, plz help!

This topic is 6069 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am just in the throws of writing the basic DirectX setups for my new program (I do it everytime so I learn what I am doin). This time I have come across a strange problem that I have never come across before. My setup routine works fine up until it gets to creating the backbuffer, the code which looks like this: //Get the backbuffer ddscaps.dwCaps = DDSCAPS_BACKBUFFER; hRet = lpddsprimary->GetAttachedSurface(&ddscaps,&lpddsback); if(hRet != DD_OK) { return(FALSE); } This crashes the program. Now if I add a debug line (Some may recognise this, I am copying slightly here) //Get the backbuffer ddscaps.dwCaps = DDSCAPS_BACKBUFFER; hRet = lpddsprimary->GetAttachedSurface(&ddscaps,&lpddsback); if(hRet != DD_OK) { ErrStr = Err_GetAttached; return(FALSE); } The program now works fine! Why? Its not as if I am changing the program in any massive way! Any suggestions please...

Share this post


Link to post
Share on other sites
Advertisement
I think you just got "lucky" here. Do you fill your structs with 0s before using it ? If not, this may be where the error come from. In the second case, the compiler just produce a slighty different code that, for any weird and luckily reason, has a stack full of 0 (or any value that doesn''t crash the CreateSurface method).

Share this post


Link to post
Share on other sites

  • Advertisement