Advertisement

a couple ALLEGRO questions (palettes & bitmaps)

Started by September 24, 2002 02:04 PM
5 comments, last by Radagar 21 years, 11 months ago
Hello everyone! I have a couple newbie Allegro Questions.. First, a general question. Where can you find good sample source code using Allegro? on www.allegro.cc, there are many projects listed, but most don''t have source code available, and it''s hard to find one that has the function you are looking for. When you look into their manual, you can get the syntax for any command, but hardly any of them have EXAMPLES. Anyone have a good page for ALLEGRO help? My second question is on bitmap palettes. How do they work? If I use the Allegro routine load_bitmap() to load in a 256 color bitmap, the colors are always wrong. How do I extrapolate the palette from the bitmap and tell the program to use this? Also, is there a way to use a 24bit BMP in ALLEGRO? when I tried, the palette was worse than wrong, it was HORRIBLE. The picture was totally trashed =) Thanks for any help you can give! ~~~~~~~~~~~ Chris Vogel ~~~~~~~~~~~
WyrmSlayer RPG - In Early Development
a) you should sign up on allegro.cc and ask there. You''re guaranteed a helpful response.

b) I suspect you try to load an 8-bit bitmap on a, say, 16 or 32 bit screen. Set the screenmode BEFORE loading the bitmap, and Allegro will automatically convert it.

2DNow - Specializing in yesterday''s technology today!

Advertisement

First, make sure you set the screen color depth before setting the graphics mode, loading the datafile, and loading the image.

If you use 8-bit bitmaps in highcolor modes, you can do something like:

PALETTE pal;BITMAP *bmp;set_color_depth(32);set_gfx_mode(GFX_AUTODETECT, 640,480, 0,0);bmp = load_bitmap("8bit.bmp", pal);select_palette(pal);draw_sprite(screen, bmp, 0,0);unselect_palette(pal);destroy_bitmap(bmp); 


Using high color bitmaps on high color displays obviously requires no palettes at all. But once again, be sure to set the color depth before setting the graphics mode and loading the images.

However, it''s highly recommended to use source/destination bitmaps of the same color depth. (Or at least avoid using paletted bitmaps on high color displays.)

Regarding help, you''ll get all your allegro problems resolved very quickly on www.allegro.cc, and you may want to look up the Allegro Vivace tutorial. It''s a bit outdated, but it''s pretty solid.
Thanks to you both. I''ll start using the allegro.cc forums. After reading a few posts on there, I see that they do give GREAT help.

Thanks for the sample code konForce, I''m very new to graphics, so that helped.



~~~~~~~~~~~
Chris Vogel
~~~~~~~~~~~
WyrmSlayer RPG - In Early Development
Not everyone gets great help on allegro.cc Look what they did to this guy:

quote: Original post by Anonymous Poster
Not everyone gets great help on allegro.cc Look what they did to this guy:

http://www.allegro.cc/forums/view_thread.php?_id=207761&request=1032906315&


Yeah, I read that post. Same thing probably would of happened here though. He wasn''t very clear on what he was wanting, and I''m sure they see those posts all the time. Still, was a little rough..

Thanks for the reply though



~~~~~~~~~~~
Chris Vogel
~~~~~~~~~~~
WyrmSlayer RPG - In Early Development
Advertisement
It's a given that every month at least two or three people will post the same question: "Hello, I have never coded before, but I really have this great idea. All I need is three dedicated programmers to do all the work and give me all the credit. Surely you will all want to drop your current projects to help out a complete newbie who is basically just too lazy or untalented to do any of the work himself."

Then, the honest people resond with a very negative, realistic approach - basically telling the person do so some of the legwork himself, and come back when he has something to show. Ultimately the originator says "Oh well, away with you. You guys are selfish, and don't understand what an opportunity this is!".

It makes it even worse, when the originator is pretending to be starting up this commercial company - and doesn't even have a simple website to show.

This thread sums it pretty much up:

http://www.allegro.cc/forums/view_thread.php?_id=205233#post_205440

quote: Where on green earth do you think you're going to find a development team that talented and stupid at the same time?


[edited by - konForce on September 25, 2002 3:30:39 AM]

This topic is closed to new replies.

Advertisement