Jump to content
  • Advertisement

Archived

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

Neen10do

Primary Surface errors

This topic is 5593 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

when im trying to create the primary surface (using directdraw with directx 7.0) i always get errors that it cant create the primary surface. is there anything wrong with my code? note: lpDD is the directdraw interface, which is created successfully (SOURCE) //DIRECTDRAW VARIABLES LPDIRECTDRAW7 lpDD = NULL; //Primary Surface LPDIRECTDRAWSURFACE7 lpDDSPrimary = NULL; //Back Buffer LPDIRECTDRAWSURFACE7 lpDDSBack = NULL; bool CreatePrimarySurface() { DDSURFACEDESC2 ddsd; DDSCAPS2 ddscaps; HRESULT ddrval; // Create the primary surface with 1 back buffer 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; ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); if( ddrval != DD_OK ) { lpDD->Release(); return(false); } // Get the pointer to the back buffer ddscaps.dwCaps = DDSCAPS_BACKBUFFER; ddrval = lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack); if( ddrval != DD_OK ) { lpDDSPrimary->Release(); lpDD->Release(); return(false); } return true; } (END SOURCE) i code therefore i am.

Share this post


Link to post
Share on other sites
Advertisement
What errors are you getting?
Have you included the Libraries?
Have you put #define INITGUID in your source?

instead of:
// Get the pointer to the back buffer
ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
ddrval = lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack);

try:
// Get the pointer to the back buffer
memset(&ddsd,0,sizeof(ddsd));
ddsd.dwSize = sizeof( ddsd );

ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
ddrval = lpDDSPrimary->GetAttachedSurface(&ddsd, &lpDDSBack);

Dont know if that helps.




[edited by - Losec on February 2, 2003 7:18:45 AM]

Share this post


Link to post
Share on other sites
what i had to do was change my window style... i would have had to create a clipper... but once i got it into fullscreen mode (because my window wasn''t set up properly), it worked.

i code therefore i am.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!