The code works on my test. How did you use the code? Try this:
glClearColor(0.0, 0.0, 0.0, 1.0); //Set black background
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity;
glBegin(GL_TRIANGLES);
glColor3f(1, 0, 0);
glVertex3f( 0.0, 1.0, 0.0);
glColor3f(0, 1, 0);
glVertex3f(-1.0,-1.0, 0.0);
glColor3f(0, 0, 1);
glVertex3f( 1.0,-1.0, 0.0);
glEnd;
BackplotControl.SwapBuffers;
1. Start a new project: Lazarus main menu > File > New > Application.
2. Add GL in the uses clause.
3. Drop a TOpenGLControl to the form and resize it properly.
4. On the Object Inspector of OpenGLControl1, double click OnPaint event.
5. Drop the code there, but
6. Rename BackplotControl > OpenGLControl1.
Note:
I'm not sure what the code in the constructor for, so I simply ignore it.
And this is the result: