SAMPLE: GLEXT: Demo of GL_WIN_swap_hint & GL_EXT_vertex_array

Last reviewed: June 6, 1996
Article ID: Q139967
The information in this article applies to:
  • Microsoft Win32 Software Development Kit for:

        - Microsoft Windows NT version 3.51
        - Microsoft Windows 95 version 4.0
    

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.

Download GLEXT.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:

  • The Microsoft Network

          On the Edit menu, click Go To, and then click Other Location
          Type mssupport
          Double-click the MS Software Library icon
          Find the appropriate product area
          Download GLEXT.EXE
    
  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download GLEXT.EXE
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the Softlib\Mslfiles directory
          Get GLEXT.EXE
    

MORE INFORMATION

Windows NT 3.51 and Windows 95 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 reference words: 3.51 4.00 glext.exe opengl extension
KBCategory: kbgraphic kbfile
KBSubcategory: GdiOpenGL


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 6, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.