When I ran your code with perl 5.8, I got these warnings:
Using an array as a reference is deprecated at /tmp/3dgraphics.perl li +ne 989. Using an array as a reference is deprecated at /tmp/3dgraphics.perl li +ne 990. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1004. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1004. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1004. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1064. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1064. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1076. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1077. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1081. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1082. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1087. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1091. Using an array as a reference is deprecated at /tmp/3dgraphics.perl li +ne 1092. Using an array as a reference is deprecated at /tmp/3dgraphics.perl li +ne 1094. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1101. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1107. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1108. Using a hash as a reference is deprecated at /tmp/3dgraphics.perl line + 1108. Using an array as a reference is deprecated at /tmp/3dgraphics.perl li +ne 1127.
This stuff arises from lines like this (this is the code at line 1064):
@AET = sort{ %{$a}->{Xbot} <=> %{$b}->{Xbot} } @AET;
Sure enough, you're using the "%" sigil on a value that is supposed to be treated as a scalar.

You should try to adjust the lines involved to see if you can avoid those warnings -- then see if the code behaves the same way. (There's a chance that the values you are manipulating are not what you're expecting them to be.)

update: forgot to mention: just because you're using Tk doesn't mean you can't use the perl debugger. Run the script with "perl -d" and put breakpoints at some of those lines that are setting and testing Z-buffer values; when the code gets to one of those lines, look at the values being tested or assigned. (And figure out if it's just something simple, like adding when you should be subtracting, or whatever.)


In reply to Re: help with Z-buffer algorithm by graff
in thread help with Z-buffer algorithm by rbc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.