# C# OpenGL: How to translate a triangle

I am trying to translate/move a triangle 0.3 to the right. When I run the code below, it moves the triangle, but part of it is cut off, like it is in a set box (shown in images below).

Code to move and draw the triangle:

  Gl.glPushMatrix();
Gl.glColor3f(c.R, c.G, c.B);
Gl.glBegin(Gl.GL_TRIANGLES);
Gl.glVertex2f(0.5f+x, 1.0f+y);
Gl.glVertex2f(0.0f+x, 0.0f+y);
Gl.glVertex2f(1.0f+x, 0.0f+y);
Gl.glEnd();
Gl.glFlush();
Gl.glPopMatrix();


x is 0.3f, y is 0 I tried glTranslatef(), but that did the same thing.

The triangle at 0, 0, 0

The triangle at 0.3f, 0, 0

• Looks like it's being clipped by your viewport? – Vaillancourt Jul 8 at 2:15
• Can you show us the code where you configure your rendering viewport/display window? – DMGregory Jul 8 at 11:28