• Create Account

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

5 replies to this topic

### #1scottrick49  Members

454
Like
0Likes
Like

Posted 07 February 2013 - 08:00 PM

I'm trying to use SOIL (Simple OpenGL Image Library) to load images in my project.  However, it is crashing whenever I call SOIL_load_image, from an unhandled exception writing location 0x00000014.  (I'm following this tutorial, btw: http://open.gl/textures).

I'm unsure of what I can do to fix this issue, but I think its something related to how I'm setting up the library.  Yesterday, I was trying to do something similar with libPNG and was running into a similar crash when the library attempted to do some file IO.  At the time, I thought it was probably an issue with the library, but now that I'm getting another crash with a different library, I think it might be me.

For the SOIL library, I built the project and copied the debug SOIL.lib to my VC/lib directory, and SOIL.h to the VC/include directory.  It seems to be building fine, but is crashing.  I tried it with the release .lib as well and the same thing happens.

Where I'm trying to load the image (GLTextureFactory.cpp):

#include "GLTextureFactory.h"

#pragma comment(lib, "SOIL")

#include <SOIL.h>

#include "GLTexture.h"

GLTextureFactory::GLTextureFactory(void)
{

}

GLTextureFactory::~GLTextureFactory(void)
{

}

GLTexture *GLTextureFactory::createTextureForImage(const char *imageFilename)
{
int width, height;

//CRASHING ON THIS LINE

//glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image );

return new GLTexture(0);
}

I have included GLM in my project, and am also linking against:
#pragma comment(lib, "GLFW")
#pragma comment(lib, "opengl32")
#pragma comment(lib, "glu32")
#pragma comment(lib, "glew32")

Any help is very appreciated!

Edited by scottrick49, 07 February 2013 - 08:04 PM.

scottrick49

### #2Ectara  Members

3097
Like
0Likes
Like

Posted 07 February 2013 - 08:12 PM

Where is GLTextureFactory::createTextureForImage() being called?

### #3scottrick49  Members

454
Like
0Likes
Like

Posted 07 February 2013 - 08:15 PM

Its getting called after my OpenGL context is created.  I don't think that's related to the problem, though, since I'm not actually doing anything OpenGL related in here. (yet).

scottrick49

### #4scottrick49  Members

454
Like
0Likes
Like

Posted 07 February 2013 - 08:24 PM

Ah, I forgot to mention, I'm getting one build warning, but I'm not sure how to fix it, or if its even relevant:

1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library


scottrick49

### #5Ectara  Members

3097
Like
1Likes
Like

Posted 07 February 2013 - 08:25 PM

Its getting called after my OpenGL context is created.  I don't think that's related to the problem, though, since I'm not actually doing anything OpenGL related in here. (yet).

It might be related. If filename is invalid, it could cause a crash. Try posting a minimal example that still exhibits the problem. If at any point after your remove something that isn't necessary and the problem goes away, investigate that.

### #6scottrick49  Members

454
Like
0Likes
Like

Posted 07 February 2013 - 08:40 PM

Hmm, I was able to fix the issue.  Evidently the order and/or location of all the #pragma comment(lib, "lib") makes a difference.  I put them all together in a different file and all is well.  I tried putting them all in my main.cpp, but that didn't work.  Not sure why.  Thanks for the help.

scottrick49

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.