Jump to content

  • Log In with Google      Sign In   
  • Create Account


SkyRaign

Member Since 23 Dec 2012
Offline Last Active Oct 07 2013 06:36 PM
-----

Posts I've Made

In Topic: Using bitmap resources (*.rc) in Visual Studio 2010

23 December 2012 - 10:49 PM

Well Ravnock I looked into the links you provided.  Having investigated further I still cannot see why D3DX10CreateTextureFromResource is not working.  The second parameter should be a handle to the instance creating it, which in my case should be the .exe.  Having made that change it still does not work.

 

hResult=D3DX10CreateTextureFromResource(pD3DDevice,GetModuleHandle(0), MAKEINTRESOURCE(IDB_BITMAP1), 0 , 0 ,  &pD3D10Resource , 0 );

 

 

I tried using D3DX10CreateTextureFromMemory as follows:

 

HBITMAP hBit = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_BITMAP1));

hResult=D3DX10CreateTextureFromMemory(pD3DDevice,hBit, 0 , 0 , 0 , &pD3D10Resource , 0 );

 

It did not work, even if I cast hBit to "HMODULE".  LoadBitmap() -->DOES<-- return a valid pointer to a bitmap, but now I am left with how to access it through Direct3D10.  The second paramter to the function call is an LPCVOID pointer but I can't seem to make it work for me.  Still, all I am getting here is E_FAIL in the hResult return value.

 

Bout ready to pull the hair out of my head here.  What on earth could I be missing?  Is it maybe a linker issue?


In Topic: Using bitmap resources (*.rc) in Visual Studio 2010

23 December 2012 - 04:16 PM

Ok so I have seemingly made some progress.  Here is what the code looks like now:

 

In my resource file, "resource3.h":

 

#define IDB_BITMAP1 101

 

In my main file:

 

#include "resource3.h"

 

hResult = D3DX10CreateTextureFromResource(pD3DDevice,0,MAKEINTRESOURCE(IDB_BITMAP1),0,0,&pD3D10Resource,0);

 

This example compiles, but the hResult always returns as "E_FAIL".  Conveniently enough, this is the "unspecified" code.  Some of the

tutorials I have read have indicated coding things this way but it just isn't working.  Any thoughts?


In Topic: Using bitmap resources (*.rc) in Visual Studio 2010

23 December 2012 - 09:54 AM

Ravnock:

You are undoubtedly right about the game size but right now I am just trying to learn how to use the resources. This is SOOOOOOO frustrating. I looked at the links you posted and followed http://www.winprog.o.../resources.html the best I could (using "BITMAP" as a resource type instead of "ICON") but it did not work.

Nick C.:

Noting the above, this is the result of what I get:

In my resource file, "resource3.h"
#define IDB_BITMAP1 101

In my main file:

#include "resource3.h"
~
~
~
~
IDB_BITMAP1 BITMAP "Image.bmp";

^^^these are the compiler errors that I get
1>DirectX10 Exp Part 2.cpp(214): error C2146: syntax error : missing ';' before identifier 'BITMAP'
1>DirectX10 Exp Part 2.cpp(214): error C2143: syntax error : missing ';' before 'string'1>DirectX10 Exp Part 2.cpp(214): error C2275: 'BITMAP' : illegal use of this type as an expression

I haven't even gotten to creating textures yet. Bottom line is I want to be able to use these bitmap resources to create textures through Direct3D10 functionality. This seems like such a simple issue but I cannot find ANY helpful documentation on this!

PARTNERS