Skip to main content
gamedev.net
🔒 Locked

DirectX Code Rot?

Started by Stark 10 replies 850+ views
Original Post
Stark
Stark
Ok, so I've dug some old code that I wrote about 6 months ago and started playing with it. Problem is, when I try to run the executable it produces, it fails. I've traced the problem into this piece of code: DDSURFACEDESC2 ddsd; // DD surface description (Primary surface) DDSCAPS2 ddscaps; // DD surface capabilites struct // 0-fill ddsd (just to be safe) ZeroMemory(&ddsd, sizeof(ddsd)); // Fill in the surface description ddsd.dwSize = sizeof(ddsd); // Set the size ddsd.dwFlags = DDSD_CAPS / DDSD_BACKBUFFERCOUNT; // Set valid flags ddsd.dwBackBufferCount = DISPLAY_BACKBUFFERCOUNT; // Back buffer count ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE / // Request a primary surface DDSCAPS_COMPLEX / // " a complex surface DDSCAPS_FLIP; // " a flippable surface // Create the primary surface if (FAILED(rVal = m_lpDD->CreateSurface(&ddsd, &m_lpDDSPrimary, NULL))) return rVal; The call to CreateSurface always fails with "Invalid Params". I don't understand why when this worked six months ago. Everything that I do prior to this call; SetDisplayMode, Initialize, etc. works fine and returns DD_OK. It's only this call that fails (in any display mode I try). If somebody has had a similar problem, please let me know. Thanks, David Edited by - Stark on 7/6/00 12:21:24 PM
Muzzafarath
Muzzafarath
Anonymous, the board turns binary OR operators into divides. /// (that *should* be three binary OR signs, but they show up as divides).

- Muzzafarath

Mad House Software
The Field Marshals
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Stark
Stark
Crap, stupid copy and past. hehe. The flags aren''t actually being divided in the code. It must''ve gotten twisted during the copy and past.
Stark
Stark
Ya, I guess it does convert them. How odd. I thought I musta screwed up something as basic as copy and paste until I tried to edit my original post.
DeltaVee
DeltaVee
I have had a similar problem. I think the problem lies in the fact that your driver doesn''t support one of the Caps
DDSCAPS_COMPLEX or DDSCAPS_FLIP. Do a DevCaps to findout if these are supported on your machine.
D.V.Carpe Die<FONT C
Stark
Stark
quote:
Original post by DeltaVee

I have had a similar problem. I think the problem lies in the fact that your driver doesn''t support one of the Caps
DDSCAPS_COMPLEX or DDSCAPS_FLIP. Do a DevCaps to findout if these are supported on your machine.


It''s possible. The only thing that has changed is my machine. Originally developped my code using a P-166 and Matrox Mystique. Recently, I upgraded to an Athlon 550 with a TNT2.

Weird thing is, I''ve tried to write the struct initialise like so, also:

ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;


It still return "Invalid Params".

I''ve tried this same code on a GeForce, and a 3D Rage Pro. All with the same result.
SlimShady38
SlimShady38
I get a similar weird ass problem when trying to attach a backbuffer, but only in DirectX 7.

I have 650 athlon and Rage 128.
Stark
Stark
DISPLAY_BACKBUFFERCOUNT is 1, yes. Used to be two, actually. Neither makes a difference.
Stark
Stark
Ok. I figured out the problem. It turns out that my initial call to CoCreateInstance was requesting an interface to IID_IDirectDraw2 when it should have been requesting IID_IDirectDraw7. Ooops. I guess that''s one of the perils of porting code from WinNT to 98.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.