OpenGL drawing in Borland Builder Form object

Started by
1 comment, last by soconne 18 years, 1 month ago
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.
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.
      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;
Author Freeworld3Dhttp://www.freeworld3d.org

This topic is closed to new replies.

Advertisement