|
Allegro Beginner questions |
the_cake
Member #15,594
May 2014
|
to pkrecl " Can you post a proof of what you are saying ? Of course not, mine was a speculation under the aforementioned logic. Sorry, I wanted a proof that we are not forced to lock/unlock each frames from polybios to beoran I don't want to be bad but you really don't help, plz stay outside of this thread , you are saying that the example provided by Edgar is helpful ? Just compare ! to Edgar Reynaldo -So what do I need to do to have a bitmap image RGB with 3 bytes per pixel ?, and I would like to have the bitmap in a set of columns, that is to say that each pixel of the bitmap is accesed with ptr[dim_bitmap_y*x+y]... -And do you know a method which is more rapid to not locking/unlocking each frames ? In fact it is also very important. You don't really understand that Allegro is slow. I let you remenber that Doom 2 was not supposed to be launched with 3 ghz processor at the time. Can you post a working complete example ? But I am also annoyed with that ****** mouse problem ! I saw the Allegro sources and the problem comes with that ClipCursor function : Maybe I should try a little longer that Allegro 5. |
Dizzy Egg
Member #10,824
March 2009
|
the_cake said: You don't really understand that Allegro is slow It's not, you are. Quote: Maybe I should try a little longer that Allegro 5 Don't feel that you have to.
---------------------------------------------------- |
the_cake
Member #15,594
May 2014
|
oh come on Dizzy egg, you are not helping ! Can you understand that ? |
Dizzy Egg
Member #10,824
March 2009
|
I'm just here for balance. You have a bunch of people trying to help you, but you don't want to accept that A5 is blisteringly fast (if you use it properly). This is great forum, full of helpful people....and me. And I say, get yourself a copy of GameMaker and do one, mug.
---------------------------------------------------- |
the_cake
Member #15,594
May 2014
|
I'm definitively off with that library, that al_ungrab_mouse doesn't work, there is plenty of other bugs, In fact instead of SDL, or assembly, I will try win32 programming. to Dizzy Egg " You want a medal ? I am your father. No seriously, I really do not think you should take it that way. Anyway, Have a lot of fun with allegro 5 ! |
pkrcel
Member #14,001
February 2012
|
I'd reply in full but I feel it would be wasted since I understand the_cake won't come over to see the replys.... the_cake said: Yeah, I am a simple studient with limited time and resources, I got my own problems, my parents, my studies, my duties, papers managing you know... ...anyway I feel compelled to say that for not having time to contribute you surely have a LOT of time to waste to look for the holy grail. And even if I blatantly have less understanding than you in these matters, I am fairly confident that YOU haven't fully understood what Edgar's example highlighted. I couldn't try myself Edgar's example, but I remeber my last usage of al_lock_bitmap and al_put_pixel to create a pixel perfect collision mask would exceed 200FPS performance on my laptop, althou it was on a smaller bitmap than your 320x240 (I think I tested on a 200x200 but can't be arsed to check), AND CPU usage was not even close to 100% for sure. I can't see on what basis you say that the Lib is not fast enuff for you and I strongly suspect that SDL itself was on par with these performances... By the way, I guess asking something to this guy can help in there regards. Farewell It is unlikely that Google shares your distaste for capitalism. - Derezo |
beoran
Member #12,636
March 2011
|
the_cake , It's rather rude of you to talk in such a way to people who are trying to help you. You want to dish out criticism but seem unwilling to listen to it. That's not a good attitude. Also I see you are French? Perhaps you should learn a bit better English. Don't rely on tools such as google translate too much, that will lead to misunderstandings. What exactly is the problem you are having with al_grab_mouse / al_ungrab_mouse? You keep complaining but it's not very clear what you want to achieve with it. Do you have some example code that demonstrates the problem. Finally, since I wanted to show allegro is fast enough for your purposes, I wrote a fully executable example (in attachment). Compile it with `gcc -g -L/usr/local/lib pixel.c -lallegro -lallegro_primitives -o pixel` (on Linux) It produces the following output for me`on an ultra cheap AMD laptop: So even with al_put_pixel it is already quite fast. You only need 60 fps anyway, so that means you have a lot of CPU time left. And with direct draws you can even double the speed. If you want to go faster on a contemporary system, then you should be doing the drawing using 3D models with OpenGL or DirectX, and not waste time on implementing your own software 3D engine. Even if you use the Win32 API, the performance will not be that much faster than if you use Allegro, or SDL , since both libraries, on windows are thin wraper around the Win32 / Directx or OpenGL library (depending on how you compile them). And by using Win32 api directly, you lose portablity of your program and miss out on many convenient features. |
pkrcel
Member #14,001
February 2012
|
While this is completely off topic, I'd point out that this thread pushed me to download wolfstein3D source code. I felt so nostalgic to see such old school C, but also I could say that JC wrote such way above-average code but that also made eyes bleed like almost everybody out there (except beoran of course, pixel.c is lovely ) There I found a useful doc also. It is unlikely that Google shares your distaste for capitalism. - Derezo |
Edgar Reynaldo
Major Reynaldo
May 2007
|
the_cake said: to Edgar Reynaldo -So what do I need to do to have a bitmap image RGB with 3 bytes per pixel ?, and I would like to have the bitmap in a set of columns, that is to say that each pixel of the bitmap is accesed with ptr[dim_bitmap_y*x+y]... -And do you know a method which is more rapid to not locking/unlocking each frames ? In fact it is also very important. You don't really understand that Allegro is slow. I let you remenber that Doom 2 was not supposed to be launched with 3 ghz processor at the time. Can you post a working complete example ? Look up the 24 bit pixel formats and al_set_new_display_options for details. It's in 5.1. You could probably get a speed up by making a batched draw call, where you collect all your geometry and use something like al_draw_indexed_prim. Alright I made a generic test program called BitmapLocking.exe. Here are my results for a 320 X 200 window in Direct3D and OpenGL modes : c:\ctwoplus\progcode\allegro5\test>BitmapLocking.exe 320 200 opengl 1000 Starting BitmapLocking in 320 X 200 windowed opengl with numframes = 1000 Pixel format of screen : 9 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 12.163923 FPS : 82.210321 c:\ctwoplus\progcode\allegro5\test>BitmapLocking.exe 320 200 1000 Starting BitmapLocking in 320 X 200 windowed default with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 1.051323 FPS : 951.182459
Direct3D 320 X 200 Window 951FPS Here are my results for 1280 X 800 Fullscreen with Direct3D and OpenGL : c:\ctwoplus\progcode\allegro5\test>BitmapLocking.exe 1280 800 fullscreen Starting BitmapLocking in 1280 X 800 fullscreen default with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 11.102412 FPS : 90.070521 c:\ctwoplus\progcode\allegro5\test>BitmapLocking.exe 1280 800 fullscreen opengl Starting BitmapLocking in 1280 X 800 fullscreen opengl with numframes = 1000 Pixel format of screen : 9 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 163.307744 FPS : 6.123408 c:\ctwoplus\progcode\allegro5\test>
Direct3D 1280X800 Fullscreen 90FPS So there are some major issues with the OpenGL implementation. It is several factors slower than Direct3D when it comes to locking and uploading bitmaps. Try the program yourself : 1
2#include <stdio.h>
3#include <stdlib.h>
4#include <string.h>
5#include <allegro5/allegro.h>
6
7
8int SCREEN_WIDTH = 800;
9int SCREEN_HEIGHT = 600;
10bool fullscreen = false;
11bool opengl = false;
12int numframes = 1000;
13
14int main(int argc, char **argv)
15{
16 ALLEGRO_DISPLAY *display = NULL;
17
18 if (argc == 1 || argc == 3 || argc == 4 || argc == 5 || argc == 6) {
19 if (argc == 3 || argc == 4 || argc == 5 || argc == 6) {
20 SCREEN_WIDTH = atoi(argv[1]);
21 SCREEN_HEIGHT = atoi(argv[2]);
22 }
23 if (argc == 4 || argc == 5 || argc == 6) {
24 fullscreen = (strcmp("fullscreen" , argv[3]) == 0);
25 if (strcmp("fullscreen" , argv[3] ) == 0) {
26 fullscreen = true;
27 }
28 if (strcmp("opengl" , argv[3]) == 0) {
29 opengl = true;
30 }
31 if (atoi(argv[3]) != 0) {
32 numframes = atoi(argv[3]);
33 }
34 if (argc == 5) {
35 if (strcmp("fullscreen" , argv[4] ) == 0) {
36 fullscreen = true;
37 }
38 if (strcmp("opengl" , argv[4]) == 0) {
39 opengl = true;
40 }
41 if (atoi(argv[4]) != 0) {
42 numframes = atoi(argv[4]);
43 }
44 }
45 if (argc == 6) {
46 numframes = atoi(argv[5]);
47 }
48 }
49 }
50 else {
51 printf("Usage : BitmapLocking.exe WIDTH HEIGHT [fullscreen] [opengl] [#frames]\n");
52 }
53
54 printf("Starting BitmapLocking in %d X %d %s %s with numframes = %d\n" , SCREEN_WIDTH , SCREEN_HEIGHT ,
55 fullscreen?"fullscreen":"windowed" , opengl?"opengl":"default" , numframes);
56
57 if(!al_init())
58 {
59 fprintf(stderr, "failed to initialize allegro!\n");
60 return -1;
61 }
62
63 al_install_keyboard();
64
65 //al_set_new_display_flags(ALLEGRO_FULLSCREEN);
66 al_set_new_display_option(ALLEGRO_COLOR_SIZE , 32 , ALLEGRO_REQUIRE);
67 if (fullscreen) {
68 if (opengl) {
69 al_set_new_display_flags(ALLEGRO_FULLSCREEN | ALLEGRO_OPENGL);
70 }
71 else {
72 al_set_new_display_flags(ALLEGRO_FULLSCREEN);
73 }
74 }
75 else {
76 if (opengl) {
77 al_set_new_display_flags(ALLEGRO_WINDOWED | ALLEGRO_OPENGL);
78 }
79 else {
80 al_set_new_display_flags(ALLEGRO_WINDOWED);
81 }
82 }
83
84 display = al_create_display(SCREEN_WIDTH , SCREEN_HEIGHT);
85 if(!display)
86 {
87 fprintf(stderr, "failed to create display!\n");
88 return -1;
89 }
90
91 ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue();
92 al_register_event_source(queue , al_get_display_event_source(display));
93 al_register_event_source(queue , al_get_keyboard_event_source());
94
95
96
97
98 ALLEGRO_BITMAP* screen = NULL;
99
100 double start_time = al_get_time();
101
102 printf("Pixel format of screen : %d\n" , al_get_bitmap_format(al_get_backbuffer(display)));
103 printf("ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : %d\n" , ALLEGRO_PIXEL_FORMAT_ARGB_8888);
104 printf("ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : %d\n" , ALLEGRO_PIXEL_FORMAT_RGBA_8888);
105 printf("ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : %d\n" , ALLEGRO_PIXEL_FORMAT_ABGR_8888);
106 printf("ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : %d\n" , ALLEGRO_PIXEL_FORMAT_XBGR_8888);
107 printf("ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : %d\n" , ALLEGRO_PIXEL_FORMAT_RGBX_8888);
108 printf("ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : %d\n" , ALLEGRO_PIXEL_FORMAT_XRGB_8888);
109
110 bool quit = false;
111
112 int n = 0;
113
114 do {
115 screen = al_get_backbuffer(display);
116 ALLEGRO_LOCKED_REGION* lr = al_lock_bitmap(screen , al_get_bitmap_format(screen) , ALLEGRO_LOCK_WRITEONLY);
117 for (int nlines = 0 ; nlines < SCREEN_HEIGHT ; ++nlines) {
118 unsigned int* dat = (unsigned int*)((unsigned char*)lr->data + lr->pitch*nlines);
119 for (int pixel = 0 ; pixel < SCREEN_WIDTH ; ++pixel) {
120 int r = (nlines%256)*256;
121 int g = (n%256)*65536;
122 int b = (pixel%256);
123 dat[pixel] = r + g + b;
124 }
125 }
126 al_unlock_bitmap(screen);
127 al_flip_display();
128// printf("n = %d\n" , n);
129 ++n;
130
131 do {
132 ALLEGRO_EVENT ev;
133 if (n >= numframes) {quit = true;}
134 if (al_get_next_event(queue , &ev)) {
135 if (ev.type == ALLEGRO_EVENT_KEY_DOWN && ev.keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
136 quit = true;
137 }
138 else if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {quit = true;}
139
140 }
141 else {
142 break;
143 }
144 } while (1);
145 } while (!quit);
146
147 double total_time = al_get_time() - start_time;
148 printf("Total time taken : %f\n" , total_time);
149 printf("FPS : %f\n" , n/total_time);
150
151 return 0;
152}
BitmapLocking.7z Binaries + dlls + source Run from command line : Usage : BitmapLocking.exe WIDTH HEIGHT [fullscreen] [opengl] [#frames] c:> Direct3D should be more than fast enough for you. OpenGL seems to need some work though. {"name":"608564","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/7\/9711a31e166b4088f77e46336e5cb0ba.png","w":1280,"h":800,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/7\/9711a31e166b4088f77e46336e5cb0ba"} My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
AMCerasoli
Member #11,955
May 2010
|
A side not: Edgar, you don't need OpenAL on Windows. Your test program is missing that .dll.
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
That's a dependency of the monolith I linked to. I'll upload it in a while. Edit - here's the updated 7zip of the binary and source and dlls
Edgar Reynaldo said:
Direct3D 320 X 200 Window 951FPS Direct3D 800X600 Fullscreen 192FPS Direct3D 1280X800 Fullscreen 90FPS c:\ctwoplus\progcode\allegro5\test\BitmapLocking> Anybody have any idea why bitmap locking is so unbearably slow with OpenGL? Or is it just my crappy laptop with OpenGL 2 again... (Note to self : I have to test this on my desktop.) Edit2 Tested on my desktop, and OpenGL is still noticeably slower : Quote:
800 X 600 Direct3D fullscreen 304.3FPS , 3.287 seconds for 1000 frames 800 X 600 Direct3D window 284.1FPS , 3.52 seconds for 1000 frames 1600 X 1200 Direct3D fullscreen 79.9FPS, 12.51 seconds for 1000 frames My desktop CPU is noticeably faster, but OpenGL still lags behind by a factor of 2 to 3, which is disappointing. Can other people test this, and see what results they get? The source should work as is with Linux and OSX, you just don't need to specify opengl on the command line. Usage : BitmapLocking.exe WIDTH HEIGHT [fullscreen] [opengl] [#frames]
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
AMCerasoli
Member #11,955
May 2010
|
I don't know, in my case it looks like something is blocking the framerate when the display is set on fullscreen, I have been messing with Vsync on my graphic card, might be related. Too many 60Hz over there. Starting BitmapLocking in 800 X 600 fullscreen default with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 16.515444 FPS : 60.549388 Starting BitmapLocking in 800 X 600 fullscreen opengl with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 17.812546 FPS : 56.140205 Starting BitmapLocking in 800 X 600 windowed default with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 3.498927 FPS : 285.801940 Starting BitmapLocking in 800 X 600 windowed opengl with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 16.663655 FPS : 60.010845 Starting BitmapLocking in 1600 X 1200 fullscreen default with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 16.609768 FPS : 60.205537 Starting BitmapLocking in 1600 X 1200 fullscreen opengl with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 16.815327 FPS : 59.469554 Yep confirmed, My graphic card was blocking the drawing operations. Aww I don't want to run the tests again.
|
GullRaDriel
Member #3,861
September 2003
|
Every problem I already have regarding OpenGL performance was a driver related one or a side effect of vsync and buffering. I even had to use an outdated version of nvidia laptop pilot due to the new one being crappy with opengl. Note that a lot of driver have vsync and triple buffering enable in opengl. "Code is like shit - it only smells if it is not yours" |
Neil Roy
Member #2,229
April 2002
|
I just tried your example on my system. It has a GeForce GTX650 which has OpenGl 4.4 and DirectX 11, latest drivers. With VSync on on my driver settings it got 52FPS with OpenGL, when I shut VSync off I got the following, much better rate. My monitor refresh is 60hz. D:\Downloads\Allegro\BitmapLocking>BitmapLocking.exe 1280 800 fullscreen opengl Starting BitmapLocking in 1280 X 800 fullscreen opengl with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 8.837769 FPS : 113.150733 Without OpenGL and no VSync: D:\Downloads\Allegro\BitmapLocking>BitmapLocking.exe 1280 800 fullscreen Starting BitmapLocking in 1280 X 800 fullscreen default with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 4.106563 FPS : 243.512620 Does seem too shabby. Edit: And just for fun, at 1920x1080 (no VSync) D:\Downloads\Allegro\BitmapLocking>BitmapLocking.exe 1920 1080 fullscreen opengl Starting BitmapLocking in 1920 X 1080 fullscreen opengl with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 20.649569 FPS : 48.427161 D:\Downloads\Allegro\BitmapLocking>BitmapLocking.exe 1920 1080 fullscreen Starting BitmapLocking in 1920 X 1080 fullscreen default with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 10.109041 FPS : 98.921349 Again, not too shabby. Finally, I tried 320x240, but as already mentioned, it is no longer supported in fullscren (in either DirectX or OpenGL) so I went to the next higher, 640x480 as was suggested and got these results (note: DirectX was so fast I didn't see it, I think I blinked and it was done! ) D:\Downloads\Allegro\BitmapLocking>BitmapLocking.exe 640 480 fullscreen opengl Starting BitmapLocking in 640 X 480 fullscreen opengl with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 4.968636 FPS : 201.262462 D:\Downloads\Allegro\BitmapLocking>BitmapLocking.exe 640 480 fullscreen Starting BitmapLocking in 640 X 480 fullscreen default with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 1.611690 FPS : 620.466638
--- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Well, that's still about a factor of 2, and a factor of 3 in your last test. If I can get a profiling build working then maybe I can see where all the time is being spent with the opengl driver. And I think it's actually CPU bound, except for the part where it uploads stuff to the gfx card. What kind of CPU were you using on that last test? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Thomas Fjellstrom
Member #476
June 2000
|
Maybe you should run with more frames. if it opens and closes that fast, its not much of a test. -- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
If OpenGL wasn't so slow I would, but I can use more frames with DirectX though. Really, 1000 frames is a decent sample size, but you're right some of the tests could use more. You can specify the number of frames as the last parameter in the command line arguments to the program. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Neil Roy
Member #2,229
April 2002
|
In all tests I have an "AMD Athlon II X3 440 CPU - 3GHz (3 cores)" A fairly inexpensive CPU (around $90 Canadian) when I bought it a few years ago. I also have 10Gigs of RAM(64bit system) if that effects anything at all. Edit: Okay, I ran the tests again with a sample size of 10000! CPU: AMD Athlon II X3 440 CPU - 3GHz (3 cores) D:\Downloads\Allegro\BitmapLocking>BitmapLocking.exe 640 480 fullscreen 10000 Starting BitmapLocking in 640 X 480 fullscreen default with numframes = 10000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 21.037207 FPS : 475.348283 D:\Downloads\Allegro\BitmapLocking>BitmapLocking.exe 640 480 fullscreen opengl 1 0000 Starting BitmapLocking in 640 X 480 fullscreen opengl with numframes = 10000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 57.823506 FPS : 172.940049
--- |
Thomas Fjellstrom
Member #476
June 2000
|
A driver update might help. OpenGL depends on the quality of the drivers for gpu pretty heavily. For a long time D3D was done better on windows because most games used it. But OpenGL is starting to gain more traction again due to ease of porting between OSX, mobile and windows (and a little linux, when the dev cares). -- |
Neil Roy
Member #2,229
April 2002
|
Oh, and because the original poster was insistent on 320x200... D:\Downloads\Allegro\BitmapLocking>BitmapLocking.exe 320 200 Starting BitmapLocking in 320 X 200 windowed default with numframes = 1000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 0.865257 FPS : 1155.725411 Could ONLY do it in a Window and any library that states they can do a proper 320x200 or 320x240 fullscreen is just plain lying to you. I would say 1155 FPS is pretty damn decent! --- |
GullRaDriel
Member #3,861
September 2003
|
I ran it on my lappy: core i7 2 Ghz, 6GBDDR3, ATI 7800 BitmapLocking tests said:
C:\Users\Gull\Downloads\BitmapLocking>BitmapLocking.exe 320 200 opengl 1000 C:\Users\Gull\Downloads\BitmapLocking>BitmapLocking.exe 320 200 1000 C:\Users\Gull\Downloads\BitmapLocking>BitmapLocking.exe 1280 800 fullscreen C:\Users\Gull\Downloads\BitmapLocking>BitmapLocking.exe 1280 800 fullscreen opengl
"Code is like shit - it only smells if it is not yours" |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Gully, since your processor is so fast, could you run the test with more frames? It's hard to tell if the results are useful or not. Just use like 10000 or something. That shouldn't take too long on your computer. For the 320 X 200 mode you could probably even use 50 or 100 thousand frames as well. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Neil Roy
Member #2,229
April 2002
|
Wow GullRaDriel, on an ATI your test done much better with OpenGL. I wonder if this is common for ATI cards, or just due to your CPU? --- |
LennyLen
Member #5,313
December 2004
|
I go the following results using 10000 frames (CPU: i7-3930K @ 3.2Ghz, GPU: GeForce 680): C:\Users\LennyLen\Desktop\bl>BitmapLocking.exe 320 200 10000 Starting BitmapLocking in 320 X 200 windowed default with numframes = 10000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 1.254570 FPS : 7970.855553 C:\Users\LennyLen\Desktop\bl>BitmapLocking.exe 320 200 opengl 10000 Starting BitmapLocking in 320 X 200 windowed opengl with numframes = 10000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 3.439915 FPS : 2907.048658 C:\Users\LennyLen\Desktop\bl>BitmapLocking.exe 1280 720 10000 Starting BitmapLocking in 1280 X 720 windowed default with numframes = 10000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 8.776642 FPS : 1139.387968 C:\Users\LennyLen\Desktop\bl>BitmapLocking.exe 1280 720 opengl 10000 Starting BitmapLocking in 1280 X 720 windowed opengl with numframes = 10000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23 Total time taken : 28.258398 FPS : 353.877101 The program doesn't work for me fullscreen. My monitors flash on and off and I get the following output (no results): C:\Users\LennyLen\Desktop\bl>BitmapLocking.exe 1280 720 10000 fullscreen Starting BitmapLocking in 1280 X 720 fullscreen default with numframes = 10000 Pixel format of screen : 23 ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit : 9 ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit : 10 ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit : 17 ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit : 18 ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit : 22 ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit : 23
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
LennyLen said: The program doesn't work for me fullscreen. My monitors flash on and off and I get the following output (no results): That's odd. Especially since it doesn't output the time and FPS - it should do that as long as a display is created, and I know it was because it prints off the pixel format of the screen. Do you normally have problems setting 1280 X 720 fullscreen with Allegro 5? I can't really explain that behavior. You must have one hell of a cpu and gpu given your high FPS in a 1280 x 720 window. I thank everyone for their help testing this, but I can't really do much unless I can get a profiling build working. And I haven't been able to find a profiler that works as expected on my Vista laptop. If anyone has any ideas, feel free to drop in on my other thread. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|
|