1
\$\begingroup\$

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
enter image description here
The triangle at 0.3f, 0, 0
enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.