cant create D3D textures - LPCSTR problem
Apr 2, 2011 at 3:48pm
Hey guys. I am trying to create some textures with D3D however I can't get it to work. It keeps failing to initialise the textures :(
How can I store a string like this...
1 2 3
|
char *myTexture = "filepath_of_my_texture.jpg";
|
... so it can be used to initialise a D3D texture like this...
1 2 3
|
HRESULT result = D3DXCreateTextureFromFile(&d3dManager->getDevice(), myTexture, &D3D_Texture_Pointer);
|
Here is the prototype for the D3D create texture function used above...
HRESULT D3DXCreateTextureFromFile(
__in LPDIRECT3DDEVICE9 pDevice,
__in LPCTSTR pSrcFile,
__out LPDIRECT3DTEXTURE9 *ppTexture
);
Thanks in advance :)
Apr 2, 2011 at 5:43pm
It depends on your compiler/project settings if is set to use unicode. Use:
1 2 3 4
|
#include <tchar.h>
...
TCHAR* myTexture = _T("filepath_of_my_texture.jpg");
HRESULT result = D3DXCreateTextureFromFile(&d3dManager->getDevice(), myTexture, &D3D_Texture_Pointer);
|
or append A to end of function with char* as your file name:
|
D3DXCreateTextureFromFileA(...);
|
Last edited on Apr 2, 2011 at 5:45pm
Topic archived. No new replies allowed.