|
al_d3d_create_bitmap |
Paragon
Member #15,335
October 2013
|
I have been trying to make my rendering engine faster, and while i have had some success there is still something that bothers me. When I run a profiler on my code it turns out that a large percentage of the processing power goes towards calling al_d3d_create_bitmap. Considering that I don't start the profiler until after everything is initialized I can't figure out why this function is showing up at all. Relevent Code: Initialize 1al_init();
2al_init();
3al_install_keyboard();
4al_init_image_addon();
5
6
7al_set_new_display_option(ALLEGRO_RENDER_METHOD, 1, ALLEGRO_SUGGEST);
8al_set_new_display_option(ALLEGRO_VSYNC, 2, ALLEGRO_SUGGEST);
9al_set_new_display_option(ALLEGRO_CAN_DRAW_INTO_BITMAP, 1, ALLEGRO_SUGGEST);
10
11al_set_new_display_flags(ALLEGRO_DIRECT3D);
12ALLEGRO_DISPLAY* display = al_create_display(800,600);
13ALLEGRO_BITMAP* backBuffer = al_get_backbuffer(display);
14
15printf("RENDER METHOD: %i\n",al_get_display_option(display,ALLEGRO_RENDER_METHOD));
16printf("VSYNC: %i\n",al_get_display_option(display,ALLEGRO_VSYNC));
17printf("Can draw into bitmap: %i\n",al_get_display_option(display,ALLEGRO_CAN_DRAW_INTO_BITMAP));
18
19int bitmapFlags = al_get_bitmap_flags(backBuffer);
20if ((bitmapFlags&ALLEGRO_MEMORY_BITMAP)==ALLEGRO_MEMORY_BITMAP) printf("Memory Bitmap\n");
21if ((bitmapFlags&ALLEGRO_VIDEO_BITMAP)==ALLEGRO_VIDEO_BITMAP) printf("Video Bitmap\n");
22
23al_set_target_backbuffer(display);
Drawing: al_clear_to_color(bgClearClr); for(unsigned int i=0;i<renderList.size();i++) { al_draw_tinted_scaled_rotated_bitmap_region(renderList[i].SpriteSheet, renderList[i].SpriteBox.X1,renderList[i].SpriteBox.Y1,renderList[i].SpriteBox.W,renderList[i].SpriteBox.H, renderList[i].Tint, renderList[i].SpriteBox.X1+renderList[i].SpriteBox.W/2.0,renderList[i].SpriteBox.Y1+renderList[i].SpriteBox.H/2.0, renderList[i].DrawBox.X1,renderList[i].DrawBox.Y1, renderList[i].DrawBox.W/renderList[i].SpriteBox.W, renderList[i].DrawBox.H/renderList[i].SpriteBox.H, renderList[i].Rotation,0); } renderList.clear(); al_flip_display();
|
|