So I've tried using DevIL to load images for my small OpenGL program. The program compiles fine, but each time I run it, the program crashes and it gives me one of those common windows error messages (the ones that asks whether you want to send an error report or not).. I tried debugging it in Visual C++, but and it gets stuck at the following errors
First-chance exception at 0x00000000 in 2dgame.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00000000 in 2dgame.exe: 0xC0000005: Access violation reading location 0x00000000.
I've also tried using some of the .exe files from NeHe that uses OpenIL, but all of them causes the same error..
The error seems to occur when I use the ilLoadImage("lol.jpg") function, since everything works fine once I've taken it out, or change it to ilLoadImage(""). Here's my code, I've taken out some parts that are not related to OpenIL:
#include <gl\glut.h>
#include <IL\il.h>
#include <IL\ilu.h>
#include <IL\ilut.h>
GLuint texture[2];
int LoadGLTextures()
{
ILuint ImgId;
ilGenImages(1, &ImgId);
ilBindImage(ImgId);
if (!ilLoadImage("lol.jpg")) {
ilDeleteImages(1, &ImgId);
return FALSE;
}
texture[1] = ilutGLBindTexImage();
ilDeleteImages(1, &ImgId);
return TRUE;
}
void InitIL()
{
ilInit();
iluInit();
ilutRenderer(ILUT_OPENGL);
}
void main(int argc, char **argv) {
InitGL();
...
}
Anyone know what is causing this problem?
Sorry if this is a silly question.. I'm new to OpenGL and I'm not a very good programmer myself..