PDA

View Full Version : How can I run OpenGL with Builder C++ ??



Le Bayonnais
02-24-2000, 01:04 AM
http://www.opengl.org/discussion_boards/ubb/confused.gif Help me???
I want to know how can I run an OpenGL window from an application Win32 of Borland Builder C++
Thanks
Le Bayonnais

Inquisitor
02-24-2000, 02:29 AM
1. Create a new form for displaying OpenGL output.
2. Retrieve the HDC of that form by using
HWND hwnd=FormX->Handle;
HDC dc=GetDC(hwnd);
3. Fill out a PIXELFORMATDESCRIPTOR-struct.
4. int i=ChoosePixelFormat(dc,&pfd);
5. SetPixelFormat(dc,i,&pfd);
6. HGLRC glrc=wglCreateContext(dc);
7. wglMakeCurrent(dc,glrc);
Now you are ready to render your polygons...
8. When terminating call the following
functions to free the stuff you allocated
earlier.
wglDeleteContext(glrc);
ReleaseDC(hwnd,dc);

By the way: instead of using a form you may
use ANY visible object that has an HWND Handle property.
Hope it helped...


[This message has been edited by Inquisitor (edited 02-24-2000).]

BJuano
02-29-2000, 09:04 AM
This tutorial on the Borland Community site explains how to set up OpenGL drawing on a VCL form. http://community.borland.com/article/0,1410,10528,00.html