Home Robotics C++ Physics II AP Physics B Electronics AP Java Astronomy Independent Study Summer Session Contests  About
                                                       

Windows Routines

OpenGL is available on many different platforms and works with many different window systems. OpenGL is designed to complement window systems, not duplicate their functionality. Therefore, OpenGL performs geometric and image rendering in two and three dimensions, but it does not manage windows or handle input events.

 

However, the basic definitions of most window systems don't support a library as sophisticated as OpenGL, with its complex and diverse pixel formats, including depth, stencil, and accumulation buffers, as well as double-buffering. For most window systems, some routines are added to extend the window system to support OpenGL.

The set of APIs used to set up OpenGl on Windows is collectively known as WGL, sometimes pronounced “wiggle”. Some of the things WGL allows youto do include.

Ø Creating and loading a rendering context

Ø Using Windows font support in OpenGL applications

Ø Loading OpenGL extensions

 

A summary of some of the prototypes is presented below

 

Determine version information:

Ø BOOL GetVersion ( LPOSVERSIONINFO lpVersionInformation );

Ø BOOL GetVersionEx ( LPOSVERSIONINFO lpVersionInformation );

 

Pixel format availability, selection, and capability:

Ø int ChoosePixelFormat ( HDC hdc,
Ø CONST PIXELFORMATDESCRIPTOR * ppfd );

Ø BOOL SetPixelFormat ( HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR * ppfd );

Ø int DescribePixelFormat ( HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd );

Ø BOOL wglDescribeLayerPlane ( HDC hdc, int iPixelFormat, int iLayerPlane, UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd );

 

Manage or query an OpenGL rendering context:

 

Ø HGLRC wglCreateContext ( HDC hdc );

Ø HGLRC wglCreateLayerContext ( HDC hdc, int iLayerPlane );

Ø BOOL wglShareLists ( HGLRC hglrc1, HGLRC hglrc2 );

Ø BOOL wglDeleteContext ( HGLRC hglrc );

Ø BOOL wglCopyContext ( HGLRC hglrcSource, HGLRC hlglrcDest, UINT mask );

Ø BOOL wglMakeCurrent ( HDC hdc, HGLRC hglrc );

Ø HGLRC wglGetCurrentContext (VOID);

Ø HDC wglGetCurrentDC (VOID);

 

Access and release the bitmap of the front buffer:

 

Ø HBITMAP CreateDIBitmap ( HDC hdc,
Ø CONST BITMAPINFOHEADER *lpbmih, DWORD fdwInit,
Ø CONST VOID *lpbInit, CONST BITMAPINFO *lpbmi, UINT fuUsage );

Ø HBITMAP CreateDIBSection ( HDC hdc, CONST BITMAPINFO *pbmi,
Ø UINT iUsage, VOID *ppvBits, HANDLE hSection, DWORD dwOffset );

Ø BOOL DeleteObject ( HGDIOBJ hObject );

 

Exchange front and back buffers:

 

Ø BOOL SwapBuffers ( HDC hdc );

Ø BOOL wglSwapLayerBuffers ( HDC hdc, UINT fuPlanes );

Ø Finding a color palette for overlay or underlay layers:

Ø int wglGetLayerPaletteEntries ( HDC hdc, int iLayerPlane, int iStart,
Ø int cEntries, CONST COLORREF *pcr );

Ø BOOL wglRealizeLayerPalette ( HDC hdc, int iLayerPlane, BOOL bRealize );

Use a bitmap or an outline font:

Ø BOOL wglUseFontBitmaps ( HDC hdc, DWORD first, DWORD count, DWORD listBase );

Ø BOOL wglUseFontOutlines ( HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format,

      PGLYPHMETRICSFLOAT lpgmf );