Jump to content
  • Advertisement
Sign in to follow this  
admiri92

Creating a page flipping effect

This topic is 1374 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement

You might want to look into libraries like physicsfs for reading files from zips that you can then use WIC or D3DX to convert into SRVs. I have working code for this in my game I'm willing to share if you're curious.  Let me know. :)

Share this post


Link to post
Share on other sites

You might want to look into libraries like physicsfs for reading files from zips that you can then use WIC or D3DX to convert into SRVs. I have working code for this in my game I'm willing to share if you're curious.  Let me know. smile.png

It would help me. It's a pleasure to take a look on you game code :) . I am interested on reading files from zips and then use d3dx to converts to SRVs.

Share this post


Link to post
Share on other sites

No problem, I will dig out some of my source on Tuesday when I'm next at my pc and send it along :) hope it helps!

 

BTW I don't use D3DX, and instead use WIC as MSDN said D3DX was depreciated, but once you have the image file in ram, the world is your oyster :)

Share this post


Link to post
Share on other sites

Will be waiting for it. I know d3dx is depreciated for windows 8 apps. but just wanted to try it on a desktop app. A was able to create page flipping effect by creatig a SRV for each BMP image one by one. I manually unziped dhe folder than i read image files one by one, they are named like "fire001.bmp , fire002.bmp ,... fire100.bmp" .

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));
}
Edited by admiri92

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!