Jump to content

  • Log In with Google      Sign In   
  • Create Account

D3DXCreateTextureFromFile() failing


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 littletray26   Members   -  Reputation: 267

Like
0Likes
Like

Posted 02 June 2012 - 01:26 AM

Hey gamedev

I have a sprite locate at "C:\Users\Jyhe\Documents\Visual Studio 2010\Projects\2D test\2D test\Resources\Sprites\crosshair.png"

and I'm trying to load it with the following code:

D3DXCreateTextureFromFile(rd3dDevice, (GetDirectory().c_str(), L"\\Resources\\Sprites\\crosshair.png"), &crosshair)

But it's failing to load the texture.

My GetDirectory function returns "C:\Users\Jyhe\Documents\Visual Studio 2010\Projects\2D test\2D test" and is as follows:


std::wstring GetDirectory()
{
	 return currentDir;
}

currentDir is defined as follow:

TCHAR currentDirectory[MAX_PATH + 1];
std::wstring currentDir;

... later on in code


GetCurrentDirectory(MAX_PATH + 1, currentDirectory);
currentDir = currentDirectory;

Any idea why this is failing?
The majority of Internet Explorer users don't understand the concept of a browsing application, or that there are options.
They just see the big blue 'e' and think "Internet". The thought process usually does not get much deeper than that.

Worms are the weirdest and nicest creatures, and will one day prove themselves to the world.

I love the word Clicky :)

Sponsor:

#2 kubera   Members   -  Reputation: 924

Like
0Likes
Like

Posted 02 June 2012 - 03:07 AM

Maybe you would write the code this way:

D3DXCreateTextureFromFile(rd3dDevice, (GetDirectory() + L"\\Resources\\Sprites\\crosshair.png").c_str(), &crosshair)


#3 littletray26   Members   -  Reputation: 267

Like
0Likes
Like

Posted 02 June 2012 - 03:12 AM

Maybe you would write the code this way:

D3DXCreateTextureFromFile(rd3dDevice, (GetDirectory() + L"\\Resources\\Sprites\\crosshair.png").c_str(), &crosshair)


I feel stupid -__-

Thank you! :)
The majority of Internet Explorer users don't understand the concept of a browsing application, or that there are options.
They just see the big blue 'e' and think "Internet". The thought process usually does not get much deeper than that.

Worms are the weirdest and nicest creatures, and will one day prove themselves to the world.

I love the word Clicky :)

#4 kubera   Members   -  Reputation: 924

Like
0Likes
Like

Posted 02 June 2012 - 04:26 AM

Posted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS