Selecting A Mipmap to Display

BlitzMax Forums/BlitzMax Programming/Selecting A Mipmap to Display

TartanTangerine (was Indiepath)(Posted 2006) [#1]
Can anyone tell me what is wrong with this code?!?? I know the mipmaps are created and I can transverse them BUT I'm having problems passing the mipmap surface, all that gets rendered is a white texture.

	Function SetMipMap(Image:TImage,Level:Int)
	
		Local DXFrame:TD3D7ImageFrame = TD3D7ImageFrame (image.frame(0))
		
		Local	src:IDirectDrawSurface7
		Local	dest:IDirectDrawSurface7
		Local	caps2:DDSCAPS2
		caps2=New DDSCAPS2
		caps2.dwCaps=DDSCAPS_TEXTURE|DDSCAPS_MIPMAP|DDSCAPS_3DDEVICE
		caps2.dwCaps2= DDSCAPS2_MIPMAPSUBLEVEL
	
		src = DXFrame.Surface
				
		Local res = src.GetAttachedSurface(caps2,Varptr dest)
		
		If res<>DD_OK 
			tRenderERROR = tError(res)
			Return False
		EndIf
		
		DXFrame.Surface =  dest  ' <------ I reckon the problem is here, this just seems too simple.
		dest.Release_
		
		Print "MipMap Selected OK"
		Return True
	
	End Function