Allegro Setup


jkgp2x

Still Fresh
Joined
Feb 7, 2006
Messages
32
how do i set up allegro to work with the gp2x. Do i need to initialize it a special way because when i try to use a allegro program that i compiled a black screen just shows up. Its a very simple program to. It just puts text on the screen. The compiler works correctly though because i got a sdl test compiled and it ran ok.
 
Also i'd like to mention i tried the precompiled parallax demo and that did not work on my gp2x either. Is there something wrong with my gp2x. How do i get allegro to work.
 
Hi,

jkgp2x posted on Apr 24 2006 at 03:56 PM said:
Also i'd like to mention i tried the precompiled parallax demo and that did not work on my gp2x either. Is there something wrong with my gp2x. How do i get allegro to work.
I don't think the parallax test binary ever worked for me either, so you're probably not alone there. I'll have to check it out again now that I'm more used to the GP2X.

I copied over the current DevKitGP2X toolchain to get the allegro libs, and compiled the example "exhello.c" from the Allegro 4.2.0 distribution without any problems (other than that I had to ctrl-C to get it to quit).

Any chance of you posting your program up here so I can try compiling it on my machine?

For what it's worth, I'm using Code::Blocks Studio as my IDE. I've tried DevCPP before, but never felt comfortable with it.
 
Last edited by a moderator:
i thought i would try to compile the exhello program as well so we are using the same code. It compiles but then when i run it on my gp2x i get that black screen again. I obviously have no idea what im doing. I tried on devcpp and codeblocks and get the same results. What are you linking to your program because all i add is -static -lalleg -lpthread.

I really want this to work and its really frustrating me. Do i need to add more linkers or does my gp2x need anything to be on it.
 
Hi,
jkgp2x posted on Apr 26 2006 at 09:48 PM said:
i thought i would try to compile the exhello program as well so we are using the same code. It compiles but then when i run it on my gp2x i get that black screen again. I obviously have no idea what im doing. I tried on devcpp and codeblocks and get the same results. What are you linking to your program because all i add is -static -lalleg -lpthread.

I really want this to work and its really frustrating me. Do i need to add more linkers or does my gp2x need anything to be on it.
Well, sorry to say, but I can't add anything more for the moment. I was originally using dynamic linking, but I did a static link just to make sure, and I get a white screen with "Hello, world!" in the middle. I'm using the same linker options as you. The only thing I can suggest you do now is get a serial connection working and install gdb (there is a version on archive.gp2x.de) so you can step through the program on the GP2X.

Alternatively, you could build your binary with debugging symbols enabled and put it on a web site somewhere (with the .c source, just in case our versions are not identical) for us to download and load into gdb ourselves, if you're having issues going that route? If you don't have a web-page, you could try signing up at pages.google.com and you'll probably get some web-space within a week. If none of those sound feasible, PM me and I'll give you my email address to send stuff to...

I can well believe this is driving you nuts at the moment. If it's any help, my current setup is as follows:
  • I use theoddbots' firmware setup with the USB serial gadget enabled, so that I can have a terminal session connected to the PC.
  • I have my post-build command set to archive the program, e.g. "tar zcf exhello.tgz exhello.c exchello.gpe"
  • Once I get a successful build, I use Kermit (could never get X/Y/Zmodem to work) to transfer the .tgz file to the GP2X,
  • When the file is transferred, I do a "tar zxf exhello.tgz" to unpack the archive.
  • Try running the program, and if it doesn't work, then I use gdb to start debugging it right there on the GP2X.
I'll admit, for large binaries it can take a while to transfer, as the USB-serial interface seems to max out at about 5K/sec, but I'd prefer this way than causing wear on the card slot, and it does at least give you thinking time after a build without having to fiddle around with cards and card writers, and wondering whether Windows will unmount the SD card properly...

At the moment I'm also trying to figure out if I can connect a serial connector onto the GP2X TV-out connector, as the TV-out plug housing is only screwed shut, and I have an old phone unlocking cable that is a good candidate for connecting into it. This should give a faster serial transfer rate and make it somewhat painless.
 
Last edited by a moderator:
Sorry, I forgot to mention, if you have a serial connection, it makes it a lot easier to see system error messages (e.g. you might be missing a library or something like that), but most importantly it means you can put debug messages around your code to keep track of where things are without having to be in gdb.

Also, if you're using tar to compress the stuff before transferring it, it might be easier to name your GP2X target with a .exe extension, and that way tar will automatically set the execute bit on it, otherwise you will have to do this on the GP2X side when it's unpacked (although I usually have a small shell script which starts listening for the transfer and unpacks and does the 'chmod' itself).
 
Hi,

Did anyone ever figure out how to configure allegro yet? I, too, get the blank screen freeze, and this is when following the directions on gfoot's website to the letter...
 
el_pango posted on May 31 2006 at 09:34 PM said:
Hi,

Did anyone ever figure out how to configure allegro yet? I, too, get the blank screen freeze, and this is when following the directions on gfoot's website to the letter...

I got some Allegro stuff to run no problem, but now for some reason I can't get anything Allegro to run. I get the black screen. What's weird is that Allegro IS running (a telnet session shows that Allegro did initialize and quit on Ctrl-C) but not displaying anything it seems.
 
Last edited by a moderator:
Alright, I got it to work in Dev-C++.

I followed the guide to getting devkitGP2X installed and working, then I installed Dev-C++. Followed the guide on the GP2X Wiki to configure it.

When you start a new project, make sure Dev-C++ is using the GP2X compiling settings. My linker options look like this:

C:/Dev-Cpp/lib/liballeg.a
-lpthread
-static

I also have compiler options, which look like this:

-O2 -Wall -Werror -g `gp2x-allegro-config --cflags debug`

Compiled stuff using Dev-C++ and it works! :D
 
There's some issue with the way I used the hardware blitter - it works on some GP2Xs (including mine) but not on others (black screen, it hangs while doing the initial clear(screen) after setting the graphics mode). As it works fine for me, there's not a lot I could do about it... sorry. The code was heavily based on paeryn's SDL code, but maybe it does something different somewhere.
 
Alright, I got it to work in Dev-C++.

I followed the guide to getting devkitGP2X installed and working, then I installed Dev-C++. Followed the guide on the GP2X Wiki to configure it.

When you start a new project, make sure Dev-C++ is using the GP2X compiling settings. My linker options look like this:

C:/Dev-Cpp/lib/liballeg.a
-lpthread
-static

I also have compiler options, which look like this:

-O2 -Wall -Werror -g `gp2x-allegro-config --cflags debug`

Compiled stuff using Dev-C++ and it works! :D

what version of Dev-Cpp are you using...the normal windows version, or the one that comes with the GP2X SDK made just for the gp2x.


I went to Project->Project options ->parameters tab and in the linker I put:
Code:
C:/Dev-Cpp/lib/liballeg.a
-lpthread
-static

After that, I went to tools -> compilier options and in the box that says "add the following commands when calling the compilier" I inserted
Code:
 -O2 -Wall -Werror -g `gp2x-allegro-config --cflags debug`

After doing that, I try to compile and I get this error:

C:\GP2XSDK\demo\g++ `gp2x-allegro-config: No such file or directory.
cc1plus C:\GP2XSDK\demo\cc1plus unrecognized command line option "-fcflags`"
C:\GP2XSDK\demo\Makefile.gp2x [Build Error] [gp2x/exhello.o] Error 1

any ideas what i did wrong? Should I just use the normal version of Dev-cpp and try this again?
 
Last edited by a moderator:
There's some issue with the way I used the hardware blitter - it works on some GP2Xs (including mine) but not on others (black screen, it hangs while doing the initial clear(screen) after setting the graphics mode). As it works fine for me, there's not a lot I could do about it... sorry. The code was heavily based on paeryn's SDL code, but maybe it does something different somewhere.

Actually, I just upgraded to firmware 2.0 and now I get the black screen too. I'm really busy these days (haven't touched the gp2x since January) but I might try to fix it sometime.
 
Last edited by a moderator:
Slightly off topic, but since someone mentioned a serial connection... I have been using usbnet to telnet into the machine. Is there any way to forward what would be the serial console output to a telnet session so i can see it as it arrives?
 
jaesond said:
Alright, I got it to work in Dev-C++.

I followed the guide to getting devkitGP2X installed and working, then I installed Dev-C++. Followed the guide on the GP2X Wiki to configure it.

When you start a new project, make sure Dev-C++ is using the GP2X compiling settings. My linker options look like this:

C:/Dev-Cpp/lib/liballeg.a
-lpthread
-static

I also have compiler options, which look like this:

-O2 -Wall -Werror -g `gp2x-allegro-config --cflags debug`

Compiled stuff using Dev-C++ and it works! :D
I hate to bump up this ancient topic, but I'm trying to get the SDK working with allegro, and am using this for my paramters, and whenever I compile I get the error: allegro.h: No such file or directory. Any idea what I'm doing wrong?

EDIT: Okay, now I feel really bad for bumping this ancient topic up,
http://www.gp32x.de/board/index.php?showt...&hl=allegro
I followed the last post there closely, realized he confused compiler and linker, and was able to sort things out. A tear came to this midnight weary eye as I saw hello world flash on the screen :) Now to run into more problems trying to port my game over...
 
Last edited by a moderator:
Great to bump an allegro thread :) It's an underused lib I reckon on the gp2x.

I've just installed open2x toolchain and am trying to get a simple allegro prog to work - actually not that simple as it uses loadpng, jpgalleg & glyphkeeper libs as well, so a good starting point for me..

Problem atm is I just get a black screen - that's all - will investigate whether it's me (very likely) or this iffy hardware blitter access (ie do a dummy blit first); a few fprintf(stderr)s will help :)

Hopefully will sort it out tomorrow - only time i get to do this is at work(!).

Anyway good to see others using allegro!
 
kevcal said:
Great to bump an allegro thread :) It's an underused lib I reckon on the gp2x.

I've just installed open2x toolchain and am trying to get a simple allegro prog to work - actually not that simple as it uses loadpng, jpgalleg & glyphkeeper libs as well, so a good starting point for me..

Problem atm is I just get a black screen - that's all - will investigate whether it's me (very likely) or this iffy hardware blitter access (ie do a dummy blit first); a few fprintf(stderr)s will help :)

Hopefully will sort it out tomorrow - only time i get to do this is at work(!).

Anyway good to see others using allegro!
Yes it's an underused lib ... but perhaps because lot of dev have only a black screen :blink:
 
Last edited by a moderator:
kevcal said:
Great to bump an allegro thread :) It's an underused lib I reckon on the gp2x.

I've just installed open2x toolchain and am trying to get a simple allegro prog to work - actually not that simple as it uses loadpng, jpgalleg & glyphkeeper libs as well, so a good starting point for me..

Problem atm is I just get a black screen - that's all - will investigate whether it's me (very likely) or this iffy hardware blitter access (ie do a dummy blit first); a few fprintf(stderr)s will help :)

Hopefully will sort it out tomorrow - only time i get to do this is at work(!).

Anyway good to see others using allegro!
If you've got a MKII it's probably this
 
Last edited by a moderator:
JyCet said:
Yes it's an underused lib ... but perhaps because lot of dev have only a black screen :blink:
Shame that (probably a simple fix) would make it more usable.. :(

Parkydr said:
kevcal said:
Great to bump an allegro thread :) It's an underused lib I reckon on the gp2x.

I've just installed open2x toolchain and am trying to get a simple allegro prog to work - actually not that simple as it uses loadpng, jpgalleg & glyphkeeper libs as well, so a good starting point for me..

Problem atm is I just get a black screen - that's all - will investigate whether it's me (very likely) or this iffy hardware blitter access (ie do a dummy blit first); a few fprintf(stderr)s will help :)

Hopefully will sort it out tomorrow - only time i get to do this is at work(!).

Anyway good to see others using allegro!
If you've got a MKII it's probably thisYeah that's my guess.. will see today/tonight I guess.
Meant to bring the gp2x to work so I could mess around with it lunchtime.

If this is the problem, would there be any point in updating Allegro..?
However I don't know if gfoot is still around.
I'd like to know why this is a problem; I guess SDL doesn't have the same issue (or does that not wait for 'blitter ready' flag?).

EDIT:
For info - in order to get that dummy blit code to compile I had to add:
CODE
#include <xalleg.h> // for MEMORY_MAPPED
#include <sys/mman.h> // for PROT_READ, etc


Note I'm working a bit blind here without the hardware to hand.
 
Last edited by a moderator:
Okay, findings are that the dummy_blit() call I've added isn't 'always' needed..! But it's better to leave it in..
It's all working now - some flicker, so I'm not sure about the way my setting up screen res - I couldn't allocate two video bitmaps (320x240) until I allocated a virtual horiz res of 1024 (320 vertical)..
Will need more time to check this - I find every bit of hardware has strange behaviour with respect to video/system bitmaps.
Anyway, it's working with glyphkeeper and hopefully the other libs (haven't tested all yet).

Anyone got any ideas on the best method of screen double-buffering on the gp2x??? gfoot's demo (parallax.gpe) flickers badly so I don't think that's worth looking at :(

So anyway a fair success really :)

EDIT:
Mmm... just looked at original bunkermaster code - that just uses a backbuffer and blits it to 'screen'.. has this been changed for the gp2x?
Is that the best way, thought I would use 2 video bitmaps and swap/flip between them - [ show_video_bitmap() ] - saves a major blit.....

EDIT2:
Been playing with flipping video bitmaps.. very flickery - and minimal improvement over blitting to 'screen'..
Addresses of bitmaps:

[root@gp2x test]$./conf.gpe 2
num_pages=2
PAGE FLIPPING - 2x VIDEO BITMAPS
bmp[0]=0025c200
bmp[1]=0025c608
screen=0025adb0

I get (blitting a background image and then shifting a few pixels around the screen) about 63 fps..
It's the flicker with flipping 2 video bitmaps I don't understand :(

Anyone??
Should I be investigating pulling in mmuhack this early on?
I take it the clockspeed is by default 200MHz as well..?
 
Can now build allegro myself (and have been looking through gfoot's port - looks good to me - actually simpler than I expected :) Obviously couldn't have done that myself though, wouldn't have know where to start!!

Anyway, a question.. does the parallax demo flicker for everyone?
I suspect a problem with page-flipping two video bitmaps.. as my code flickers as well.

I get (small test) - about 60+ fps doing show_video_bitmap() with two video bitmaps (effectively as the parallax demo uses them), or ~55 fps with one video bitmap and blitting to screen...

The second one is fine, but the first _shouldn't_ flicker... but does.
 
Back
Top