Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Full screen effects

This thread is locked; no one can reply to it. rss feed Print
Full screen effects
Dave McEnery
Member #5,468
February 2005

Hi, I'm currently working on a 2d platform game with mouse aiming, in Contra style I guess. I'm doing the animation and characters with clay and my digicam and the backgrounds with digicam pics. It is going to be locked at 800x600x32. I was thinking about doing some fancy fullscreen effects, rippling for explosions and such. My question is, would applying effects to the entire screen be way too slow? My target system will probably be 1ghz+ machines and I'm developing on an athlon 64 at 4000+ speeds. Opinions?

Chris Katko
Member #1,881
January 2002
avatar

Quote:

My question is, would applying effects to the entire screen be way too slow?

Very much so, yes. If by "rippling" you mean bending everything. For that, I would strongly recommend using AllegroGL. If you were rendering on a texture, you could easily do a ripple effect by just splitting up the screen into multiple vertices and "bending" it.

Though, I really don't have the OpenGL experience to talk on the matter...

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

Steve Terry
Member #1,989
March 2002
avatar

First of all to do things quickly you should focus on learning how to manipulate bitmaps by direct memory access through line pointers rather than get/putpixel. Since your screen res and depth is known you can optimize your routines further. You can do some pretty quick stuff, but you should set it up as so:

1. Render everything with no effects to a backbuffer.
2. Apply effects from backbuffer to the screen(meaning use your backbuffer as a base that filters through your effect algorithm which "blits" the backbuffer to the screen). I guess what I'm getting at is limit the amount of operations needed and memory used for the effect :P I've seen some nice ripple effects done full screen at pretty decent speed in software so I wouldnt' be too worried.

Even though you are developing on high end machines you need testers to test your program to see where it begins to degrade performance on slower machines.

[edit]
Chris I think OpenGL would be overkill but it's doable as well.

I have a small program I wrote which uses sin/cos to render an image sorta rippled, but it's not the effect you are looking for. However it's important to know that instead of iterating through the pixels of the source and blitting them to the destination bitmap, you do the opposite, you iterate through the pixels of the destination and calculate which pixel from the source bitmap to place :)

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Dave McEnery
Member #5,468
February 2005

Hi!

Well, I have an amd k6-2 500 I can test it on too. I guess I don't actually need to apply the effects to the entire screen, just read parts of the buffer near the explosions and do some warping. This is actually my first real project, I've done lots of little demos and tests and such, but now I'm focusing on putting an actual game together. I found allegro in the book "Game Programming All In One" by Thomson Course Technology... its about 700 pages. It's taught me a good amount but it doesn't get more complex than a 4 screen platform scrolling game using Mappy, so I'm going to have to teach myself a lot. That's good though, I enjoy it. :) I used to program C and pascal when i was younger and I still know VB. I'm new to C++ but I understand program structure so I'm just learning the syntax.

I'm really surprised at the speed and quality of the repsonses here :o glad to see its very lively and I think I'll be hanging out here. Is there a popular allegro IRC channel?

Thanks!

Chris Katko
Member #1,881
January 2002
avatar

Quote:

2. Apply effects from backbuffer to the screen

It might be faster to do that to another memory buffer and just blitting to the screen in one linear block.

Quote:

Chris I think OpenGL would be overkill but it's doable as well.

Well, when I think ripple, I think the whole screen moving on the Z axis in a kind of puddle (of water) effect. So I figured OpenGL (in addition to its raw speed) would allow easy 3-D transformations.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

Steve Terry
Member #1,989
March 2002
avatar

freenode #allegro :) Yes allegro is very active actually...

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Matt Smith
Member #783
November 2000

"active" yes - "quality of responses" no

If we have anything REALLY worth saying we put it on the record here :)

Steve Terry
Member #1,989
March 2002
avatar

Well in Off Topic most of the responses are pure crap, no offense to anyone. But in the Programming topic there are usually pretty straight forward answers like RTFM, etc ;D

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Krzysztof Kluczek
Member #4,191
January 2004
avatar

Quote:

First of all to do things quickly you should focus on learning how to manipulate bitmaps by direct memory access through line pointers rather than get/putpixel.

Is there actually any reason to learn using this? Doing fullscreen effects in software seems to be a bit ancient technology now. We have GPUs, you know. ;) Apart from this, accessing image memory may be useful for advanced effects, but in most cases pure OpenGL is enough to do most things. :)

Sirocco
Member #88
April 2000
avatar

Quote:

Is there actually any reason to learn using this? Doing fullscreen effects in software seems to be a bit ancient technology now. We have GPUs, you know. ;) Apart from this, accessing image memory may be useful for advanced effects, but in most cases pure OpenGL is enough to do most things. :)

Knowledge is power.

-->
Graphic file formats used to fascinate me, but now I find them rather satanic.

Chris Katko
Member #1,881
January 2002
avatar

Quote:

But in the Programming topic there are usually pretty straight forward answers like RTFM,

I take slight offense to that. As far as I can remember, anyone who ever says "RTFM" is either joking, or puts a useful link in it.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

Steve Terry
Member #1,989
March 2002
avatar

Don't take offense... if you notice I used ;D

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Chris Katko
Member #1,881
January 2002
avatar

You can't just say "no offense" and say whatever you want. :P "No offense, but obviously, your mother liked to drop you."

p.s. I'm not saying that to you, I'm just making a point.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs

razor
Member #2,256
April 2002
avatar

Quote:

You can't just say "no offense" and say whatever you want.

Sure you can, especially with an added smiley.

Whoooo Oregon State University

Ron Ofir
Member #2,357
May 2002
avatar

You can say that only in a warm, tight and loving community like Allegro.cc :)

Go to: