edgebuffer

Started by
1 comment, last by Zipster 23 years, 7 months ago
Sorry to bother you guys again..... but my Edge function (the one that fills the edgebuffer) doesnt work, and I cant see whats wrong with it. Please help, thanks in advance here it is:
    

void Edge(int leftedge[],int rightedge[],ePixel v1,ePixel v2)
{
        float deltax,deltay;
        float slope;
        float x;
        int y;
        ePixel temp;

        if(v1.y > v2.y) {temp = v1;v1=v2;v2=temp;}

        deltax = v2.x - v1.x;
        deltay = v2.y - v1.y;
        slope = deltax / deltay;

        x = v1.x;

        for(y = v1.y;y < v2.y;y++)
        {
                if(x <  leftedge[y]) 
                     leftedge[y] = (int)x;
                if(x > rightedge[y]) 
                     rightedge[y] = (int)x;
                x += slope;
        }
}

    
Advertisement
The problem is that ppl do not like debugging someone else''s code.

I always suggest this tip because I learned it in a simple QBASIC class in college around 2 years back.

1) Define what you are going to do..
2) Write down the logic for what you want the computer to do
YOURLOGICLOOP:
3) Break that down even further
4) Analyze logic by playing computer and writing down variables and the outcome on a piece of paper.
5 a) if error then grab an eraser and go back to step 2
5 b) if works jump to YOURLOGICLOOP until all variable limits are valid for the function you are writing
5 c) if error go to step 2 until eraser is gone or brain melts through ears
6) Start translating logic into actual code
7) Have a soda and relax


The nightmare travels across the cosmos with his burning mane. The trail of ash that is produced.

?Have a nice day!?

Maybe I''m missing something, but what exactly is this functions supposed to do? Maybe THEN I can help...

=======================================
A man with no head is still a man.
A head with no man is plain freaky.

This topic is closed to new replies.

Advertisement