|
transition problem. Displaying 1-7 of 7 total.
1
jesusfreak
|
I am looking for a code that is like a Mosaic thing, that doies not have errors. Does anyone know of one??
| |- / | | / |- |\ |- /| |
| |- \ | | \ |- |/ |- /-\ |/
\| |- / |_| / | |\ |- / \ |\
Posted on 2001-01-11 18:23:16
|
TheGerf
|
Manually use SetPixel()'s! It only takes 76800. No, I'm serious...
TheGerf, not just any gerf.
Posted on 2001-01-12 01:09:38
|
Feyr
|
Here's a rough 'pixelate the screen' function. You'll almost certainly need to make some modifications, since I'm doing this off the top of my head, but it should give you some ideas:
void MyMosaic()
{
local int x, y; // vars to hold the current pixel
local int num_loops; // Number of loops before finishing
local int cur_color; // The color of the current pixel
for(num_loops=0;num_loops
Posted on 2001-01-12 09:44:32
|
Feyr
|
Ack, forgot about the greater than and less than signs screwing up the message. Here's the code again, using GT and LT for greater than or less than signs.
void MyMosaic()
{
local int x, y;
local int num_loops;
local int cur_color;
for(num_loops = 0; num_loops LT 10; num_loops++) // 10 is just an example
{
for(x = 1; x LT (screenx-1); x++) // Don't forget the -1
{
for(y = 1; y LT (screeny-1); y++)
{
cur_color = GetPixel(x,y);
SetPixel(x+(Random(3)-1), y+(Random(3)-1), cur_color);
SetPixel(x+(Random(3)-1), y+(Random(3)-1), cur_color);
SetPixel(x+(random(3)-1), y+(Random(3)-1), cur_color);
} // End y loop
} // End x loop
ShowPage();
} // End num_loops loop
} // End function
That's a pretty crude mosaic, and there's no telling how well it'll work in Verge. If you want to speed it up some, try replacing SetPixel(x+(Random(3)-1),y+(Random(3)-1),cur_color) with screen[(x+(Random(3)-1))+(y*screeny)] = color; It may or may not be quicker, depending on how Verge handles screen[]...
If you'd like to find a better effect, search for 'demo effects', 'demo algorithms' or something like that. A lot of the code used in the demo scene is in asm, which is fine if you can read it, but a lot harder to understand than C if you can't read it. If you look for algorithms though, you should find a few English descriptions of the techniques used to make various effects. Good luck.
--Feyr
Posted on 2001-01-12 09:58:22
|
jesusfreak
|
I used LT for less than. ok this is what I did, It works but it goes terribily slowly. It sets the pixels to three random colors at rendom places. The preoblem is is that it goes VERY slow! Can someone help!!
void MyMosaic()
{
int x, y;
int num_loops;
Render();
for(num_loops = 0; num_loops LT 10; num_loops++) // 10 is just an example
{
for(x = 1; x LT (screenx-1); x++) // Don't forget the -1
{
for(y = 1; y LT (screeny-1); y++)
{
ShowPage();
SetPixel(x+(x+5), y+(Random(10)), 120);
SetPixel(x+(Random(10)), y+(Random(10)), 12350);
SetPixel(x+(random(10)), y+(Random(10)), 5050);
} // End y loop
} // End x loop
} // End num_loops loop
} // End function
.|..|-../..|.|../..|-..|\..|-..../...|
.|..|-..\..|.|..\..|-..|/..|-.../-\..|/
\|..|-../..|_|../..|...|\..|-../...\.|\
Posted on 2001-01-13 16:54:54
|
Feyr
|
...of course it works slowly...you're redrawing the entire screen every time you check a new pixel. You should've kept the ShowPage() call outside of the two inner loops, as I posted earlier. If it is still too slow after making that modification, try replacing the SetPixel() calls with direct access to the screen[] array, also as I mentioned earlier.
--Feyr
Posted on 2001-01-13 22:30:30
|
jesusfreak
|
g to TvS and look at my post, it is fixed. ooks cool too!
.|..|-../..|.|../..|-..|\..|-..../...|
.|..|-..\..|.|..\..|-..|/..|-.../-\..|/
\|..|-../..|_|../..|...|\..|-../...\.|\
Posted on 2001-01-14 00:50:04
|
Displaying 1-7 of 7 total.
1
|
|