Getting opengl and glut to work with borland

I’m quite new to OpenGL, and I’m trying to learn it from OpenGl SuperBible, which means I use glut a lot. Now, to more easily use standard windows gui routines in combination with opengl graphics I would like to use Borland C++ Builder instead of Dev-C++.
The problem is, I don’t really know how to setup opengl in the bcb environment.
Could someone please describe how to do this (not just code, instructions too), or point me to a tutorial/example?

Start New Application.
include in the Unit1.h:
#include <GL/gl.h>
#include <GL/glu.h>
//------------------------------------------
The First Step - Defining:
-define in Your main class the next functions:
void __fastcall OnIdle(TObject*, bool &);

bool __fastcall glInit(HWND Window);
void __fastcall glSetPixelFormatDescriptor();
void __fastcall glSetView(int Width, int Height);
void __fastcall glDisplay(void);
and the privat variables:
HDC hDC;
HGLRC hRC;
GLfloat nRange;
//------------------------------------------
Second - Initializing:
//---------------------------------------------------------------------------
bool __fastcall TOpenGL::glInit(HWND Window)
{
hDC = GetDC(Window);

   if (hDC == NULL)
   {
          return false;
   }

   glSetPixelFormatDescriptor();

   hRC = wglCreateContext(hDC);
   if (hRC == NULL)
   {
          return false;
   }

   wglMakeCurrent(hDC, hRC);

   glEnable(GL_DEPTH_TEST);

   return true;

}
//---------------------------------------------------------------------------
void __fastcall TOpenGL::glSetPixelFormatDescriptor()
{
int PixelFormatIndex;
PIXELFORMATDESCRIPTOR PixelFormat =
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
24,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
32,
0, 0,
PFD_MAIN_PLANE,
0, 0, 0, 0
};

   PixelFormatIndex = ChoosePixelFormat(hDC, &PixelFormat);

   SetPixelFormat(hDC, PixelFormatIndex, &PixelFormat);

}
//---------------------------------------------------------------------------
void __fastcall TOpenGL::glSetView(int Width, int Height)
{
glViewport(0, 0, Width, Height);

   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
   
          glOrtho (-Width / 2 ,
                   Width / 2,
                   -Height / 2,
                   Height / 2,
                   -nRange, nRange);

}
//---------------------------------------------------------------------------
void __fastcall TOpenGL::glDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   glClearColor(0.0f, 0.0f, 0.0, 1.0f);
    
 //DRAWING CODE HERE!!!!    

glFlush();
}
//---------------------------------------------------------------------------
The Last Step:
//---------------------------------------------------------------------------
void __fastcall TFormMain::FormCreate(TObject *Sender)
{
f (!glInit(Handle)){
Close();
}
//Not Nessessary
Set8087CW(0x133f);

   Application-&gt;OnIdle = OnIdle;

}
//---------------------------------------------------------------------------
void __fastcall TFormMain::OnIdle(TObject* Sender, bool &done)
{
done = false;

   glDisplay();
   SwapBuffers(hDC);

}
//---------------------------------------------------------------------------
void __fastcall TFormMain::FormResize(TObject *Sender)
{
glSetView(ClientWidth, ClientHeight);
}
//---------------------------------------------------------------------------
Without any comments - Sorry. I hope you will understand this. Anyway You may ask everything if you don’t understand something.

Ny English is not the Best. Sorry

Forget about glut in Borland Builder C++. These functions are not supported there. (so I was told here).

Thanks, I got it to work now. So glut is impossible with borland? That sucks.

See the OpenGL page on my web site for info about using OpenGL/GLUT with Builder
http://members.home.net/~scottheiman

Regards,
Scott

heiman, I couldn’t get that site of yours to work. Problem with the link?

Try this
http://members.home.net/scottheiman/