jpgalleg
moon_rabbits

I cannot understand how to install the Grabber plugin from jpgalleg. I cannot find any of the directories it speaks of (allegro/tools/plugins, jpgalleg/plugins, etc.) or anything.

I used devpaks to install both allegro and jgpalleg. I can only find jpgalleg.h and a .a file for jpgalleg.

What can I do?

Ceagon Xylas

Check out the examples folder in jpgalleg.zip

This post never happened. :-X

moon_rabbits

It's not that I don't know how to use it; I can't get it installed properly.

When compiled, I get multiple definition errors and whatnot, even though everything should be installed properly.

Also, I have no idea where these directories are that the install instructions refer too. I have no allegro/tool directory, or any of the other ones it mentions.

Ceagon Xylas

You're using MinGW I assume.

You ran fix mingw32, make, and make install, correct? You did say you had the jpgalleg.h and jpgalleg.a files, so again, I assume so.

Have you tried to compile any of the examples?

moon_rabbits
Quote:

You ran fix mingw32, make, and make install, correct? You did say you had the jpgalleg.h and jpgalleg.a files, so again, I assume so.

Have you tried to compile any of the examples?

No, I didn't use mingw32 to install it. I have no idea how to install libraries like that, and have yet to find a tutorial that I've been successful learning from. I use .devpaks to install libraries. I used the Package Manager in DevCpp to install both Allegro and JPGalleg.

I get the same errors compiling the examples.

Timorg

The dev-pack must not have a copy of the grabber with the jpg stuff linked in. I followed the compile instructions for jpgalleg and the grabber plugin, and it worked fine.

The following link is a copy of grabber.exe and dat.exe with the plugin compiled in. Once you get used to building things from scratch, it becomes second nature.

http://www.timorg.net/jpg_dat_tools.zip

moon_rabbits

It crashes every time I Grab a JPG file. I'm running in Vista, btw.

Timorg

I tested it when I built it, and it worked, so I downloaded the one I uploaded, and it crashes. I went back to the ones I built, and they crash too now. I guess it might be a problem with the allegro dll being different to the one I built against. I will look into it.

Edit: I really don't know what is going on, I have rebuilt allegro, rebuilt jpgalleg (2.5 and 2.3) in various combinations, and it still doesn't work. I guess I must have imagined it working, cause it doesnt work now.

longear

Some time ago there was a similar thread about crashing when loading jpg-images.
I had this problem too with Allegro 4.2.0.
Then I tried jpgalleg version 2.5 with Allegro 4.0.3 and it worked with this grabber file! ???

Maybe this can help...

Timorg

longear: thanks for the advice, jpgalleg 2.5 grabber plugin does work with allegro-4.0.3 :)

I built allegro 4.0.3, I then built jpgalleg 2.5, then I built the grabber plugin, and made a copy of the grabber.exe and dat.exe. I then removed allegro 4.0.3, stuck on allegro 4.2.1 and built that, then built jpgalleg 2.5 against it.

I then built a simple test program that checked if data files created with the 4.0.3 grabber could be used by the 4.2.1 dll. The test worked fine, I hope that it doesn't have any problems.

http://www.timorg.net/jpgalleg.zip

This zip contains the grabber.exe, dat.exe, allegro-4.0.3 dll, a compiled jpgalleg 2.5 (against allegro 4.2.1), allegro 4.2.1 dll and an example program.

the example needs to be linked against '-lalleg' and '-ljpgal'

In jpgalleg, you need to copy the include directory to the mingw include directory and the lib\mingw32 to the mingw lib directory.

If you arnt using 4.2.1, you probably will need to recompile jpgalleg against whatever version you are using.

Peter Wang

Be careful with the 4.0.x branch and datafiles. There was a longstanding bug with file decompression. As I recall, on certain bitstreams it saved the data correctly, but then would refuse to load it (using a 4.2.1 version of grabber should load it though). Anyway, make backups.

moon_rabbits

The grabber works fine now, but any program I compile (including the test) crashes no matter what I do.

I try not using datafiles and just loading jpgs, I tried running wxDevcpp as admin, etc. etc. but it still always crashes.

If I include jpgalleg.h, it works fine, if I use jpgalleg_init(); it works fine, but as soon as I do anything that uses a .jpg file (like loading one) it crashes.

I'm using Allegro2.4.1, jpgalleg2.5, Windows Vista, and wxDevCpp. Any suggestions?

Timorg

I just tested the contents of the zip file, it seems to be working fine. I have put the example I used to test the code in here

You need to add the path '.' to the library directories, so that the compiler can find the local copy of libjpgal.a

1#include <allegro.h>
2#include "include/jpgalleg.h"
3 
4int main()
5{
6 allegro_init();
7 install_keyboard();
8 
9 jpgalleg_init();
10 
11 set_color_depth(32);
12 set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
13 BITMAP *fluffy = load_bitmap("fluffy.jpg", NULL);
14 if (fluffy == NULL)
15 {
16 allegro_message("unable to load file. :(");
17 return 1;
18 }
19 
20 blit(fluffy, screen, 0, 0, 0, 0, fluffy->w, fluffy->h);
21 destroy_bitmap(fluffy);
22 readkey();
23 
24 return 0;
25}
26END_OF_MAIN()

A last thought, are you checking the return value of load_bitmap()?, if might be failing because it couldn't load an image, and when you blit, it crashes. Rather than crashing on load.

Thread #591566. Printed from Allegro.cc