hey.
makn a heightmap here and have run into a bit of a boo boo.
Ive spent last 2 hours searching through google and gamedev on a possible solution and have tried fixing it myself.
basically my D3DXCreateTextureFromFile is failing.
I think primarerly that when i specify the file to be loaded, i am missing like \0 or \n at the end..or something liek that, as the file is in same directory.
here is the relevent code, if any1 can point me in the right direction id be very happy.
i have these includes:
#include <d3dx9.h>
#include <d3d9.h>
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")
bool cHeightMap::loadHeightMapTexture( std::string fileName )
{
HRESULT hr = 0;
hr = ::D3DXCreateTextureFromFile( mDevice, fileName.c_str(), &mTexture );
if( FAILED( hr ) )
{
::MessageBox(0,"ERROR: Texture Not Loaded successfully. ",fileName.c_str(), MB_ICONERROR );
return false;
}
return true;
}
in debug mode, this compiles and goes into the FAILED part, displays message and returns false.
mDevice is initalized and i have the DirectX window all set up.
here how the varibles above are initalized.
fileName = "terrain.raw";
// Texture is as below. //
Direct3DTexture9* mTexture
the file is in the right place, all spelling is the same.
....just cant figure out what i'm missing..
Ive scoured the web for adive and would be really thankfull if any1 the problem.
cheerz.