Jump to content
  • Advertisement
Sign in to follow this  
POLSKASH

CreateTextureFromFileEx()

This topic is 4831 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

Hmm, when I run the code from within VC++, my error checking code pulls up a message when I try to load a texture, but when I run the executable in the debug folder, the error message doesn't pop up. Is there a difference in running it from VC++ and the .exe? Also, excluding this problem, I have a ID3DXSprite* sprite and when I make this function call: sprite->Draw(bg,NULL,NULL,NULL,modulate); with modulate being set to 0xFFFFFFFF, it says that Draw() does not take 5 parameters? What the hell? Haha. It most definately does take 5 parameters according to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3dx/interfaces/ID3DXSprite/Draw.asp

Share this post


Link to post
Share on other sites
Advertisement
Make sure you have the latest DX9 SDK. Some stuff got tweaked a bit through some of the different releases.

As for the error message when loading the texture...it sounds like a path problem. Make sure you're code is looking in the correct place for the texture and that the texture is placed in the correct location relative to your .exe / Working Directory. Try moving the texture around to different places until it runs without the error.

Share this post


Link to post
Share on other sites
I just installed the April version of 9.0c, and nothing changes. My bg.bmp is in the same folder as my .exe file. Not sure what's going on, and it's still saying ID3dXSprite->Draw() doesn't take 5 parameters.

Share this post


Link to post
Share on other sites
Ahh, I forgot to include the INCLUDE directory in the new SDK's folder. It compiles fine now, but the loading of the texture is still screwed, and it seems like it's not loading the texture when I run the .exe either because it's not drawing the texture like it's supposed to :(

TitleScreen.cpp

#include "TitleScreen.h"

TitleScreen::TitleScreen(IDirect3D9* d3d, IDirect3DDevice9* device, int* purp)
{
isPlaying = true;
purpose = purp;
D3D = d3d;
D3D_device = device;
modulate = 0xFFFFFFFF;

if(FAILED(D3DXCreateSprite(D3D_device, &sprite)))
{
MessageBox(NULL, "Failed to create D3DX Sprite Interface!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
}

if(FAILED(D3DXCreateTextureFromFileEx(D3D_device,"bg.bmp", 0, 0, 1, 0, D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED, D3DX_FILTER_NONE, D3DX_DEFAULT,
0, 0, NULL, &bg)))
{
MessageBox(NULL, "Failed to load background texture!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
}
}

bool TitleScreen::Run()
{
while(Msg.message != WM_QUIT && isPlaying)
{
if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
else
{
D3D_device->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_RGBA(0,0,192,255),1.0f,0);
D3D_device->BeginScene();

sprite->Draw(bg,NULL,NULL,NULL,modulate);

D3D_device->EndScene();
D3D_device->Present(NULL,NULL,NULL,NULL);
}
}
return false;

}



All that's showing up is my blue backbuffer.

Share this post


Link to post
Share on other sites
Does anyone have any idea why CreateTextureFromFileEx is not working for me? Does anyone ever recall having problems with it? If I can't load the textures, I can't have any graphics! Any help would be appreciated.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!