MipMapping in Direct3D IM

Started by
2 comments, last by Dmitry Vasilijev 23 years, 9 months ago
Help! Little question. How can I create & use mipmap? I''ve tried to make MipMap sample with using directx7 SDK help file but it dosn''t working.
Advertisement
What is it that dosn´t works?

Gandalf the Blue
Gandalf the Black
In my PC the sample of sdk run perfectly!.


-eng3d.softhome.net-
-----------------------------------------------"Cuando se es peon, la unica salida es la revolución"
That''s my code (rip from DX7 SDK help file)

It''s only load the main texture without any mipmaps.
Where I mistake?

DDSURFACEDESC2 ddsd;
LPDIRECTDRAWSURFACE7 lpDDMipMap;
ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_MIPMAPCOUNT;
ddsd.dwMipMapCount = 5;
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE |
DDSCAPS_MIPMAP | DDSCAPS_COMPLEX;
ddsd.dwWidth = TextureWidth;
ddsd.dwHeight = TextureHeight;

ddres = lpDD->CreateSurface(&ddsd, &lpDDMipMap);
if (FAILED(ddres))

LPDIRECTDRAWSURFACE7 lpDDLevel, lpDDNextLevel;
DDSCAPS2 ddsCaps;
HRESULT ddres;

lpDDLevel = lpDDMipMap;
lpDDLevel->AddRef();
ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP;
ddres = DD_OK;
while (ddres == DD_OK)
{
In this place I use StretchBlt to blit downscaled texture to the lpDDLevel surface

ddres = lpDDLevel->GetAttachedSurface(
&ddsCaps, &lpDDNextLevel);
lpDDLevel->Release();
lpDDLevel = lpDDNextLevel;
}
if ((ddres != DD_OK) && (ddres != DDERR_NOTFOUND))
{
// Code to handle the error goes here
}

This topic is closed to new replies.

Advertisement