![]() |
|
Black screen |
Paul Hoey
Member #7,189
May 2006
|
Alright, I have code posted below which is currently supposed to be drawing an image to a buffer, then drawing the buffer to the screen. My problem is that the buffer only appears as black, any ideas? EDIT: Okay, it appears that everything drawn to the screen is appearing black, what could be causing this?
|
Mark Oates
Member #1,146
March 2001
![]() |
you don't need to set the color palette in 16b mode. Also, blit to the screen after you have drawn everything to the buffer. I'm not sure what's actually causing the problem though, you might want to try taking out acquire and release screen functions. AH! set the color depth AFTER allegro_init(); that would definately keep it from working like you want. -- |
A J
Member #3,025
December 2002
![]() |
load_bitmap does its own 'create' your create_bitmaps are causing memory leaks are the bitmaps your loading 32bit ? or 8 bit ? ___________________________ |
Paul Hoey
Member #7,189
May 2006
|
Mark: Noticed the drawing the buffer afterwards just after posting. I saved the buffer as a BMP after everything has been drawn and it's black too. The images are all 16-Bit. EDIT: Removing the aquire and release_screen methods didn't work, nor did changing where the set_color_depth method is called, and removing it entirely. A J: Didn't know aobut that, the tutorial I read said to do it that way, thanks for letting me know. |
Jonatan Hedborg
Member #4,886
July 2004
![]() |
See if you can draw primitives onto the screen. Seems like an odd problem anyway.
|
Paul Hoey
Member #7,189
May 2006
|
They're all entirely black. Primitives appear. |
ReyBrujo
Moderator
January 2001
![]() |
Are you loading correctly the images? Are they in the right format (8 or 16 bpp)? -- |
Paul Hoey
Member #7,189
May 2006
|
Yes, they're loading correctly and are all 16-Bit. |
ReyBrujo
Moderator
January 2001
![]() |
Don't call set_palette, because that is only useful on 8bpp. Also, in the for cycle you have the wrong variable order (i counts until SCREEN_H, thus it is y, and you are using it as x). I guess other Allegro demo/programs work correctly, right? Can you post the updated code again with all the fixes you have done? -- |
Paul Hoey
Member #7,189
May 2006
|
None of that sorted it. Updated code. If anyone wants to download the source along with the images and see if it works for thme, that'd be great.
|
Kitty Cat
Member #2,815
October 2002
![]() |
Don't do anything in acquire/release_screen pairs except draw to the screen. Never do anything involving timers or non-trivial code, including installing subsystems, as that's a sure fire way to cause a deadlock. While you have the screen acquired, you keep Allegro from processing timers, and thus you won't properly get input updates or anything. Also, you need to set the color depth before you set the video mode (you can't change color depths after you have already set the graphics mode, after all). -- |
A J
Member #3,025
December 2002
![]() |
what is a 16 bit image ? you need to save your BMP files as either 8 or 24, or 32bit. check the return values of all your load_bitmap calls ___________________________ |
miran
Member #2,407
June 2002
|
Does setting the colour depth before initializing Allegro even work? -- |
GullRaDriel
Member #3,861
September 2003
![]() |
Set the color depth before set_gfx_mode. //on windows it is faster if you aquire the screen before drawing to it acquire_screen(); This one isn't needed //you have to release the screen before calling any more functions release_screen(); This one no more. Please test that your bitmap are correctly loaded by adding if( !sky ) after the loading. "Code is like shit - it only smells if it is not yours" |
Paul Hoey
Member #7,189
May 2006
|
Thanks for all the feedback, it turns out it was because the iamges were 16-Bit Bitmaps, I converted them to 24-Bit and it's working fine now, thanks for letting me know. |
|