Setting up OpenGL

I programm under Borland C++ Builder 6.0 and need to set up OpenGL for rendering in a TPicture component. How can I do this? I do correctly under a whole window dedicated for OpenGL even in a component such as TPanel and TButton but I like it to be a TPaintBox (that’d perfect). HELP!!!

By the way, how can I configure Outlook for reading this forum in it? I need the server.

thx a lot.

What’s the difference which component you use?
Every of them has unique hWnd (called handle) and this is only the one parameter you need to setup OpenGL.

Sorry, I meant I wanted to use the TPaintBox component (the one with a painter’s brush in it).

My question is: how can I initialize OpenGL for rendering in it? I can set it up for rendering in a TPanel component, but I’d like it to be a TPaintBox component.


errr, he told you how. All you need to set up an opengl window is the hWnd, just use the one from the TPaintBox instead of the windows handle. If you are using GLFW or GLUT you may have to switch to a windows api based approach. This isn’t hard but is long, see for details.

I don’t know how it is in Builder, but in Delphi TPicture is a non-window control. It means - it has no window handle(it uses owners handle instead). If it also applies to Builder, well… sorry for you. You could develop an own component, however.

The simplest way is to render the GL scene to a bitmap and then render the bipmap into the controls canvas.

chowe6685: the TPaintBox component has no window handle but some other type so I can’t do what you do.

OLI-G: I can’t render in an image because that’s the question of my post.


I don’t get it, why can’t you make it with simple TPanel?

Because I have everything in a TPaintBox component but without using OpenGL. If I keep that component I’ll have to change fewer things.

Does anybody know if what I’m trying to do is posible?

Rendering to a TPanel would work if I could copy its canvas to the TPaintBox. I use the Draw method of the canvas which accepts no TCanvas for the source.