I am writing a project using OpenGL but there is a problem. I succeeded to isolate the problem in the next program
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// This source represents the very strange bug on my machine
//
////////////////////////////////////////////////////////////////////////////////////////////////////
#include <GL/glut.h>
void init()
{
glClearColor( 0.0, 0.0, 0.0, 0.0 );
glColor3f( 1.0, 0.0, 0.0 );
}
void reshape( int w, int h )
{
glViewport( 0, 0, (GLsizei) w, (GLsizei) h );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluOrtho2D( 0.0, (GLdouble) w, 0.0, (GLdouble) h );
}
void display()
{
int i;
glClear( GL_COLOR_BUFFER_BIT );
glBegin( GL_POINTS );
for( i = 0; i < 300; i++ )
{
glVertex2i( (GLint) i, (GLint) i/2 );
}
glEnd();
glFlush();
}
int main( int argc, char* argv[] )
{
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB );
glutInitWindowPosition( 100, 100 );
glutInitWindowSize( 500, 500 );
glutCreateWindow( "Very strange Bug..." );
init();
glutDisplayFunc( display );
glutReshapeFunc( reshape );
glutMainLoop();
return 0;
}
This simple program just draws a line using GL_POINTS ( I must not use GL_LINES ). But as I said there is a problem. The line starts drawing well not from the beginning. To understand what I am talking about take a look on this screenshot
It is what appears on my machine after starting the program. On the left is the main window and on the right is a small part of it magnified.
I am very confused and do not understand what happens.
I use Linux but this program does not have any Linux specific stuff so it is not a problem. More interesting is that this program runs correctly on Slackware 11 with GeForce FX 5200 and on Slackware 11 with GeForce4, both with drivers installed from NVidia site. The machine I am right now and where the screenshot is from is Slackware 10.2 with some video from Intel, which is very old but I think that the problem is not in the video or drivers but somewhere else.