Archived

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

flukus

Having CreateSurface() errors !

Recommended Posts

Hi, I''m haveing problems using the CreateSurface() function (using DD7). In Isometric game programming it says that If you don''t specify video or system memory then DD assumes video memory and if thats not possible it uses system memory. However when I don''t specify I get the error DDERR_INVALIDCAPS, but then I get the same error if I specify DDSCAPS_SYSTEMMEMORY. And if I specify DDSCAPS_VIDEOMEMORY then I get the error DDERR_NODIRECTDRAWHW. I''ve been over my code hundreds of time but can''t find anything wrong:
  
	memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
	ddsd.dwSize = sizeof(DDSURFACEDESC2);
	ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
	ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
	ddsd.dwWidth = bmp.bmWidth;
	ddsd.dwHeight = bmp.bmHeight;
	//create the surface

	HRESULT hr;
	if (FAILED( hr = lpdd->CreateSurface(&ddsd, &lpddsSurface, NULL)))
  
Does anyone know whats going wrong?

Share this post


Link to post
Share on other sites
Hmm, I can only give you avenues of research...

First off: What is your video card? Old hardware (and even new one) have limits established in the D3DCAPS, it''s important to look through it at least once (DXCaps viewer comes to mind) with the MSDN docs to learn just how -limited- our hardware really is.

SEcond: How large is the BMP you are trying to put? One thing everyone should know is that several slightly-old cards (Voodoo3 comes to mind) are limited to 256x256 textures while in video memory. Furthermore, most cards (even modern ones) must have width and height at a power of two. (1,2,4...16,32,64...256,512)

If you''re trying to load a fullscreen image, I''m not surprised you happen on caps problems.

Sorry I''m not more helpful, it''s all I got off the top of my head. I find it weird that a surface put in system memory would fail as most caps don''t apply to SYSMEM surfaces. Gn, maybe the D3DFORMAT isn''t right, DirectX8 is fussy about that sometimes...

=^.^= Leaders and teachers should remember: It is best to offer others what they Need, not what they Want.

Share this post


Link to post
Share on other sites
"First off: What is your video card? Old hardware (and even new one) have limits established in the D3DCAPS, it''s important to look through it at least once (DXCaps viewer comes to mind) with the MSDN docs to learn just how -limited- our hardware really is."

Promise not to laugh... It''s an old, non descript, in built graphics card with shared memory. I checked the caps viewer and apparently there is no video memory though, both in the HAL and HEL could this be the problem? My card even leaves blitting up to the HEL, so it''s kind of pointless all round.

"SEcond: How large is the BMP you are trying to put? One thing everyone should know is that several slightly-old cards (Voodoo3 comes to mind) are limited to 256x256 textures while in video memory. Furthermore, most cards (even modern ones) must have width and height at a power of two. (1,2,4...16,32,64...256,512)"

I tried changing the bitmap/surface to 256x256 instead of 300x300, nothing changed.

BTW, I''m using direct draw 7 not D3D, I think I''ll try reinstalling my video card drive and direct x as well.

Share this post


Link to post
Share on other sites
Definitely update drivers. Doubt directx is the problem. If your card is really that bad your gonna have some trouble even doing directdraw stuff. If you can''t get it work even with new drivers, and getting a new card isn''t possible then you might look into using Windows GDI functions like BitBlt, not super fast like DD, but not to slow either.

Share this post


Link to post
Share on other sites
I updated the drivers and reinstalled DDRAW and the same problems exists. Except now theres these f*ucked up white dashes running through my screen all the time.

Do you guys really think it''s my graphics card? I can play other directx games but i might try and find a cheap graphics card somewhere, I don''t want to spend alot until I can get a decent motherboard too.

Share this post


Link to post
Share on other sites
It''s very odd man, I''ve never had such a problem with any card on my older computers (altho the oldest computer I have around still is a 100mhz compaq with 1meg vid card...) . If the drivers only make it worse I don''t have any solutions for you unfortunately

Share this post


Link to post
Share on other sites