JRS
JRS

Reputation: 1458

OpenGL Viewer Control & Rendering Contexts

I have built an OpenGL Viewer control that can simply be dropped onto a windows form (at design time) and assigned an OpenGL display list (at run time).

The viewer control handles navigation, display options (e.g. background color), etc. It is also responsible for creating and destroying rendering and device contexts as necessary.

Obviously, each viewer control instance has its own device context, the 'window' where the image is drawn.

Questions:

I'm particularly concerned with how this affects WGL font creation (wglUseFontBitmaps and wglUseFontOutlines), which requires a rendering context (whatever the current context is) and a device context.

Perhaps my approach is flawed.

Upvotes: 1

Views: 367

Answers (1)

Jose
Jose

Reputation: 311

I would go with the context per control approach. You do have to remember that extensions are context based so you'll have to bind them for each one you make (I use glew_MX to handle this).

Also, you can share display lists across contexts (as long as they are on the same gpu) and the wgl font creation creates display lists so you should be fine.

Upvotes: 1

Related Questions