home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / newopg.zip / README.TXT < prev    next >
Text File  |  1995-03-04  |  28KB  |  1,011 lines

  1.  
  2.  
  3. OpenGL on OS/2 Beta Documentation
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21. IBM Power Personal Systems
  22.  
  23. Graphics Systems
  24.  
  25. Austin Texas 
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. CHAPTER 1   OpenGL on 
  41. OS/2
  42.  
  43. OpenGL is a highly functional 3D API available on many different plat-
  44. forms including many X Windows systems, and also Micrsoft's Windows 
  45. NT. It supports real time 3D rendering of points/lines/polygons including 
  46. support for lighting, texture mapping, anti-aliasing, fogging, motion blur, 
  47. hidden surface removal, transparency, and double buffering of images. This 
  48. beta release implements OpenGL in software, so special hardware accelera-
  49. tion is not needed. However, beacause it is a software implementation, 
  50. patience might be required for complex rendering.
  51.  
  52. OpenGL on OS/2 is currently in beta testing.
  53.  
  54. Most of the samples are written to a simple toolkit (AUX or TK) which insu-
  55. lates the user from OS/2 Windowing , User input, and OpenGL PGL calls. 
  56. AUX and TK demos are best for doing simple 3d programming, allowing 
  57. the user to concentrate on playing with 3D functionality.
  58.  
  59. OpenGL on OS/2 is implemented as several DLL's on top of OS/2. It can 
  60. bypass Presentation Manager when displaying OpenGL images by using a 
  61. `direct' OpenGL context. It can also render OpenGL images into a standard 
  62. Presentation Manager bitmap by using an `indirect' OpenGL context. Direct 
  63. contexts allow faster OpenGL rendering, while Indirect contexts allow for 
  64. integrated OpenGL and OS/2 PM drawing. 
  65.  
  66. A portion of the OpenGL API deals with integrating OpenGL into whatever 
  67. windowing system it is running on. In Presentation Manager, this portion of 
  68. the API is called PGL . It provides the following functionality:
  69.  
  70. ·   Specification of Visual Configurations
  71.  
  72. ·   Context Creation
  73.  
  74. ·   Binding an OpenGL Context to a PM Window
  75.  
  76. ·   Swapping a window's buffers
  77.  
  78. ·   Integration of OpenGL and OS/2 drawing
  79.  
  80. ·   Utilizing OS/2 fonts in OpenGL
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88. CHAPTER 2   Compiling 
  89. Demos
  90.  
  91. Makefiles
  92.  
  93. Makefiles are for IBM C Set compiler, the compiler we use to compile 
  94. OpenGL. OpenGL is a 3D API, makefiles for all different OS/2 compilers 
  95. are not included in the beta program. Compiler and Linker flags are 
  96. explained in the provided C Set makefile. 
  97.  
  98.  
  99.  
  100. Other Compilers
  101.  
  102. These libraries have been tried using 3 compilers: IBM C Set, WATCOM 
  103. 10.0, and gcc. They have not been tested with Borland. You should read the 
  104. explanations in the Makefiles for the switches we use with the IBM C Set 
  105. compiler. You should make sure you compile/link your demos with case 
  106. exact turned on, meaning you want the compiler/linker to call glVertex3fv(), 
  107. not call GLVERTEX3FV(). Make sure you specify a very big stack, if you 
  108. look at our .def files (another C Set-ism), we are specifying a 1 meg stack. I 
  109. know that you won't get something this big without specifying it. The 
  110. OpenGL entry points pass the parameters on the stack, so your calling sam-
  111. ple should do this (as opposed to the faster passing in registers). Read 
  112. through the C Set compiler/linker parameters.
  113.  
  114.  
  115.  
  116. IBM Developers Toolkit
  117.  
  118. Even if you are using another compiler, you will probably need the IBM 
  119. Developer's Toolkit. For OpenGL, it gives you the needed header files to 
  120. compile. For example, you need os2.h (and all the other header files that go 
  121. with it), and in the case of gcc, you will need LINK386.EXE to link your 
  122. programs together. For OS/2 2.1, you can purchase it seperately, for Warp, it 
  123. is packaged with the OS/2 Developer's Connection, and I'm not sure if it is 
  124. available seperately. Call 1-800-6DEVCON to subcribe.
  125.  
  126. CHAPTER 3   How Do I 
  127. run demos?
  128.  
  129. Several changes must be made to your config.sys:
  130.  
  131. c:\opengl\lib must be added to the LIBPATH statement in your con-
  132. fig.sys
  133.  
  134. DEVICE=c:\dev\smvdd.sys must be added to OS/2 2.1 config.sys.
  135.  
  136. DEVICE=c:\dev\ssmdd.sys must be added to OS/2 Warp config.sys
  137.  
  138.  
  139.  
  140.  
  141.  
  142. You must be running in 8 bit (256 color) or 24 bit mode.
  143.  
  144.  
  145.  
  146.  
  147.  
  148. Some demos need flags. Check the source code to see what flags you 
  149. should pass:
  150.  
  151. wave -db -dr 
  152.  
  153. -db for double buffered
  154.  
  155. -dr for direct rendering (-ir for slower indirect rendering)
  156.  
  157. CHAPTER 4   New for this 
  158. Beta
  159.  
  160. Added Support for other compilers, device driver bug fixes.
  161.  
  162. Please read DEVCON documentation for receiving technical support for this 
  163. product.
  164.  
  165. Our current beta release supports the following Visual Configurations on 
  166. direct and indirect contexts:
  167.  
  168.  
  169.  
  170. Table 1: Supported Visual Configs 
  171.  
  172. Visual 
  173. Config 
  174.  
  175. Single/
  176. Double 
  177. Buffer
  178.  
  179. RGBA/
  180. Color Index 
  181.  
  182. Depth 
  183. Buffer
  184.  
  185. Alpha 
  186. Buffer
  187.  
  188. Accum 
  189. Buffer 
  190.  
  191. Stencil 
  192. Buffer 
  193.  
  194. 1
  195.  
  196. Double
  197.  
  198. RGBA(3,3,2,8)
  199.  
  200. 24 
  201.  
  202. 8
  203.  
  204. 16,16,16,16
  205.  
  206. 8
  207.  
  208. 2
  209.  
  210. Double
  211.  
  212. CI(256)
  213.  
  214. 24 
  215.  
  216. 0
  217.  
  218. 0
  219.  
  220. 8
  221.  
  222. 3
  223.  
  224. Double
  225.  
  226. RGB(3,3,2)
  227.  
  228. 24
  229.  
  230. 0
  231.  
  232. 0
  233.  
  234. 8
  235.  
  236. 4
  237.  
  238. Double
  239.  
  240. RGBA (3,3,2,8)
  241.  
  242. 24
  243.  
  244. 8
  245.  
  246. 0
  247.  
  248. 8
  249.  
  250. 5
  251.  
  252. Double
  253.  
  254. RGBA(8,8,8,8)
  255.  
  256. 24
  257.  
  258. 8
  259.  
  260. 16,16,16,16
  261.  
  262. 8
  263.  
  264.  
  265.  
  266. CHAPTER 5   PGL 
  267. Function 
  268. Spec
  269.  
  270. 5.1  PVISUALCONFIG pglChooseConfig( hab, 
  271. attriblist)
  272.  
  273. Description:
  274.  
  275. PVISUALCONFIG is required when creating an OpenGL context. This call 
  276. will return a suitable PVISUALCONFIG based on the minimum require-
  277. ments passed in through attriblist. Each Boolean attribute will be matched 
  278. exactly, and each integer attribute will meet or exceed the specified value. 
  279. All Boolean attributes default to False, except PGL_USE_GL, which 
  280. defaults to True. Default attributes are superseded by the attributes listed in 
  281. attriblist. Boolean attributes included in attriblist are understood to be true, 
  282. integer attributes are followed immediately by the corresponding desired or 
  283. minimum value. Attributes which are not specified The attriblist is termi-
  284. nated by None. A PVISUALCONFIG is needed when creating an OpenGL 
  285. rendering context.
  286.  
  287. Parameters:
  288.  
  289. HAB   hab        Handle to Anchor Block
  290.  
  291. int   *attriblist        Specifies a list of Boolean attributes and 
  292. integer attribute/value pairs. The last attribute in 
  293.  
  294.                the list must be None.
  295.  
  296. Return Values:
  297.  
  298. PVISUALCONFIG                Pointer to a VisualConfig structure 
  299. meeting the requirements of attriblist
  300.  
  301. NULL               No suitable VisualConfig was found
  302.  
  303.  
  304.  
  305. The interpretations of the various PGL visual attributes are as follows:
  306.  
  307. PGL_USE_GL            Ignored.  Only visual configs that can be rendered 
  308. with PGL are considered.
  309.  
  310. PGL_BUFFER_SIZE       Must be followed by a nonnegative integer 
  311. that indicates the desired color index buffer size.  The 
  312. smallest index buffer of at least the specified size is pre-
  313. ferred.  Ignored if PGL_RGBA is asserted.
  314.  
  315. PGL_LEVEL             Must be followed by an integer buffer-level speci-
  316. fication.  This specification is honored exactly. Buffer 
  317. level zero corresponds to the default frame buffer of the 
  318. display. Buffer level one is the first overlay frame buffer, 
  319. level two the second overlay frame buffer, and so on. Neg-
  320. ative buffer levels correspond to underlay frame buffers.
  321.  
  322. PGL_RGBA              If present, only RGBA visual configs are consid-
  323. ered.Otherwise, Color Index visual configs are considered.
  324.  
  325. PGL_DOUBLEBUFFER      If present, only double bufferered 
  326. visual configs are considered.   Otherwise both sin-
  327. gle buffered and double buffered visual configs 
  328. may be considered.
  329.  
  330. PGL_SINGLEBUFFER             If present, only single buffered visual 
  331. configs are considered. Otherwise both single buff-
  332. ered and double buffered visual config may be con-
  333. sidered.
  334.  
  335. PGL_STEREO            If present, only stereo visual configs are 
  336. considered.  Otherwise, both monoscopic and ste-
  337. reoscopic visual configs are considered.
  338.  
  339. PGL_AUX_BUFFERS       Must be followed by a nonnegative 
  340. integer that indicates the desired number of auxil-
  341. iary buffers.  Visual configs with the  smallest num-
  342. ber of auxiliary buffers that meets or exceeds the 
  343. specified number are preferred.
  344.  
  345. PGL_RED_SIZE          Must be followed by a nonnegative mini-
  346. mum size specification.  If this value is zero, the 
  347. smallest available red buffer is preferred.  Other-
  348. wise, the largest available red buffer of at least the 
  349. minimum size is preferred.
  350.  
  351. PGL_GREEN_SIZE        Must be followed by a nonnegative 
  352. minimum size specification.  If this value is zero, 
  353. the smallest available green buffer is preferred.  
  354. Otherwise, the largest available green buffer of at 
  355. least the minimum size is preferred.
  356.  
  357. PGL_BLUE_SIZE         Must be followed by a nonnegative min-
  358. imum size specification.  If this value is zero, the 
  359. smallest available blue buffer is preferred.  Other-
  360. wise, the largest available blue buffer of at least the 
  361. minimum size is preferred.
  362.  
  363. PGL_ALPHA_SIZE        Must be followed by a nonnegative 
  364. minimum size specification.  If this value is zero, 
  365. the smallest available alpha buffer is preferred.  
  366. Otherwise, the largest available alpha buffer of at 
  367. least the minimum size is preferred.
  368.  
  369. PGL_DEPTH_SIZE        Must be followed by a nonnegative 
  370. minimum size specification.  If this value is zero, 
  371. visual configs with no depth buffer are preferred.  
  372. Otherwise, the largest available depth buffer of at 
  373. least the minimum size is preferred.
  374.  
  375. PGL_STENCIL_SIZE      Must be followed by a nonnegative 
  376. integer that indicates the desired number of stencil 
  377. bitplanes.  The smallest stencil buffer of at least the 
  378. specified size is preferred.  If the desired value is 
  379. zero, visual configs with no stencil buffer are preferred.
  380.  
  381. PGL_ACCUM_RED_SIZE    Must be followed by a nonnegative mini-
  382. mum size specification.  If this value is zero, visual configs 
  383. with no red accumulation buffer are preferred. Otherwise, 
  384. the largest possible red accumulation buffer of at least the 
  385. minimum size is preferred.
  386.  
  387. PGL_ACCUM_GREEN_SIZE  Must be followed by a nonnegative 
  388. minimum size specification.  If this value is zero, visual 
  389. configs with no green accumulation buffer are preferred. 
  390. Otherwise, the largest possible green accumulation buffer 
  391. of at least the minimum size is preferred.
  392.  
  393. PGL_ACCUM_BLUE_SIZE   Must be followed by a nonnegative min-
  394. imum size specification.  If this value is zero, visual con-
  395. figs with no blue accumulation buffer are preferred. 
  396. Otherwise, the largest possible blue accumulation buffer 
  397. of at least the minimum size is preferred.
  398.  
  399. PGL_ACCUM_ALPHA_SIZE  Must be followed by a nonnegative 
  400. minimum size specification.  If this value is zero, visual 
  401. configs with no alpha accumulation buffer are preferred. 
  402. Otherwise, the largest possible alpha accumulation buffer 
  403. of at least the minimum size is preferred.
  404.  
  405.  
  406.  
  407. Attriblist example:
  408.  
  409. attribList ={PGL_RGBA, PGL_RED_SIZE, 4, PGL_GREEN_SIZE, 
  410. 4,PGL_BLUE_SIZE, 4, None};
  411.  
  412. Specifies a single-buffered RGB visual config in the normal frame 
  413. buffer, not an overlay or underlay buffer.  The returned 
  414. visual config supports at least four bits each of red, green, 
  415. and blue, and possibly no bits of alpha.  It does not support 
  416. color index mode, double-buffering, or stereo display.  It 
  417. may or may not have one or more auxiliary color buffers, a 
  418. depth buffer, a stencil buffer, or an accumulation buffer.
  419.  
  420. The user should not modify the fields of the returned PVISUALCON-
  421. FIG structure.
  422.  
  423. When the user is done with the PVISUALCONFIG returned, the mem-
  424. ory can be freed by calling the C library routine free().
  425.  
  426. 5.2  PVISUALCONFIG *pglQueryConfigs( 
  427. hab)
  428.  
  429. Description:
  430.  
  431. This call will return a NULL terminated array of pointers to available 
  432. visual config structures for an OpenGL application to choose from. A 
  433. visual config defines what buffer configurations 
  434. (depth,accum,alpha,stencil) are available. An application should 
  435. choose the simplest visual config that will suit its needs (least number 
  436. of buffers).Programmers can also use the helper routine pglChooseC-
  437. onfig which will choose a suitable visual based on minimum require-
  438. ments. A PVISUALCONFIG is required to create an OpenGL 
  439. context. The list of Visual Configs is not guaranteed to be in any cer-
  440. tain order.
  441.  
  442. Parameters:
  443.  
  444. HAB           hab                Handle to anchor 
  445. block
  446.  
  447. Return Values:
  448.  
  449. PVISUALCONFIG    *            Pointer to null terminated array 
  450. of pointers to VISUALCONFIG structures 
  451.  
  452.                containing buffer configs
  453.  
  454. Notes:
  455.  
  456. The user should not modify the fields of the returned PVISUAL-
  457. CONFIG structures.
  458.  
  459. When the user is done with the returned PVISUALCONFIG list , 
  460. that memory can be freed by calling the C library 
  461. routine free().
  462.  
  463. 5.3  HGC 
  464. pglCreateContext(hab,pVisualConfig,ShareList,Is
  465. Direct)
  466.  
  467. Description:
  468.  
  469. This call will create an OpenGL context using the given visual config . A 
  470. visual config specifies what framebuffer resources are available to the ren-
  471. dering context. If an OpenGL context was successfully created, a handle to it 
  472. will be returned, else NULL will be returned. 
  473.  
  474. Parameters:
  475.  
  476. HAB            hab                Handle to anchor block
  477.  
  478. PVISUALCONFIG           pVisualConfig                Pointer to VISUALCON-
  479. FIG structure containing desired buffer config
  480.  
  481. HGC           ShareList                 Handle of OpenGL con-
  482. text with which to share display lists within a process.
  483.  
  484. BOOL           IsDirect                TRUE: Bypass GPI, and 
  485. render to a PM window. Generally faster.
  486.  
  487.                            FALSE: This context will 
  488. use Gpi for OpenGL rendering, 
  489.  
  490.                                    using GpiBitBlt 
  491. to blit OpenGL rendering to a PM window
  492.  
  493. Return Values:
  494.  
  495. HGC        Handle to successfully created context
  496.  
  497. NULL        Error occurred.
  498.  
  499. Configurations can be listed through pglQueryConfigs() 
  500.  
  501. Direct context- bypasses PM when displaying OpenGL rendering . Not 
  502. available on all OS/2 configurations. If 
  503. IsDirect parameter is TRUE, but a direct 
  504. context is not available, an indirect con-
  505. text will be created. pglIsIndirect can be 
  506. called to see if an OpenGL context is 
  507. direct or indirect.
  508.  
  509. Indirect context - uses GpiBitBlt to get image to screen . Allows access 
  510. to a PM bitmap containing OpenGL ren-
  511. dered image. The PM Bitmap is not guar-
  512. anteed to contain any OpenGL rendering 
  513. until the OpenGL graphics pipeline has 
  514. been flushed (glFlush , pglSwapBuffers or 
  515. pglWaitGL).
  516.  
  517. If ShareList is not NULL, then all display list definitions are 
  518. shared by ShareList and the newly 
  519. created context. An arbitrary num-
  520. ber of contexts can share display 
  521. lists, but each context must be 
  522. owned by the same process.
  523.  
  524. 5.4  BOOL pglMakeCurrent(hab,hgc,hwnd)
  525.  
  526. Description:
  527.  
  528. This call will bind an OpenGL hgc (context) to a PM window . The pgl-
  529. MakeCurrent subroutine will replace the old current context (if there was 
  530. one) with hgc. Before unbinding the old context, an implicit flush of the old 
  531. context will take place. Thus subsequent OpenGL rendering commands will 
  532. use hgc to modify hwnd. The first time hgc is made current to a window, its 
  533. viewport will be initialized to the full size of hwnd. Subsequent calls to pgl-
  534. MakeCurrent with hgc will not affect its viewport. To unbind the current 
  535. context without binding a new one, call pglMakeCurrent(hab,NULL,None). 
  536. pglMakeCurrent returns True if successful, False otherwise. 
  537.  
  538. Parameters:
  539.  
  540. HAB       hab        Handle anchor block
  541.  
  542. HGC       hgc        Handle to OpenGL context
  543.  
  544. HWND       hwnd        PM Window handle
  545.  
  546. Return Values:
  547.  
  548. True        Context was successfully bound to the window
  549.  
  550. False       Error occurred.
  551.  
  552.  
  553.  
  554. Notes:
  555.  
  556. Only one context can be bound to a window at a time.
  557.  
  558. The PM window must have been created with window client class 
  559. CS_SIZEREDRAW and 
  560. CS_MOVENOTIFY
  561.  
  562. The application cannot WinSubclassWindow(hwnd) while an OpenGL 
  563. context is bound to hwnd.
  564.  
  565. 5.5  Bool pglDestroyContext(hab,hgc)
  566.  
  567. Description:
  568.  
  569. This function will destroy hgc, and all the resources that belong to it. If it is 
  570. currently bound to a hwnd, this call will be ignored. 
  571.  
  572. Parameters:
  573.  
  574. HAB       hab        Handle to Anchor Block
  575.  
  576. HGC       hgc        Handle to OpenGL context
  577.  
  578. Return Values:
  579.  
  580. True           Context was successfully destroyed, or con-
  581. text was bound to a window
  582.  
  583. False           Error occured.
  584.  
  585. If hgc is currently bound to a window, pglDestroyContext will return 
  586. without destroying hgc. A current context can be unbound 
  587. from the currently bound window by calling pglMakeCur-
  588. rent(hab,NULL,None);
  589.  
  590. 5.6  Bool pglCopyContext(hab, hgc_src, hgc_dst, 
  591. attrib_mask)
  592.  
  593. Description:
  594.  
  595. This call will copy some portion of state from hgc_src to hgc_dst. The 
  596. attrib_mask parameter determines what group(s) of state variables will be 
  597. copied. attrib_mask must contain the bitwise OR of the same symbolic 
  598. names that can be passed to glPushAttrib. Set attrib_mask to 
  599. GL_ALL_ATTRIB_BITS to copy the max amount of state. This copy can be 
  600. done only if hgc_src and hgc_dst were created in the same process. 
  601.  
  602. Parameters:
  603.  
  604. HAB   hab         Handle to Anchor Block
  605.  
  606. HGC   hgc_src         Source OpenGL context
  607.  
  608. HGC    hgc_dst        Destination OpenGL context
  609.  
  610. GLuint   attrib_mask        Specifies which portions of hgc_src are to be 
  611. copied to hgc_dst
  612.  
  613. Return Values:
  614.  
  615. True   Context state was successfully copied from hgc_src to 
  616. hgc_dst
  617.  
  618. False   Error occured.
  619.  
  620. If hgc_src is not current to the thread issuing the request, then the state of 
  621. hgc_src is undefined.
  622.  
  623. Not all values of OpenGL state can be copied. For example, pixel pack and 
  624. pixel unpack state, render mode state, select and feedback state are not cop-
  625. ied. The state that can be copied by this command is exactly the same state 
  626. that can be manipulated by the OpenGL command glPushAttrib.
  627.  
  628.  
  629.  
  630. 5.7  LONG pglIsIndirect(hab,hgc)
  631.  
  632. Description:
  633.  
  634. This function will return what type of context hgc is. The hgc parameter 
  635. must have been returned from pglCreateContext.
  636.  
  637. Parameters:
  638.  
  639. HAB   hab        Handle to Anchor Block
  640.  
  641. HGC   hgc        Handle to OpenGL context 
  642.  
  643. Return Values:
  644.  
  645. NULL       This Context bypasses conventional PM blitting 
  646. methods, and is faster .
  647.  
  648. <0       Error occured.
  649.  
  650. 1       This Context uses conventional PM blitting meth-
  651. ods, and while it is slower, allows an application 
  652.  
  653.            to integrate OpenGL rendering and Gpi ren-
  654. deing commands. See notes section.
  655.  
  656. Notes:
  657.  
  658. If pglIsIndirect returns One, it uses Gpi to blit OpenGL rendering . Integra-
  659. tion of OpenGL rendering and Gpi renderingis only allowed on Indirect con-
  660. texts, and is controlled through the use of pglWaitPM and pglWaitGL. 
  661. Applications must call pglGrabFrontBitmap when they need access to the 
  662. actual bitmap, and call pglReleaseFrontBitmap when they are done with it. 
  663.  
  664. The PM Bitmap is not guaranteed to contain any OpenGL rendering until the 
  665. OpenGL graphics pipeline has been flushed (glFlush, pglSwapBuffers, or 
  666. pglWaitGL).
  667.  
  668.  
  669.  
  670.  
  671.  
  672. 5.8  HGC pglGetCurrentContext(hab)
  673.  
  674. Description:
  675.  
  676. Look up the current OpenGL context for this process. A context is `current' 
  677. if it was the last context to be bound to a window by calling pglMakeCur-
  678. rent.
  679.  
  680. Parameters:
  681.  
  682. HAB   hab        Handle to Anchor Block
  683.  
  684. Return Values:
  685.  
  686. HGC           Current Context
  687.  
  688. NULL           No Current context exists for this process
  689.  
  690. Notes:
  691.  
  692. Only One current context is allowed per process.
  693.  
  694. 5.9  HWND pglGetCurrentWindow(hab)
  695.  
  696. Description:
  697.  
  698. This function returns the current hwnd that is bound to an OpenGL context. 
  699. A window is current if it was the last window to be bound to an OpenGL 
  700. context by calling pglMakeCurrent.
  701.  
  702. Parameters:
  703.  
  704. HAB   hab        Handle to Anchor Block
  705.  
  706. Return Values:
  707.  
  708. HWND           Current window that is bound to an OpenGL 
  709. context
  710.  
  711. NULL           No window is currently bound to any 
  712. OpenGL context for the calling process
  713.  
  714. Notes:
  715.  
  716. Only one current window is allowed per process.
  717.  
  718. 5.10  HPS pglWaitGL(hab)
  719.  
  720. Description:
  721.  
  722. Ensure that all OpenGL rendering commands made prior to pglWaitGL are 
  723. executed before and Gpi rendering calls made after pglWaitGL. This call is 
  724. ignored if there is no current context or if the current context is a direct con-
  725. text which does not use Gpi for displaying OpenGL images. The return 
  726. value for this function is HPS that has the bitmap set in it to be the bitmap 
  727. containing OpenGL rendering. 
  728.  
  729. Parameters:
  730.  
  731. HAB   hab        Handle to Anchor Block
  732.  
  733. Return Values:
  734.  
  735. HPS   hps        Handle to the PS which is used to blit the 
  736. OpenGL image to the screen. This HPS can be 
  737.  
  738.            used for Gpi drawing commands .
  739.  
  740. NULL           No Current Context exists, or current context 
  741. is not using Gpi to display OpenGL images.
  742.  
  743. Notes:
  744.  
  745. Gpi drawing intermingled with OpenGL drawing is only allowed on 
  746. Indirect contexts that use Gpi to blit their OpenGL render-
  747. ing to the screen. Prior to doing any Gpi drawing, the user 
  748. must call pglWaitGL in order to flush the OpenGL render-
  749. ing stream. 
  750.  
  751. pglWaitGL is ignored if there is no current context. 
  752.  
  753. 5.11  void pglWaitPM(hab)
  754.  
  755. Description:
  756.  
  757. Gpi calls made prior to pglWaitPM are guaranteed to be executed before 
  758. OpenGL rendering calls made after pglWaitPM.
  759.  
  760. Parameters:
  761.  
  762. HAB   hab        Handle to Anchor Block
  763.  
  764. Return Values:
  765.  
  766. Notes:
  767.  
  768. Gpi drawing intermingled with OpenGL drawing is only allowed on 
  769. Indirect contexts that use Gpi to blit their OpenGL render-
  770. ing to the screen. Gpi drawing is not guaranteed to be visi-
  771. ble until pglWaitPM has been called. 
  772.  
  773. Gpi has no concept of front and back buffers. All Gpi drawing com-
  774. mands are therefore assumed to affect the OpenGL front 
  775. buffer.
  776.  
  777. pglWaitPM is ignored if there is no current context
  778.  
  779. 5.12  void pglSwapBuffers(hab,hwnd)
  780.  
  781. Description:
  782.  
  783. Swaps the front and back buffers of hwnd. This routine has no effect on win-
  784. dows attached to single buffered contexts. An implicit glFlush is done by 
  785. pglSwapbuffers before it returns. Double buffered rendering is done when 
  786. smooth animation between frames is desired. OpenGL commands issued 
  787. after calling pglSwapBuffers are not issued until the buffer swap is com-
  788. plete.
  789.  
  790. Parameters:
  791.  
  792. HAB   hab        Handle to Anchor Block
  793.  
  794. HWND   hwnd        Handle to Window whose buffers are to be 
  795. swapped.
  796.  
  797. Return Values:
  798.  
  799. Notes:
  800.  
  801. When a window's buffers are swapped, the back buffer becomes the front, 
  802. and the front buffer will become the back. The programmer can control 
  803. whch buffer is affected by OpenGL rendering calls through the use of 
  804. glDrawBuffer.
  805.  
  806. Front and back buffers are not created for a window until it has been bound 
  807. to an OpenGL context. This call has no effect on a PM window which has 
  808. never been bound to an OpenGL context.
  809.  
  810. The window specified by hwnd does not CURRENTLY have to be bound to 
  811. an OpenGL context, just needs to have been bound at some point.
  812.  
  813. 5.13  BOOL pglUsePMBitmapFont(hab, 
  814. id,first,count,listbase)
  815.  
  816. Description:
  817.  
  818. This function is not implemented in the current beta release.
  819.  
  820. This function will create count OpenGL display lists containing bitmaps of 
  821. the named OS/2 logical font specified by id. Each bitmap will consist of a 
  822. single glBitmap command. These display lists will be numbered listbase 
  823. through listbase + count -1. The parameters to glBitmap for display list list-
  824. base+i are derived from bitmap first+i in the logical font. OpenGL might 
  825. delay glBitmap creation until a font glyph is accessed.
  826.  
  827. Parameters:
  828.  
  829. HAB   hab        Handle to anchor block
  830.  
  831. LONG   id        Font id returned from GpiCreateLogFont
  832.  
  833. int   first        index of first glyph to be taken
  834.  
  835. int   count        number of glyphs to be taken
  836.  
  837. int   listbase        index of first display list to be created.
  838.  
  839. Return Values:
  840.  
  841. NULL       Error occured.
  842.  
  843. Non NULL       Bitmap display lists were successfully created.
  844.  
  845. Notes:
  846.  
  847. Empty display lists are created for all glyphs requested but not defined 
  848. in the logical font specified by id. 
  849.  
  850. Outline fonts are not valid fonts for this call.
  851.  
  852. pglUsePMBitmapFont is ignored if there is no current OpenGL context.
  853.  
  854. 5.14  BOOL pglUsePMOutlineFont(hab, 
  855. id,first,count,listbase)
  856.  
  857. Description:
  858.  
  859. This function is not implemented in the current release.
  860.  
  861. This function will create count OpenGL display lists containing verticies of 
  862. the named OS/2 logical font specified by id. Each Display List will consist 
  863. of a single glVertex2i command. These display lists will be numbered list-
  864. base through listbase + count -1. 
  865.  
  866. Parameters:
  867.  
  868. HAB   hab        Handle to anchor block
  869.  
  870. LONG   id        Font id returned from GpiCreateLogFont
  871.  
  872. int   first        index of first character to be taken
  873.  
  874. int   count        number of characters to be taken
  875.  
  876. int   listbase        index of first display list to be created.
  877.  
  878. Return Values:
  879.  
  880. NULL       Error occured.
  881.  
  882. Non NULL        display lists were successfully created.
  883.  
  884. Notes:
  885.  
  886. Empty display lists are created for all characters requested but not 
  887. defined in the logical font specified by id. 
  888.  
  889. Bitmap fonts are not valid fonts for this call.
  890.  
  891. pglUsePMOutlineFont is ignored if there is no current OpenGL context.
  892.  
  893.  
  894.  
  895. 5.15  LONG pglQueryCapability(hab)
  896.  
  897. Description:
  898.  
  899. Query OpenGL capability on this machine. 
  900.  
  901. Parameters:
  902.  
  903. HAB   hab        Handle to Anchor Block
  904.  
  905. Return Values:
  906.  
  907. NULL       No OpenGL Support on this machine
  908.  
  909. 1       OpenGL Support available through PM blitting only
  910.  
  911. 2       Advanced OpenGL support available
  912.  
  913. Notes:
  914.  
  915.  
  916.  
  917. 5.16  void pglQueryVersion(hab,major, minor)
  918.  
  919. Description:
  920.  
  921. Queries release of OpenGL libraries installed.
  922.  
  923. Parameters:
  924.  
  925. HAB   hab        Handle to Anchor Block
  926.  
  927. int    *major        Returns major release number of OpenGL 
  928. libraries
  929.  
  930. int   *minor        Returns minor release number of OpenGL 
  931. libraries
  932.  
  933.  
  934.  
  935. Return Values:
  936.  
  937.  
  938.  
  939. Notes:
  940.  
  941. 5.17  BOOL pglGrabFrontBitmap(hab,phps, 
  942. phbitmap)
  943.  
  944. Description:
  945.  
  946. This subroutine queries the HPS and HBITMAP which contain the bitmap 
  947. representation of the front buffer of the current OpenGL window. While the 
  948. bitmap is locked, the application will NOT receive WM_SIZE or 
  949. WM_ADJUSTPOSITION messages in the current OpenGL hwnd, and the 
  950. current window will NOT be sizeable. An implicit glFlush() occurs before 
  951. this call completes. Applications must call pglReleaseFrontBitmapwhen 
  952. they are done with the HBITMAP. The HBITMAP is only valid between 
  953. pglGrabFrontBitmap and pglReleaseFrontBitmap, the HPS will be valid 
  954. until the current window is unbound by calling pglMakeCurrent. 
  955.  
  956. Parameters:
  957.  
  958. HAB   hab        Handle to Anchor Block
  959.  
  960. HPS   *phps        Pointer returning HPS with phbitmap set in it
  961.  
  962. HBITMAP    *phbitmap        Pointer returning HBITMAP containing 
  963. OpenGL rendering
  964.  
  965. Return Values:
  966.  
  967. BOOL   True: Bitmap was grabbed
  968.  
  969.    False: No Current window exists for this process
  970.  
  971. Notes:
  972.  
  973. Applications should not destroy the HPS or HBITMAP. Applications 
  974. should not use GpiSetPalette to modify the HPS's color 
  975. palette. Applications should not disassociate HPS from it's 
  976. DC, or unset the bitmap from HPS.Applications should 
  977. not set any PS size, units and format using GpiSetPS. In 
  978. other words, "Look, but don't touch!"
  979.  
  980. See pglWaitPM and pglWaitGL for integrating OpenGL andGpi draw-
  981. ing.
  982.  
  983. Applications should call pglReleaseFrontBitmap as soon as possible 
  984. after locking the bitmap with this call.
  985.  
  986. 5.18  BOOL pglReleaseFrontBitmap(hab)
  987.  
  988. Description:
  989.  
  990. This subroutine releases the HBITMAP which was grabbed using pglGrab-
  991. FrontBitmap. The calling process will now begin recieving WM_SIZE and 
  992. WM_ADJUSTPOSITION messages in its current OpenGL window again. 
  993.  
  994. Parameters:
  995.  
  996. HAB   hab        Handle to Anchor Block
  997.  
  998. Return Values:
  999.  
  1000. BOOL   True: Bitmap was released
  1001.  
  1002.    False: No bitmap needed to be released.
  1003.  
  1004. Notes:
  1005.  
  1006. See pglWaitPM and pglWaitGL for integrating OpenGL and PM draw-
  1007. ing.
  1008.  
  1009. Applications should call pglReleaseFrontBitmap as soon as possible 
  1010. after locking the bitmap with pglGrabFrontBitmap.
  1011.