Sign in to follow this  
silverphyre673

Anyone used DevIL before? I need help.

Recommended Posts

I'm using the DevIL image loading library for the loading of images into this image class I'm making. The class interfaces with the Win32 GDI in a fairly simple manner - it will only support loading images and blitting them to an HDC. Unfortunately, ilGenImages is making the program crash, and it seems to be a kind of neccessary function, you know? So here is what the program looks like (relevant to DevIL only and toned down for simplicity):
//Called once, when the program starts
Initialize()
{
    ilInit();
    iluInit();
    ilutRenderer(ILUT_WIN32);
}

image.h and image.cpp
#include <IL\il.h>
#include <IL\ilu.h>
#include <IL\ilut.h>

struct Image
{
    Image();
    ~Image();

    void LoadImage(const char * filename);

    ILuint my_image_name;
};

Image::Image()
{
    ilGenImages(1, &my_image_name);
}

Image::~Image()
{
    ilDeleteImages(1, &my_image_name);
}

void Image::LoadImage(const char * filename)
{
    ilBindImage(my_image_name);
    ilLoadImage(filename);
}

The program crashes if any IL function calls are made. Any ideas why? This is ALL I do with IL, and as long as I comment out all the IL functions (except the init functions, which don't cause a crash), it runs. Also, if I hypothetically got it to load the image properly, how would I blit the image to an HDC? Thanks a ton!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I've just read in the docs of DevIL, that many functions will crash unless you compile using Multithreading DLLs , I suggest you to check your compile options on that.

-Vicviper

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
I've just read in the docs of DevIL, that many functions will crash unless you compile using Multithreading DLLs , I suggest you to check your compile options on that.

-Vicviper


How would you do that? I've not had experience with anything of that nature before. I'm using Mingw, with Dev-Cpp. I've gotten it to work before, but I was using it for OpenGL, instead of Win32 GDI. It seems to support OpenGL better. Hmmm...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this