Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411430 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 06:03:19 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Allegro Tearing
Pages: [1]
Print
Author Topic: Allegro Tearing  (Read 3392 times)
Massena
Level 4
****


Satisfied.


View Profile
« on: December 28, 2007, 05:40:54 PM »

Hello, I'm just starting to make a simple game in Allegro using c++ when, sadly, I encountered an early bump on the road. Page tearing.  Sad
Every 3 or so seconds the animation (a simple circle moving around) gets all choppy as if it skips some frames or the circle gets divided for a moment. I can't really explain, but it is annoying and I've tried a lot and didn't solve my problem.
I posted a topic which you can read at http://www.allegro.cc/forums/thread/594506/0 on allegro.cc and I didn't solve the tearing. I tried double buffering, higher resolution timers and vsync but ended up running out of ideas.
Any possible solutions? Something silly I am missing?
Thanks in advance!  Smiley

P.S.: You may notice my last reply at the allegro.cc post is quite dumb but I was getting frustrated and thought I could live with the tearing. I cannot, if I continue to experience this I'll just switch to SDL and pretend nothing ever happened.  Tongue
Logged

spellcaster
Level 0
**



View Profile
« Reply #1 on: December 29, 2007, 07:11:52 AM »

Create your buffers in vid mem, this should allow for real page flipping.
You could also choose to use AllegroGL (which is IMO now a part of the normal allegro package).

If you go for vid mem, make sure to reload the buffers on certain events (like alt-tabbing) since this may corrupt the vid mem.
There's agood example for vid buffers in the allegro doc, IIRC.
Logged
Massena
Level 4
****


Satisfied.


View Profile
« Reply #2 on: December 29, 2007, 11:26:27 AM »

You mean I should use create_video_bitmap? 'Cause I'm kinda lost on what you said  Tongue
Edit: I tried just to replace "buffer = create_bitmap (screen->w, screen->h);" with "buffer = create_video_bitmap (screen->w, screen->h);" and that was a complete failure :D Hope that was not what you meant!
« Last Edit: December 29, 2007, 11:43:19 AM by Massena » Logged

spellcaster
Level 0
**



View Profile
« Reply #3 on: December 29, 2007, 11:51:11 AM »

That's what I meant.
But it's not quite as easy as that Wink

The first buffer you create will point to the actual visible screen. So you'll need to create two buffers.

Take a look at the allegro docs for "show_video_bitmap", there's an example on how to use video bitmaps for page flipping.

Please note that show_video_bitmapwill work only in fullscreen mode. If your game will run both windowed and fullscreen, you should use a normal blit in windowed mode.
« Last Edit: December 29, 2007, 11:52:51 AM by spellcaster » Logged
Massena
Level 4
****


Satisfied.


View Profile
« Reply #4 on: December 29, 2007, 12:54:15 PM »

Oh! I tried page flipping, it gets all choppy in fullscreen, even the allegro example for page flipping doesn't work well! Maybe it has something to do with me using a mac.  Roll Eyes
Logged

Madgarden
Level 1
*


C=


View Profile
« Reply #5 on: December 29, 2007, 02:05:02 PM »

What's your framerate set to? If it matches your refresh rate, then you'll see some jittering as it won't be quite exactly in sync. Try a framerate of 50 or 100, double buffered.

Not sure anyone else mentioned this yet either, but triple buffering should give you the silky smooth scrolling of legend.
Logged
spellcaster
Level 0
**



View Profile
« Reply #6 on: December 29, 2007, 02:42:59 PM »

Not sure, how well coded the OSX port of allegro is.
IMO it might have some issues. Which would also explain why the page flipping doesn't work.

I'd say Madgardens triple buffer idea might be worth a try. On the other hand - if you have smooth updates, and the tearing is only from time to time, triple buffering might not really help that much Wink
Logged
Massena
Level 4
****


Satisfied.


View Profile
« Reply #7 on: December 30, 2007, 02:23:54 PM »

Meh, I give up.  Tongue Too much hassle, I'll just use SDL, I found a great tutorial and it seems easier, at least from the outside! Wink
Thanks anyway!
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic