Create Surface Failure

Started by
5 comments, last by Gf11speed 22 years, 5 months ago
What are some things that would cause this to fail: lpdd->CreateSurface(&ddsd,&lpddsprimary,NULL)) ??? I''m not sure why all the sudden this is not working properly. Thanks... *==================* www.syntasoft.com *==================*
Greg FieldsSyntasoft Gameswww.syntasoft.comPost-Time Horse Racing (Available Now)
Advertisement
"ddsd" is not initial correctly.
chech out the MSDN, all failures return an error code that should give you a good idea of whats up.

Like nlo said it''s probably ddsd, make sure you''ve got it zero''d and set ddsd.dwSize to the size of the structure

zipless
/* Ignorance is bliss, then you go and spoil it by learning stuff */

First, Zero the entire struct
i.e.
memset(&ddsd,0,sizeof(DDSURFACEDESC)); // or DDSURFACEDEC2 ??

then, set the SIZE !!!

ddsd.dwSize = sizeof(DDSURFACEDESC);

(I hope, it''s exactly like that. Maybe dwSize is member of another
struct-in-struct.)

Well, nearly all structs in DDRAW have a dwSize to set, before u use it.
I remember that I often forgot that... ;-)

Gf11speed:

As the others have said, check the DDSD is zero''d and the size is set correctly.

Also check that the surface can be created in the mode you''re trying to use etc.


The easiest ways to find out why DirectX is failing a call:

1) Install the DEBUG runtimes (you get the option at installation time on all versions of the SDK).

2) Check the return code from the return call. A return of DDERR_INVALIDPARAMS tells you it''s unhappy about the parameters. A return of DDERR_UNSUPPORTED tells you the API/driver/hardware doesn''t support the mode you''re trying to create. etc etc

3) After you''ve ensured you have the debug version of the SDK installed, go to the DirectX SDK applet in the control panel, under the DirectDraw tab, move the debug level slider to maximum (also do the same under the Direct3D tab if you''re using DX8).

4) Run your application in the debugger (F5 in MSVC) and look at the debug output window. DirectDraw will tell you in there *exactly* why it failed your call.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

The exact return value that I am getting is DDERR_NODIRECTDRAWHW. I am going to try what you said with the DEBUG level in control panel.

*==================*
www.syntasoft.com
*==================*
Greg FieldsSyntasoft Gameswww.syntasoft.comPost-Time Horse Racing (Available Now)
Ok I got it. Thanks!

*==================*
www.syntasoft.com
*==================*
Greg FieldsSyntasoft Gameswww.syntasoft.comPost-Time Horse Racing (Available Now)

This topic is closed to new replies.

Advertisement