🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

D3D7 Full Screen

Started by
3 comments, last by I-Shaolin 24 years, 6 months ago
Okay, here''s the situation. I am an experienced 3D programmer in both strait software and Glide. I also know DirectDraw so when I decided to start a new engine with Direct3D, I didn''t figure I would have too much trouble at least getting something started. Go figure... Can anyone tell me why the following code doesn''t work? It dies when it tries to get the pointer to the back buffer, even though I double checked it with the DX samples. // Create Our DirectDraw Object if (FAILED(DirectDrawCreateEx(NULL, (void**)&g_lpDD7, IID_IDirectDraw7, NULL))) throw "Failed To Create The Main DirectDraw Object"; // Set The Cooperation Level if (FAILED(g_lpDD7->SetCooperativeLevel(g_hWnd, DDSCL_EXCLUSIVE / DDSCL_FULLSCREEN))) throw "Failed To Set The Cooperation Level"; // Set Our Display Mode if (FAILED(g_lpDD7->SetDisplayMode(640,480,32,0,NULL))) if (FAILED(g_lpDD7->SetDisplayMode(640,480,24,0,NULL))) throw "Failed To Set The Display Mode"; // Define Our Flipping Chain DDSURFACEDESC2 ddsd2; ZeroMemory(&ddsd2, sizeof(ddsd2)); ddsd2.dwSize = sizeof(ddsd2); ddsd2.dwFlags = DDSD_CAPS / DDSD_BACKBUFFERCOUNT; ddsd2.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE / DDSCAPS_3DDEVICE / DDSCAPS_FLIP / DDSCAPS_COMPLEX; ddsd2.dwBackBufferCount = 1; // Create Our Flipping Chain if (FAILED(g_lpDD7->CreateSurface(&ddsd2, &g_lpDDS7_Front, NULL))) throw "Failed To Create Our Flipping Surfaces"; // Define That We Want The Back Flipping Surface DDSCAPS2 ddsCaps2; ZeroMemory(&ddsCaps2, sizeof(ddsCaps2)); ddsCaps2.dwCaps = DDSCAPS_BACKBUFFER; // Get The Back Flipping Surface if (FAILED(g_lpDDS7_Front->GetAttachedSurface(&ddsCaps2, &g_lpDDS7_Back))) throw "Failed To Obtain Our Back Surface"; This is where the exception is thrown. I have tried different combination of flags, but to no avail. Perhaps I am just tired, but help here would be appriciated.
Advertisement
Everything looks OK to me, it's how I do it.
Just a test though, the "or" sign is / but on the
board it looks like forward slashes /... Weird font?
I'm sure you didn't mistake the two :-)

Also, try making a 16 bit surface and seeing if that
works, if it does maybe something about your card or
monitor keeps it from going into 32 or 24 bit mode.
(This was the only difference between my code and
yours, really, though this should make it go wrong earlier)

It would be helpful to know which return value you're
getting from GetAttachedSurface. The docs say it can
return:
DDERR_INVALIDOBJECT
DDERR_SURFACELOST
DDERR_NOTFOUND
DDERR_INVALIDPARAMS
(But its not always limited to what the docs say it
might return), This would be a major clue.





-ns-

Edited by - NightShade on 1/10/00 2:58:36 PM
-ns-
Just a question from a newbie -- the DX tutorials create a primary surface without the DDSCAPS_3DDEVICE and other flags and then a second surface with the DDSCAPS_3DDEVICE and DDSCAPS_OFFSCREENPLAIN flags. That way you must use blitting, but can you really create two DDSCAPS_3DDEVICE surfaces for flipping?

Oh, and you forgot to set the dwSize parameter after the second call to ZeroMemory. (I always use one function with a big switch statement that contains all the DX error codes for debug purposes. In that case it would be something like DDERR_INVALIDPARAMS.)

Thanks!

- null_pointer
what does your CreateWindow() line look like?
Yeah I saw that too, but DDSCAPS2 structures are just bitfields and don''t have a dwSize member.

As for the 3d device question, I dont really know as when I make a non-fullscreen (non flipping) I do like the examples and make only the back buffer (the render target) a 3d capable surface.
My inclination is to say "sure why not" as I havn''t seen anything that says you can''t do it and then render to the
primary surface or the back buffer, but who knows, you''d have to try it I guess (and maybe it differs from card to card too)



-ns-
-ns-

This topic is closed to new replies.

Advertisement