Jump to content

Recommended Posts

Posted

I have taken two, year long, highschool classes in programming, one was C++ at the basic level, the other was Java at the AP level. During my second year I wanted to make a program that just displays cool moving graphics things in lots of colors. Something similar can be seen in the "we'll be back soon" screen for That 70's Show, or as "plasma" (i think) in a package called "really slick screensavers".

 

The way I went about doing it was to make a bunch of randomly moving Bezier curves that were random colors(in c++). I was going to flood fill the space between them with their respective colors and use an algorithm to make it fade smoothly from one to the other. But i couldnt get my flood fill fast enough. I tried doing it pixel by pixel, both recursively and non, and I tried checking how much space between one edge and the next and doing a line instead of pixels. both were MUCH slower than I would need, so I was left wondering how they do things like video games, and if that's too complicated, I was wondering if there is a way to do what I was trying to do a bit faster than one frame every forty seconds or so. Is there some technique they use to do such things? I would think it would be a relatively simple matter to flood fill a blank area on a screen. After all, paint does it in about a half a second.

 

Any hints?

Posted
Any hints?

well yes, but you're not going to like it.... spend years becoming a games programmer and you'll find out!

 

well im not sure about programing it, but you could do this kinda of thing on an animation program (such as flash mx) which makes video files - or you could use a program which can produce .gif files, which can be animated and also used for background wallpapers and such - although they will slow down the computer.

Posted

pffft.

 

thanks for the info, but i really want to know if there is an efficient way to program it. also, it needs to be random, no go on the animated gif.

Posted

well there obviously is, think of the default windows screensavers where they just have random things changing colour, however i believe that the colour moves in sequence, although a random colour generator could somehow be made.

Posted
well there obviously is, think of the default windows screensavers where they just have random things changing colour, however i believe that the colour moves in sequence, although a random colour generator could somehow be made.

 

i can get the randomly moving things, i can make them random colors, i can make the colors randomly fade from one to the other. its the flood fill function im having trouble with. i cant make it fill a space in less than about 30 secs(depending on the size of the space obviously). keep in mind the space were talking about isnt square, doesnt have straight edges, and can be any size. how does paint do it so quickly?

Posted

paint is soo much simpler. in paint you are filling a limited space with a specified colour, there are obvious and fixed boudaries to the single specified colour the gap is being filled.... whereas for your thing, theres a random colour filling a randomly changing space with random colours, theres so much random and so little certain it takes longer to work out -- im guessing, i cant see any other reasoning for it anyway.

Posted

actually when its filling in the space nothing is moving and no colors are changing. it moves the curves, fills them in with that color, then moves and color shifts again. there are no changes taking place while its filling in the pixels.

Posted
Try a professional graphics library like LEDA or OpenGL, thats what I use currently.

 

ill give it a shot, but i really want to know how to do this stuff. how do you make a flood fill efficient enough to use for something like that?

Posted

Winamp has a function that allows you to create your own AVs, you might want to open the source to winamp and see how they do it :)

Posted
I thought you might know that mate. It can obviously be done

 

i have an ok understanding of many aspects of a computer, but not ones that would require me to be a "leet haxxor" sorry.

Posted
ill give it a shot, but i really want to know how to do this stuff. how do you make a flood fill efficient enough to use for something like that?

 

There could be some hi-concept algos to do it. These libraries generally contain super efficient implementations of stuff.

Posted

I guess for things like DirectX and OpenGL the most efficient bits of coding (like flood filling) are probably done using something like assembly or some extremely fast interpreted language. Same for things like memory allocation, etc.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.