Jump to content

C++ and graphics


Callipygous

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.