EDN Admin
Well-known member
Merry Christmas!
Using:
Visual Studio 2010
DirectX 10
Anyway, to the question. I am workign on a 2D game project. Previously I have written code with the call D3DX10CreateTextureFromFile()......which works. I am trying to get away from having to load graphics (bitmaps) from the hard disk at
runtime, but this is proving to be extremely difficult. The avenue I explored was to include needed bitmaps in a resource file (*.rc). However, I have searched for hours and cannot find any helpful documentation as to how to implement from there.
i have tried the functions:
D3DX10CreateTextureFromResource()
<pre class="prettyprint hResult=D3DX10CreateTextureFromResource(pD3DDevice,GetModuleHandle(0), MAKEINTRESOURCE(IDB_BITMAP1), 0 , 0 , &pD3D10Resource , 0 );[/code]
D3DX10CreateTextureFromMemory()
<span style="font-size:small <span style="font-size:small
<pre class="prettyprint HBITMAP hBit = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_BITMAP1));
hResult=D3DX10CreateTextureFromMemory(pD3DDevice,hBit, 0 , 0 , 0 , &pD3D10Resource , 0 );[/code]
<br/>
Since the 2nd parameter for D3DX10CreateTextureFromMemory is a LPCVOID pointer, I tried the HBITMAP one, and even casting it to HMODULE doesnt work. Im just stuck here.
It seems that the system will recognize the resource bitmaps, as evidenced by a successful call to LoadBitmap(). However, I am stuck as to HOW TO ACCESS the bitmap data to create a D3D10 texture! My hResult always returns as E_FAIL with either
of these function calls.
View the full article
Using:
Visual Studio 2010
DirectX 10
Anyway, to the question. I am workign on a 2D game project. Previously I have written code with the call D3DX10CreateTextureFromFile()......which works. I am trying to get away from having to load graphics (bitmaps) from the hard disk at
runtime, but this is proving to be extremely difficult. The avenue I explored was to include needed bitmaps in a resource file (*.rc). However, I have searched for hours and cannot find any helpful documentation as to how to implement from there.
i have tried the functions:
D3DX10CreateTextureFromResource()
<pre class="prettyprint hResult=D3DX10CreateTextureFromResource(pD3DDevice,GetModuleHandle(0), MAKEINTRESOURCE(IDB_BITMAP1), 0 , 0 , &pD3D10Resource , 0 );[/code]
D3DX10CreateTextureFromMemory()
<span style="font-size:small <span style="font-size:small
<pre class="prettyprint HBITMAP hBit = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_BITMAP1));
hResult=D3DX10CreateTextureFromMemory(pD3DDevice,hBit, 0 , 0 , 0 , &pD3D10Resource , 0 );[/code]
<br/>
Since the 2nd parameter for D3DX10CreateTextureFromMemory is a LPCVOID pointer, I tried the HBITMAP one, and even casting it to HMODULE doesnt work. Im just stuck here.
It seems that the system will recognize the resource bitmaps, as evidenced by a successful call to LoadBitmap(). However, I am stuck as to HOW TO ACCESS the bitmap data to create a D3D10 texture! My hResult always returns as E_FAIL with either
of these function calls.
View the full article