Microsoft KB Archive/175543

From BetaArchive Wiki

HOWTO: Texture Rendered Upside Down in Direct3D Retained Mode


The information in this article applies to:

  • Microsoft DirectX Software Development Kit, version 5.0


In DirectX 3, a texture loaded from a .bmp file with the IDirect3DRM::LoadTexture method is rendered upside down. In DirectX version 5.0, you can use the new IDirect3DRM2 interface to load a .bmp file and have it displayed right side up.


This behavior in DirectX 3 needed to be preserved in DirectX 5.0 (in IDirect3DRM) for backward compatibility with older applications. In DirectX 5.0, you can call IDirect3DRM2::LoadTexture to load a .bmp file and have it rendered right side up.

If you are writing a DirectX 5.0 (or later) application that uses the IDirect3DRM interface, then you should call QueryInterface on IDirect3DRM to obtain the IDirect3DRM2 interface if you would like your .bmp files loaded with LoadTexture() to be displayed right side up. The texture must be placed in a DIRECT3DRMTEXTURE2 object. Here is an example in "C" which demonstrates this process:


   // Query the IDirect3DRM2 interface off of Direct3DRM.
   rval = lpD3DRM->lpVtbl->QueryInterface(lpD3DRM,
   if (rval != D3DRM_OK)
      Msg("Failed to obtain the IDirect3DRM2 interface.\n");
      goto ret_with_error;

   // Load the texture with the new interface
   rval = lpD3DRM2->lpVtbl->LoadTexture(lpD3DRM2, "test.bmp", &tex);
   if (rval != D3DRM_OK)
      Msg("Failed to load test.bmp.\n");
      goto ret_with_error;

   // Release the IDirect3DRM2 interface

Additional query words:

Keywords : kbDirect3dRM KbDirectX kbSDKWin32 kbFAQ _IK
Issue type : kbhowto
Technology : kbSDKDirectXsearch kbAudDeveloper kbSDKDirectX500

Last Reviewed: June 26, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.