0
\$\begingroup\$
#include stdlib.h>
#include GL/gl.h>
#include GL/glut.h>


GLfloat pointx = -1.0f;
GLfloat pointy = -1.0f;



void paint(void)
{
  glClearColor(0.3,0.3,0.3,0.0);
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

  glShadeModel(GL_SMOOTH);

  glLoadIdentity();
  glTranslatef(0.0f, 0.0f, 0.0f);




  for (int a = 0; a < 1000; a++)

    {

glBegin(GL_POINTS);

glVertex2f(pointx ,pointy);

glEnd();

pointx = pointx + 0.001f;
pointy = pointy + 0.001f;
    }







  glFlush();
}

void reshape(int width, int height)
{
  glViewport(0, 0, width, height);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(-30.0, 30.0, -30.0, 30.0, -30.0, 30.0);
  glMatrixMode(GL_MODELVIEW);
}

int main(int argc, char *argv[])
{
  glutInit(&argc, argv);
  glutInitWindowSize(640, 480);
  glutCreateWindow("Triangle");

  glutDisplayFunc(paint);
  glutReshapeFunc(reshape);

  glutMainLoop();

  return EXIT_SUCCESS;
}
\$\endgroup\$
  • 2
    \$\begingroup\$ Please don't just dump a swath of code on us. Walk us through the approach you're using, and show us what these weird scrolling of pixels looks like. This can help you get better answers, faster. \$\endgroup\$ – DMGregory May 20 at 0:06

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.