|
ALlegro Threads. |
undertzolkin
Member #15,247
August 2013
|
Hi, im new around here, so first of all HELLO Well, i've been using Threads lately, and right now i wanted to create a thread that diplays the FPS in-game. but im having some issues with the flip display. yes the thread runs, but the al_flip_display(); aint working properly, or so, not showing anything on screen. static void *thdFPS (ALLEGRO_THREAD *thr, void *param) float fFPSCounter = 0.0; al_start_timer(timer); in the image you can clearly see, that in debug, the flip_display have already been called, but itsnot applying, no error messega shown whatsoever... Any ideas?! thank you greatly . surri for vad ingrish! uuu btw, if i call the flip function in the main() function, it applies the flip without any problem. but... just once, and i dont want to use a while(). |
Elias
Member #358
May 2000
|
You have to use all graphics related functions in the same thread that calls all_create_display, basically. The only exception is if you use al_set_target_bitmap, but that won't work in your case because only one thread at a time can have the display target. So basically - do all drawing including the FPS counter from your main thread. -- |
undertzolkin
Member #15,247
August 2013
|
Hey! thanks for the Quick reply! So basically a few more questions had popped out. 1) whhats the difference between a windows thread, and a allegro thread? is the allegro thread mainly for graphical purposes? 2) if I make my allegro thread, I would need to run all graphical process from here? 3)if, what i said about allegro's thread only caring about graphical calls is correct. would making a windows thread, to call several graphical outputs be wrong? and vice versa. THANK YOU SO MUCH FOR YOUR TIME and ANSWER! |
Evert
Member #794
November 2000
|
undertzolkin said: 1) whhats the difference between a windows thread, and a allegro thread? is the allegro thread mainly for graphical purposes? Allegro's thread API is the same on all platforms. Windows threads only work on Windows. In fact, Allegro's thread API (probably) just calls the Windows thread API anyway. Quote: 2) if I make my allegro thread, I would need to run all graphical process from here?
No. You should do all your graphics operations from one thread (say, the main thread). The other threads can then do whatever they like. Quote: 3)if, what i said about allegro's thread only caring about graphical calls is correct. It's not. Quote: would making a windows thread, to call several graphical outputs be wrong? Yes. |
undertzolkin
Member #15,247
August 2013
|
Alright! thank you for your answers. and also thank you for taking your time, ill try different approaches n.n! and btw, im sorry posting this in the wrong section. I just noticed it right now u.u Thanks again |
|