Microsoft KB Archive/139967

{|
 * width="100%"|

GLEXT: Demo of GL_WIN_swap_hint & GL_EXT_vertex_array

 * }

Q139967

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK), used with:
 * Microsoft Windows NT Server version 4.0
 * Microsoft Windows NT Workstation version 4.0
 * Microsoft Windows 98
 * Microsoft Windows 95

SUMMARY
The GLEXT sample illustrates how to use the GL_WIN_swap_hint extension to speed up animation by reducing the amount of repainting between frames and how to use GL_EXT_vertex_array extension to provide fast rendering of multiple geometric primitives with one glDrawArraysEXT call. It also shows how to use glPixelZoom and glDrawPixels to display an OpenGL bitmap.

Note that GL_WIN_swap_hint and GL_EXT_vertex_array are not supported by all accelerator cards. You should query the available pixel formats for these capabilities as described in the following article text.

MORE INFORMATION
The following file is available for download from the Microsoft Software Library:

"~ glext.exe" For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

"Q119591 How to Obtain Microsoft Support Files from Online Services"

Windows NT 4.0 and Windows 95x OpenGL supports OpenGL GL_WIN_swap_hint and GL_EXT_vertex_array extensions. To use GL_WIN_swap_hint extension, you need to use these functions:

  glAddSwapHintRectWIN SwapBuffers glGetString wglGetProcAddress The glAddSwapHintRectWIN function lets you specify a set of rectangular areas that you want to copy when you call SwapBuffers function. When no rectangles are specified with glAddSwapHintRectWIN before calling SwapBuffers, the entire frame buffer is swapped. If you only want to animate part of your scene, using glAddSwapHintRectWIN function will significantly speed up your animation. To check whether your implementation of OpenGL supports glAddSwapHintRectWIN, call glGetString(GL_EXTENSIONS). If it returns GL_WIN_swap_hint, glAddWsapHintRectWIN is supported. To obtain the address of the glAddSwapHintRectWIN function, call wglGetProcAddress.

To use GL_EXT_vertex_array extension, you need to use these functions:

  glDrawArraysEXT glGetString wglGetProcAddress The glDrawArraysEXT function enables you to specify multiple geometric primitives to render. Instead of calling separate OpenGL functions to pass each individual vertex, normal, or color, you can specify separate arrays of vertexes, normals, and colors to define a sequence of primitives of the same kind, and just use one glDrawArraysEXT call to render them. To check whether your implementation of OpenGL supports glDrawArraysEXT, call glGetString(GL_EXTENSIONS). If it returns GL_EXT_vertex_array, glDrawArraysEXT is supported. To obtain the address of the glDrawArraysEXT function, call wglGetProcAddress.

You can use the following functions to define the data array for your primitives:

  glVertexPointerEXT glNormalPointerEXT glColorPointerEXT glTexCoordPointerEXT glEdgeFlagPointerEXT glArrayElementEXT glGetPointervEXT glIndexPointerEXT See the SDK references for information on these functions.

Additional query words: kbgraphic kbfile glext.exe opengl swap extension

Keywords : kbfile kbgraphic kbOSWinNT400 kbSDKWin32 kbOSWin95 kbOSWin98

Issue type : kbinfo

Technology : kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch