Using display lists with Borland C++ Builder

For some reason I can’t get OpenGL display lists to work with my Borland C++ Builder 5 projects. I made a small test application just to illustrate the problem. It uses the OpenGLPanel component ( to do OpenGL drawing, but that’s not causing the problem, the same thing happens when drawing directly to the form.
Here’s how I set up my display list (in the form’s OnCreate event):

List = glGenLists(1);
glNewList(List, GL_COMPILE);

DrawScene() looks like this:

void __fastcall TForm1: rawScene()
glColor3f(1.0, 0.0, 0.0);
glVertex2f(-1.0, -1.0);
glVertex2f(0.0, 1.0);
glVertex2f(1.0, -1.0);

I render everything using this simple code:

void __fastcall TForm1::PanelPaint(TObject *Sender)



The problem is, nothing shows up on the form. It’s completely black. If I replace the glCallList call with DrawScene() it works fine, so there’s nothing wrong with the rendering code.
I have this same problem whenever I try to use display lists with BCB. What am I doing wrong? Any Borland gurus out there who could help me?

You must have a valid gl context before compiling your display list.

Thanks, that helped. Strange, though…I was almost sure I had tried placing that code in all possible locations.