OWL and OpenGL

I’m a rookie programmer.

Anyone have any advice or sample code for using OpenGL commands in an OWL window?

I don’t know how to tell the computer to draw in the window.

I’m running Borland C++ 5.0

Thank you

oooooh I did that 3 years ago, but unfortunately I’ve no longer the source code.

The idea is to write a class TOpenGLWindow derived from TWindow and a class TOpenGLApp derived from TApplication.

There’s nothing special to do in TOpenGLApp, except that you create a TOpenGLWindow instead of a TWindow.

The difficulty lies in writing TOpenGLWindow.
Do nothing special in the constructor/destructor.

In TOpenGLWindow::SetupWindow :
you have to add code to initialize an opengl rendering context.
the staples are :

  • call TWindow::SetupWindow
  • retrieve the HWND
  • create a TClientDC for this window

WARNING ! VERY IMPORTANT BIP BIP BIP


This TClientDC must live all the time your application is running. You should declare it as a member of TOpenGLWindow, not as a local variable !

  • retrieve its HDC
  • set up a PIXELFORMATDESCRIPTOR and do the necessary wgl calls to get a rendering context.

In TOpenGLWindow::CloseWindow :
release the rendering context.

Of course, if you want that your window behaves well under resizing you’ll have to fix the corresponding member function of TOpenGLWindow, and so on for all events …

Hope that helps !
Morglum