...the sound sample plays about 1/4 of the way through before the display is actually shown.

Like I said, this works perfectly in Windowed mode with no lag at all.

Is there something perhaps I could check to make sure the display is flipped first? This concerns me though for other parts of the game later on, running in fullscreen mode, will there be a lag after flips, of just the first one. I'm not sure what the problem could be, it's a pretty basic setup. I'm not doing anything fancy or even loading a lot.

Yeah, I run the program, initialize everything. I am very careful about the order I do things in. No bitmaps are set until long after the display is set up. I set VSYNC & FULLSCREEN from a config file (I got that from one of the examples on vsync I think it was). Once the display is set early in the program it isn't changed again. I tested it with vsync set at 0 (system driver), 1 (forced on) and 2 (forced off) and the problem is still there. But only in Fullscreen mode. I don't do anything fancy with other settings (like blenders and such) as I want to be sure the program is running smoothly with normal default settings first.

It's puzzling because I wouldn't think I would be able to hear my sound sample at all until the flip was done, but it plays halfway through before the screen appears.

I have 10gigs of system memory and an nVidia GT240 video card, so I am not lacking in memory. CPU is quad core 3Ghz too.

Like I said, window mode and fullscreen window works. I like fullscreen window, but then I would have to hack away at some code to make everything display properly when I should be able to simply call a normal fullscreen mode and let the users monitor handle how to do that.

If I have to I will, but it seems like odd behavior and would be nice to find out why it is doing that.

Below is my initialization function, I cut out most of it and just commented what is there, but all code I do have was tested and works fine, I always check return values no matter how remote the chance of failing as I like to be safe...

I like fullscreen window, but then I would have to hack away at some code to make everything display properly when I should be able to simply call a normal fullscreen mode and let the users monitor handle how to do that.

It's possible that you'd only have to set a transformation on the display to automatically scale up when using a fullscreen window.

Anyway, does the same behavior exist if you use the OpenGL driver instead of the default D3D one?

I just tried it with al_set_new_display_flags(ALLEGRO_FULLSCREEN|ALLEGRO_OPENGL); and there was less of a lag. It was almost right away, but not quite, still a small one, but much shorter lag.

I also tried it with lower resolution graphics (bitmaps are half the size) and lower quality sound (I changed the sound from a WAV to an OGG). They're MUCH smaller files to load etc... but there's no difference in lag.

It's possible that you'd only have to set a transformation on the display to automatically scale up when using a fullscreen window.

Also, I am not sure how to do this. I may fiddle around with ALLEGRO_FULLSCREEN_WINDOW and see if I can work something out with it, or just stick to opengl for now, at least until the next stable release comes out. I don't compile my own allegro anymore, all the dependencies seem to always give me problems. No big deal I guess, I'll be working on this project for a while anyhow.

I attached a log where I set the breakpoint in debug mode to immediately after al_flip_display();. I actually had to logoff my machine, couldn't break out of the program or even for it to shut down, sheesh Microsoft need to fix Task Manager!

For this demo, you should see a white box with a red outline and test.png (if exists) drawn at (0,0). Press space to toggle windowed mode; escape to exit.

Adjust BUFFER_WIDTH and BUFFER_HEIGHT to whatever you like. (It represents the native resolution of the game.)

If you look at the drawing in the main loop, you'll see it just draws using the native resolution, regardless of what the display's resolution is. The call to scale_screen() sets everything up so that it gets drawn stretched to the max with black bars in full screen mode.

I'm not sure if there is a better way, but this works, I am quite pleased, I didn't think I would be able to grasp how to do a transform.

I can plug this into any other program as it is quite portable, just set WIDTH and HEIGHT to the resolution you want. I think I should probably put some sort of checks in there but it's too late for me to think, my brain is already about to explode.

Your code is fine, but it only works if bars are on the left/right. That's the more usual case, but if you have a widescreen game and want to draw it on a 4:3 monitor, you'll need bars across the top and bottom.

The clipping rectangle is important because otherwise something may overlap into the black bar area that normally would be automatically clipped by the size of the monitor.

Your code is fine, but it only works if bars are on the left/right. That's the more usual case, but if you have a widescreen game and want to draw it on a 4:3 monitor, you'll need bars across the top and bottom.

Yeah, I noticed that about your code, part of why I liked yours better. I never thought of that and even though this game isn't widescreen, I would like to have that option for future games.

Quote:

The clipping rectangle is important because otherwise something may overlap into the black bar area that normally would be automatically clipped by the size of the monitor.

Yeah, good point. I seen your clipping rectangle code, I didn't know about that function. This is my first large A5 project. Another good reason to use your code.

Still, I am proud of the fact that I managed to figure out some solution on my own first. I was up until 2am working on this, brings back memories of when I used to program in the '90s with Allegro 2 until the wee hours of the morning. Been a while. I'm really liking Allegro 5 now though, took me a while to unlearn some A4 stuff.

I was just talking with my wife (probably boring her to death, ) about programming, part of the fun is in figuring out how to do it on your own first, at least for me. I don't think I have enjoyed myself so much as I did last night working on t his project. I'm rewriting my Deluxe Pacman game from scratch, creating a version 2. I have quite a few people around the world that like it, so I want to remake it using Allegro 5, adding in Low resolution and High resolution sounds and graphics as well so low end systems can run it. It's been fun. I actually was floored the other day when I got a donation for my old game for $100. Making a total donations for it at $175... lets see, after 13 years of work, that means I work for 13 bucks a year! LMAO Well, it's better than the 5 it used to be.

I took your function and made a header for it. I'll use it in future games. I have attached it in case anyone else wants to plug it into theirs. Did you program that function? I wanted to give proper credit in it but wasn't sure who to credit.

Anyhow, zip contains the .c and .h header. It would make a good example program (if it isn't already) and even tutorial.

it seems like programmers have gone from figuring things out from documentation to searching Google to just asking somebody for the code.

I've been sucking on the Google tit myself, it's easier to search Google than to CTRL-F some pdf and if I'm lucky, get one specific example that invariably differs from my problem. But usually my problem is so specific that a programming forum doesn't know the answer off the top of their head, so they have to Google or whatever themselves if they want to help.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”