Borland OpenGL Users Help Needed

Can anyone help me in setting up a OpenGL application in Borland 5.0 Enterprise Edition

  • Please don’t redirect me to some other site
  • Please putting a simple additional h.header file and cpp.code for Borland C++ 5.0 enterprise in here,will mean a lot more to me.

Now, im sorry if i sound demanding, but let’s not hesitate and show what it is all about.

#include <whateverYouNeed.h>

InitializeAWindowPlease();

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, -1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();
UpdateTheWindowAndCheckForEvents();
}

Now the OpenGl book swears by high and dry that if i just include glut/glu/gl/windows.h etc that it will see a black screen with a white rectangle in it. But if i compile i will just get the standard output. I don’t understand what i am doing wrong

It seems i need a Borland Basecode of some sort.

Any feedback would be greatly appreciated

Is your window client area at least filled with black or is it completely grey as every standard window is? What does “InitializeAWindowPlease()”?

ok, here some copy paste GL init stuff, check, if some of this is missing:

needed variables: valid hWnd

other variables:
HDC mWinDC; ///< display control
HGLRC mRC; ///< RC
int mPixelFormat; ///< pixel format handle
PIXELFORMATDESCRIPTOR mPfd; ///< pixelformat description containing bit depth etc.

initialization:

  mWinDC=GetDC(mHWnd);
  memset(&mPfd,0,sizeof(mPfd));
  mPfd.nSize=sizeof(mPfd);
  mPfd.nVersion=1;
  mPfd.dwFlags=PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
  mPfd.iPixelType=PFD_TYPE_RGBA;
  mPfd.cColorBits=16;
  mPfd.cDepthBits=16;
  mPfd.cAlphaBits=0;
  mPfd.iLayerType=PFD_MAIN_PLANE;
  mPixelFormat = ChoosePixelFormat(mWinDC, &mPfd);
  SetPixelFormat(mWinDC, mPixelFormat, &mPfd);
  mRC = wglCreateContext(mWinDC);

wglMakeCurrent(mWinDC,mRC);

if you call your glClearColor and glClear after this your window should at least be filled black already.

BlackJack

Have you done the ‘implib’ command?

Suf.

try adding an OnPaint event for the window.

John.

btw: i use BCB5 for my development and the code generated by the compiler rarely needs optimized. its nice to see another borland user…

John.