PDA

View Full Version : Borland OpenGL Users Help Needed



darketernal
07-23-2002, 11:04 AM
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 http://www.opengl.org/discussion_boards/ubb/frown.gif

It seems i need a Borland Basecode of some sort.

Any feedback would be greatly appreciated

BlackJack
07-23-2002, 11:23 AM
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(&amp;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, &amp;mPfd);
SetPixelFormat(mWinDC, mPixelFormat, &amp;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

Suf
07-23-2002, 01:51 PM
Have you done the 'implib' command?

Suf.

ToolChest
07-23-2002, 02:39 PM
try adding an OnPaint event for the window.

John.

ToolChest
07-23-2002, 02:41 PM
btw: i use BCB5 for my development and the code generated by the compiler rarely needs optimized. its nice to see another borland user... http://www.opengl.org/discussion_boards/ubb/smile.gif

John.