I am trying to get Open GL graphics to display in a TPaintBox object. I cannot get anything to display. I am new at this, and so if a TPaintBox component is not supposed to be used for this purpose, please let me know what kind of component I am supposed to use. I have posted my code below, which should draw a white rectangle on a blackbackground inside the picture box. Any suggestions would be greatly appreciated.
void __fastcall TMain_Form::PaintBox1Paint(TObject *Sender)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glOrtho(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);
glBegin(GL_POLYGON);
glVertex2f(0.25, 0.25);
glVertex2f(0.75, 0.25);
glVertex2f(0.75, 0.75);
glVertex2f(0.25, 0.75);
glEnd();
glFlush();
}
Thanks,
Christopher Messick