locked
Creating a page flipping effect RRS feed

  • Question

  • I am trying to create a page flipping effect of a over the wall that is burning on fire as a function of time. BMP images are saved on a zipped folder inside my game files.

    The problem is at loading those files on  D3DX11CreateShaderResourceViewFromMemory function, here  I get a runtime error code of type E_FAIL(0x80004005) . If I continue to debug the application (ignoring the exception breakpoints ) the wall get colored in black.

    Here is a part of my code :

    std::ifstream fin("Animation.zip", std::ios::binary);
    
    	fin.seekg(0, std::ios_base::end);
    	int size = (int)fin.tellg();
    	fin.seekg(0, std::ios_base::beg);
    	std::vector<char> Textures(size);
    
    	fin.read(&Textures[0], size);
    	fin.close();
    HRESULT(D3DX11CreateShaderResourceViewFromMemory(3DDevice,(LPCVOID)&Textures[0], size, 0,0, &ShaderSRV, 0));

    What I am doing wrong here, and how I can solve this?


    Admir

    Sunday, March 8, 2015 2:05 PM

Answers

  • Thank you for you answer Fred, I was able to create the flipping effect by creatig a SRV for each BMP image one by one.

    ID3D11ShaderResourceView* ShaderSRV[100];
    for (int i = 0; i < 100; ++i)	
    {	std::wstring filename = L"Animation/Fire";	
            if (i + 1 <= 9)	
    	filename += L"0";	
            if (i + 1 <= 99)		
            filename += L"0";	
            std::wstringstream frameNum;	
            frameNum << i + 1;	
            filename += frameNum.str();	
            filename += L".bmp";	
            HRESULT(D3DX11CreateShaderResourceViewFromFile(3DDevice,filename.c_str(), 0, 0, &ShaderSRV[i], 0));
    }


    Admir

    • Marked as answer by admiri92 Wednesday, March 11, 2015 3:18 PM
    Monday, March 9, 2015 7:39 PM

All replies

  • Hello Admir,

    >>What I am doing wrong here, and how I can solve this?

    From your provided code, it is hard to reproduce this issue, my suggestion is that:

    You could have a try with these two recommended method described on the page of this function:

    DirectXTK library (runtime), CreateXXXTextureFromMemory (where XXX is DDS or WIC)

    DirectXTex library (tools), LoadFromXXXMemory (where XXX is WIC, DDS, or TGA; WIC doesn't support DDS and TGA; D3DX 9 supported TGA as a common art source format for games) then CreateShaderResourceView

    For this exception “E_FAIL(0x80004005)”, there is a detail description for it:

    E_FAIL:Attempted to create a device with the debug layer enabled and the layer is not installed.

    As far as I know the debug layer is not installed by default, please install it and to check if the app works:

    https://msdn.microsoft.com/en-us/library/windows/desktop/ff476881(v=vs.85).aspx

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 9, 2015 8:56 AM
  • Thank you for you answer Fred, I was able to create the flipping effect by creatig a SRV for each BMP image one by one.

    ID3D11ShaderResourceView* ShaderSRV[100];
    for (int i = 0; i < 100; ++i)	
    {	std::wstring filename = L"Animation/Fire";	
            if (i + 1 <= 9)	
    	filename += L"0";	
            if (i + 1 <= 99)		
            filename += L"0";	
            std::wstringstream frameNum;	
            frameNum << i + 1;	
            filename += frameNum.str();	
            filename += L".bmp";	
            HRESULT(D3DX11CreateShaderResourceViewFromFile(3DDevice,filename.c_str(), 0, 0, &ShaderSRV[i], 0));
    }


    Admir

    • Marked as answer by admiri92 Wednesday, March 11, 2015 3:18 PM
    Monday, March 9, 2015 7:39 PM