Callipygous Posted October 16, 2004 Share Posted October 16, 2004 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 More sharing options...
5614 Posted October 16, 2004 Share Posted October 16, 2004 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 More sharing options...
Callipygous Posted October 16, 2004 Author Share Posted October 16, 2004 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. Link to comment Share on other sites More sharing options...
5614 Posted October 16, 2004 Share Posted October 16, 2004 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 More sharing options...
Callipygous Posted October 16, 2004 Author Share Posted October 16, 2004 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 More sharing options...
5614 Posted October 16, 2004 Share Posted October 16, 2004 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 More sharing options...
Callipygous Posted October 16, 2004 Author Share Posted October 16, 2004 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. Link to comment Share on other sites More sharing options...
pulkit Posted October 17, 2004 Share Posted October 17, 2004 Try a professional graphics library like LEDA or OpenGL, thats what I use currently. Link to comment Share on other sites More sharing options...
Callipygous Posted October 17, 2004 Author Share Posted October 17, 2004 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? Link to comment Share on other sites More sharing options...
SubJunk Posted October 17, 2004 Share Posted October 17, 2004 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 Link to comment Share on other sites More sharing options...
Callipygous Posted October 17, 2004 Author Share Posted October 17, 2004 how do i get winamp source? : P Link to comment Share on other sites More sharing options...
SubJunk Posted October 17, 2004 Share Posted October 17, 2004 I thought you might know that mate. It can obviously be done Link to comment Share on other sites More sharing options...
Callipygous Posted October 18, 2004 Author Share Posted October 18, 2004 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. Link to comment Share on other sites More sharing options...
pulkit Posted October 18, 2004 Share Posted October 18, 2004 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 More sharing options...
Dave Posted October 18, 2004 Share Posted October 18, 2004 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now