SFML community forums
Help => Graphics => Topic started by: LionMX on October 24, 2010, 07:09:00 pm
-
Hey guys,
I hope someone can help with the problem I currently have. I have created a LoadTexture method in my VideoSystem class which looks as follows:
bool VideoSystem::LoadTexture( char* texName, GLuint texHandle )
{
sf::Image image;
// Load the image
if(!image.LoadFromFile( texName ))
return false;
// Set the texHandle as current
glBindTexture(GL_TEXTURE_2D, texHandle);
// Create the texture
glTexImage2D(GL_TEXTURE_2D, 0, 4, image.GetWidth(), image.GetHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, image.GetPixelsPtr());
// Specify filtering and edge actions
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
return (TRUE);
}
I am trying to pass the following:
videoSystem->LoadTexture("Logo.tga", texture[0]);
But I get:
Failed to load image "Logo.tga". Reason : Unable to open file
I have the files in the same folder as the project and source but this doesn't seem to work.
Any help would be greatly appreciated.
-
What IDE are you using?
Try putting the file in the same directory as the executable.
-
I am using Visual C++, I have checked the current directory in the configuration options and I can confirm the correct location is given.
I also changed the method in which I include the libraries, and used the .dll method described in the website instructions.
Now, when I run the program I get some really strange artefacts in the console window and a random beeping noise.
I have debugged the program and I can see that the error occurs when I call the SFML function LoadTexture().
Does anyone have any ideas about this?
Again, any help is greatly appreciated.
-
'SFML-Window.exe': Loaded 'I:\My documents\Programming\Games\SpaceCowboys1\Debug\SFML-Window.exe', Symbols loaded.
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll'
'SFML-Window.exe': Loaded 'I:\My documents\Programming\Games\SpaceCowboys1\sfml-window.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\user32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll'
'SFML-Window.exe': Loaded 'I:\My documents\Programming\Games\SpaceCowboys1\sfml-system.dll'
'SFML-Window.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb\msvcp90.dll'
'SFML-Window.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb\msvcr90.dll'
'SFML-Window.exe': Loaded 'I:\My documents\Programming\Games\SpaceCowboys1\sfml-graphics.dll'
'SFML-Window.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcp90d.dll', Symbols loaded.
'SFML-Window.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcr90d.dll', Symbols loaded.
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\apphelp.dll'
'SFML-Window.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\userenv.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\profapi.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\winspool.drv'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\mpr.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\nvoglv32.dll'
The thread 'Win32 Thread' (0x318) has exited with code 0 (0x0).
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\guard32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\version.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\fltLib.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\dinput.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\hid.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll'
'SFML-Window.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll'
First-chance exception at 0x74ef8499 in SFML-Window.exe: 0xC0000005: Access violation reading location 0x00344000.
Unhandled exception at 0x77a8158e in SFML-Window.exe: 0xC0000005: Access violation.
The program '[708] SFML-Window.exe: Native' has exited with code -1073741819 (0xc0000005).
Above is the error log I recieve - could this be because I use a 64bit version of Windows7 ??