GL Target Bitmaps Don't like Mipmap Flag But D3D is fine
jmasterx

There was a bug in my game since upgrading to I think 5.1.5 or 5.1.6

Any target bitmap I made, using GL, would render pure white.

In D3D all was fine.

I tracked it down to the fact that all my bitmaps are created with the mipmap flag on.

I turned it off and it fixed it.

Here is a minimum example of the problem:

#SelectExpand
1#include <allegro5/allegro.h> 2#include <allegro5/allegro_font.h> 3#include <allegro5/allegro_image.h> 4#include <allegro5/allegro_primitives.h> 5#include <stdio.h> 6#include <stdarg.h> 7#include <math.h> 8 9 10const int W = 300, H = 300; /* Size of target bitmap. */ 11const int RW = 50, RH = 50; /* Size of rectangle we draw to it. */ 12ALLEGRO_DISPLAY *display; 13ALLEGRO_BITMAP *target; /* The target bitmap. */ 14float x, y, dx, dy; /* Position and velocity of moving rectangle. */ 15double last_time; /* For controling speed. */ 16bool quit; /* Flag to record Esc key or X button. */ 17ALLEGRO_FONT *myfont; /* Our font. */ 18ALLEGRO_EVENT_QUEUE *queue; /* Our events queue. */ 19 20int main(void) 21{ 22 23al_init(); 24 al_init_primitives_addon(); 25 al_install_keyboard(); 26 al_init_image_addon(); 27 al_init_font_addon(); 28 al_set_new_display_flags(ALLEGRO_RESIZABLE | ALLEGRO_OPENGL); 29 al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP | ALLEGRO_MIPMAP); 30 display = al_create_display(640, 480); 31 32 33 queue = al_create_event_queue(); 34 al_register_event_source(queue, al_get_keyboard_event_source()); 35 al_register_event_source(queue, al_get_display_event_source(display)); 36 37target = al_create_bitmap(300,300); 38 39 while (!quit) { 40al_clear_to_color(al_map_rgb(0,0,0)); 41al_set_target_bitmap(target); 42al_draw_filled_circle(0,0,90,al_map_rgb(0,0,255)); 43al_set_target_bitmap(al_get_backbuffer(display)); 44al_draw_bitmap(target,0,0,0); 45al_flip_display(); 46 } 47 48 al_destroy_event_queue(queue); 49 50 return 0; 51}

I think this is a bug. Unless there is something I have overlooked in the changes.

Thanks

Thread #613196. Printed from Allegro.cc