Simplest OpenGL program ever -- not working...

BlitzMax Forums/BlitzMax OpenGL Programming/Simplest OpenGL program ever -- not working...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm taking this code from GameDev.net so I don't understand why it's not working.

What should be happening is that OpenGL is initialized for 2D (orthographical projection) and a simple line is drawn. However, in this case the screen is being cleared properly (according to glClearColor) but my line is not being drawn.

Can somebody please, please help me?

Here is the code:
GLGraphics 320, 200

Enable2D()

glClearColor(0.0, 0.0, 0.0, 0.0)	

While Not KeyHit(KEY_ESCAPE)
  glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);

  glBegin(GL_LINE); 
    glVertex2i(0, 0) ; 
    glVertex2i(1, 1);
  glEnd();

  Flip()
Wend

Function Enable2D()
  
  Local vPort : Int[4]
  glGetIntegerv(GL_VIEWPORT, vPort);

  glMatrixMode(GL_PROJECTION) ; 
  glPushMatrix() ; 
  glLoadIdentity() ; 

  glOrtho(0, vPort[2], 0, vPort[3], -1, 1);

  glMatrixMode(GL_MODELVIEW) ;
  glPushMatrix() ; 
  glLoadIdentity();		
End Function

Function Disable2D()
	glMatrixMode(GL_PROJECTION) ; 
	glPopMatrix() ;
	glMatrixMode(GL_MODELVIEW) ; 
	glPopMatrix();	
End Function