![]() |
|
[OpenLayer] Drawing white instead of images |
GrantG
Member #8,173
December 2006
![]() |
I am working on a 2d tile map system and am having some problems when drawing the tiles. I am loading the tile sheet from an Allegro datafile and am splitting up the tiles within the program. The problem is all the tiles show up as white blocks. Here is the tile set loading function. I figured something must be wrong here.
|
CursedTyrant
Member #7,080
April 2006
![]() |
Here's what's wrong: OpenLayer's manual said: Bitmap(const Bitmap &other, const Rect &area ); //Construct a sub-bitmap of an area of the given Bitmap. Sub bitmaps usually require original Bitmaps to exist in memory (and your does not). Your bitmap does not exist outside of your loading function. Try this: Bitmap *tilesheet = new Bitmap((BITMAP *)tileData[1].dat); Don't forget to release and delete it when quitting. But, in case that doesn't work, a few things from the top of my mind:
--------- |
Fladimir da Gorf
Member #1,565
October 2001
![]() |
Does it work if you load the image directly from the image file? OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
OICW
Member #4,069
November 2003
![]() |
Maybe something went wrong with antialising? I remember that when I switched it off, it drawn only white rectancles instead of sprites - which was very weird. Also make sure that you have proper color depth. [My website][CppReference][Pixelate][Allegators worldwide][Who's online] |
GrantG
Member #8,173
December 2006
![]() |
Well I fixed it. I thought when making a sub-bitmap it actually copied the data over, I guess that wasn't the case. Also just doing that didn't work. I had to do. Since by images didn't have alpha channels, otherwise they were being drawn completely transparent.
|
|