Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I tried to create and translate a polygon in openGL, I create a function for translation but this create a white line from x0 to v_size and I don't understand why ?

This is my function for polygon translation

What I have tried:

public void translate1(GL2 gl, double x0, double x1, double y0, double y1){
    double step = 0.2;
    for(double i = 0; i < v_size; i += step){
        gl.glBegin(GL2.GL_POLYGON);

            gl.glVertex2d(x0 + i, y0);
            gl.glVertex2d(x0 + i, y1);
            gl.glVertex2d(x1 + i, y1);
            gl.glVertex2d(x1 + i, y0);

        gl.glEnd();
    }
}


Initial x0 = 0, x1 = 10, y0 = 20, y1 = 30.

Thanks!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900