| 1 |
'''OpenGL extension SGIS.shared_multisample |
| 2 |
|
| 3 |
This module customises the behaviour of the |
| 4 |
OpenGL.raw.GLX.SGIS.shared_multisample to provide a more |
| 5 |
Python-friendly API |
| 6 |
|
| 7 |
Overview (from the spec) |
| 8 |
|
| 9 |
While the OpenGL multisample extension (SGIS_multisample) provides |
| 10 |
good out-of-order antialiasing via subpixel samples, multisample |
| 11 |
hardware is very expensive because it multiplies the per-pixel |
| 12 |
framebuffer memory required to maintain color, depth, and stencil |
| 13 |
state by the number of samples. |
| 14 |
|
| 15 |
The cost-sensitive Location Based Entertainment (LBE) market |
| 16 |
desires good quality antialiasing, but the cost of maintaining |
| 17 |
multisample memory for every pixel in the framebuffer managed area |
| 18 |
is often prohibitive. Low-end multi-channel visual simulation may |
| 19 |
have similar cost constraints. |
| 20 |
|
| 21 |
LBE applications typically render several channels that are output |
| 22 |
to different video display devices. For example, an LBE |
| 23 |
application may render four 800x600 resolution channels, one per |
| 24 |
game player. While the total managed area may be 1600x1200, each |
| 25 |
channel ends up being rendered serially. With traditional |
| 26 |
multisampling (as specified by SGIS_multisample), multisample |
| 27 |
memory must be retained across the entire 1600x1200 managed area |
| 28 |
though in fact the application is never using more than an 800x600 |
| 29 |
rectangle of multisample pixel state at any given time. |
| 30 |
|
| 31 |
This sharing of multisample framebuffer state can result in a |
| 32 |
substantial competitive advantage for high-end multi-channel |
| 33 |
multisampling hardware for LBE applications. Unlike a "cheap PC |
| 34 |
per seat" solution, a high-end solution can be amortized by sharing |
| 35 |
both texture and multisample memory between the multiple channels |
| 36 |
(as well as host resources such as disk and CPUs). For cheap PCs |
| 37 |
to have the same amount of texture memory and quality of |
| 38 |
antialiasing, texture and multisample memory have to be replicated |
| 39 |
in every PC. |
| 40 |
|
| 41 |
In a typical windowed environment, the entire framebuffer managed |
| 42 |
area must retain multisample state because windows can be moved |
| 43 |
dynamically and resized (up to the entire size of the managed |
| 44 |
area). For LBE applications though, the layout of channel |
| 45 |
subrectangles in the framebuffer managed area is static and the |
| 46 |
LBE application monopolizes the graphics device (no other |
| 47 |
concurrent windowed apps). Because of their channel-oriented, |
| 48 |
dedicated, cost-sensitive nature, LBE applications can benefit from |
| 49 |
a means to share the available multisample memory resources among |
| 50 |
all the channels. |
| 51 |
|
| 52 |
The SGIS_shared_multisample extension specifies a single |
| 53 |
multisample buffer subrectangle sized smaller than the total |
| 54 |
managed area that is both shared among multiple windows and |
| 55 |
repositionable within in a window. |
| 56 |
|
| 57 |
Use of the SGIS_shared_multisample extension is predicated on |
| 58 |
specially configuring the window system, typically via a command |
| 59 |
line option added to the window system server's startup command. |
| 60 |
When run in this mode, OpenGL applications will see the |
| 61 |
GL_SGIS_shared_multisample string advertised in the GL_EXTENSIONS |
| 62 |
string (along with the GL_SGIS_multisample string). In this mode, |
| 63 |
the behavior of multisample extension changes. Instead of the |
| 64 |
multisample buffer memory being retained per-pixel across the |
| 65 |
entire managed area, multisample memory is shared among multisample |
| 66 |
windows and repositionable within a multisample window. |
| 67 |
|
| 68 |
Switching windows or repositioning the multisample subrectangle |
| 69 |
will make undefined the shared state within the multisample, depth, |
| 70 |
stencil, and accumulation buffers. |
| 71 |
|
| 72 |
When rendering into a multisample window, fragments that fall |
| 73 |
outside the window's multisample subrectangle are discarded |
| 74 |
(scissored). By default, the window's multisample rectangle is |
| 75 |
positioned at its window origin. |
| 76 |
|
| 77 |
The official definition of this extension is available here: |
| 78 |
http://www.opengl.org/registry/specs/SGIS/shared_multisample.txt |
| 79 |
''' |
| 80 |
from OpenGL import platform, constant, arrays |
| 81 |
from OpenGL import extensions, wrapper |
| 82 |
import ctypes |
| 83 |
from OpenGL.raw.GLX import _types, _glgets |
| 84 |
from OpenGL.raw.GLX.SGIS.shared_multisample import * |
| 85 |
from OpenGL.raw.GLX.SGIS.shared_multisample import _EXTENSION_NAME |
| 86 |
|
| 87 |
def glInitSharedMultisampleSGIS(): |
| 88 |
'''Return boolean indicating whether this extension is available''' |
| 89 |
from OpenGL import extensions |
| 90 |
return extensions.hasGLExtension( _EXTENSION_NAME ) |
| 91 |
|
| 92 |
|
| 93 |
### END AUTOGENERATED SECTION |