Discussion:
I can't create a (primary) surface in windowed mode 256 color palette in DirectDraw.
(too old to reply)
Ludas Matyas
2004-07-19 22:29:18 UTC
Permalink
I can't create a (primary) surface in windowed mode 256 color palette in
DirectDraw.

CooperativeLevel is DDSCL_NORMAL.
I set DDSURFACEDESC's dwFlags to DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH |
DDSD_PIXELFORMAT
ddsCaps.dwCaps member is DDSCAPS_PRIMARYSURFACE.

ddsd.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8

What else needs to be initialised? Or is anything not correct somewhere?

Thanks,
Ludas
GuitarBill
2004-07-20 05:02:52 UTC
Permalink
ddsd.dwSize = sizeof(ddsd);
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
ddsd.ddpfPixelFormat.dwRGBBitCount = 8;

You might alse want to specify dwCaps | DDSCAPS_VIDEOMEMORY or
DDSCAPS_SYSTEMMEMORY depending on what you want to do.
Post by Ludas Matyas
I can't create a (primary) surface in windowed mode 256 color palette in
DirectDraw.
CooperativeLevel is DDSCL_NORMAL.
I set DDSURFACEDESC's dwFlags to DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH |
DDSD_PIXELFORMAT
ddsCaps.dwCaps member is DDSCAPS_PRIMARYSURFACE.
ddsd.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8
What else needs to be initialised? Or is anything not correct somewhere?
Thanks,
Ludas
Murrgon
2004-07-20 13:29:09 UTC
Permalink
If you are running in windowed mode, unless your desktop is already
running in 256 colour mode, you won't be able to create a primary
surface that uses 256 colours. It will use whatever mode your
desktop is running in. If you switch to fullscreen exclusive mode
you can set it to 256 colours and then create a primary surface
that uses 256 colours.
The primary surface (in DirectDraw anyway) always represents
the physical display or what you are seeing at any given time.
You don't use the DDSCAPS_SYSTEMMEMORY and DDSCAPS_VIDEOMEMORY
flags because a primary surface automatically implies that it
is in video memory. You can't create a primary surface in
system memory. A back buffer, on the other hand, you can
create in system memory for windowed mode, but you may not want
to.
Post by Ludas Matyas
I can't create a (primary) surface in windowed mode 256 color palette in
DirectDraw.
CooperativeLevel is DDSCL_NORMAL.
I set DDSURFACEDESC's dwFlags to DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH |
DDSD_PIXELFORMAT
ddsCaps.dwCaps member is DDSCAPS_PRIMARYSURFACE.
ddsd.ddpfPixelFormat.dwFlags = DDPF_PALETTEINDEXED8
What else needs to be initialised? Or is anything not correct somewhere?
Thanks,
Ludas
Loading...