Jump to content
  • Advertisement
Sign in to follow this  
kbugs

OpenGL OpenGL drawing in Borland Builder Form object

This topic is 4587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I`m a very beginner in OpenGL and i would like to ask about using OpenGL in Borland Builder (6). My question is how to force OpenGL to draw in the Builder Form Object (i want to have a Form with buttons and a small panel on the same Form where i want to draw OpenGL objects). I also don`t really know what kind of object in the Builder Form can be the "context" for OpenGL scene? Regards, Kris P.S. If there is an answer in the Forum then please pass me the link. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I use OpenGL with BCB6.0 extensively!
You need to use the Handle property of either the form (if you want the whole client area to be drawn on), or the Handle of a TPanel.
Normally what I do is drop a TPanel onto the form and turn off all the beveling, and that gives you a nicely adjustable draw area, without the entire window being drawn over.
Then for drawing you can use the OnPaint event, and/or Application->IdleLoop.

Share this post


Link to post
Share on other sites


HDC hDC = GetDC(Panel->Handle);
HGLRC hRC;

PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
bpp,
0,0,0,0,0,0,
8,0,
0,0,0,0,0,
depthBpp,
0,
0,
PFD_MAIN_PLANE,
0,
0,0,
};
int PixelFormat = ChoosePixelFormat(hDC, &pfd);
SetPixelFormat(hDC, PixelFormat, &pfd);

wglDeleteContext(hRC);
hRC = wglCreateContext(hDC);

if(hRC == NULL)
return false;

if(wglMakeCurrent(hDC, hRC) == false)
return false;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!