|
![](/i/fill.gif) |
Christian Froeschlin wrote:
>> I found the Perl::GD module convenient for generating a height field.
>
> If you have a function to generate the height
> field, you can also use it in SDL directly:
>
> #declare npoints = 512;
> #declare f = function {0.1+0.1*sin(x*20)};
> #declare fmax = 0.2;
>
> height_field
> {
> function npoints, npoints {f(x,0,y)/fmax}
> }
Thanks!
A disadvantage of the Perl GD module is I can't figure out how to generate 16-bit PNG
with it, which is a real issue, even with "smooth". The advantage, of course, is you
needn't reevaluate the function each time the code is executed, depending on the
function complexity.
Dan
Post a reply to this message
|
![](/i/fill.gif) |