POV-Ray : Newsgroups : povray.binaries.images : Calculating water flow : Re: Calculating water flow Server Time
1 Aug 2024 10:17:21 EDT (-0400)
  Re: Calculating water flow  
From: stbenge
Date: 12 Dec 2008 22:01:09
Message: <49432575@news.povray.org>
Kirk Andrews wrote:
> To join in the discussion about programming languages, I will have to agree with
> clipka at this point--SDL is far to slow for this method.  It seems to me that
> these calculations ought to process fairly quickly, being little more
> complicated than Photoshop filters (which render within seconds, even on huge
> images). Right now, one erosion pass on a 2k x 2k hf takes about five minutes.

It really shouldn't be taking that long. What language are you 
programming with? Do you compile your code? How are you storing/testing 
the map entries?

There are two things I can think of which may be slowing your code down.

The first that you might be testing pixels instead of having a large 
array (int map[2000][2000];) of values. Obtaining values from arrays 
will always be faster than testing pixels.

Another reason for the slowdown is that you have a function like this:

void RenderGraphics(int bLogicUpdate)
{
  test_value(..);
  draw_pixel(..);
}

Some SDL setups have a function like this to place the drawing functions 
into. I have seen a *huge* speedup by doing this instead:

void RenderGraphics(int bLogicUpdate)
{
  for(int v=0;v<20000;v++)
  {
   test_value(..);
   draw_pixel(..);
  }
}

That way the program isn't flipping the video page every time you draw a 
pixel to it. I hope this helps.

By the way, it looks like your (POV) SDL version is coming along nicely :)

Sam


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.