More about Graphics Hardware
More about Graphics Hardware
This section is optional reading for those who want to understand more about the innards of graphics, and find out how to use their machinery more effectively.
- What are the "client" and "server"?
- What the ?"!!##? are X11 "visuals"?
- What visuals does Oasys LS-DYNA Environment use?
- How does OpenGL work with X11?
- What are OpenGL "objects"?
What are the "client" and "server"?The "client" is the process making the graphics requests, for example D3PLOT, T/HIS, etc. |
- You own this process - on Unix systems a "ps" command will show it as belonging to your user id.
- In order to display graphics it must open a display connected to a "server": either locally or over a network.
The "server" is the process running either on this machine (the local host) or remotely elsewhere on a network that receives graphics requests from client processes and turns them into graphics on a screen.
- The server is owned by the operating system of the machine - on Unix systems a "ps" command will show it belonging to user id "root".
- It serves all graphics requests that come to it, not just your client's: it is a shared resource.
- You request facilities (eg windows, colourmaps, backing store) but since it is a shared resource these may not always be available.
In most cases a machine will be running a single X server, by convention #0. However there is a special case of the "X Virtual Frame Buffer" (Xvfb) that is used for batch mode graphics which, by convention, will run as server #1 - see section 2.5 below.
What are X11 "visuals"?
The X11 protocol has to operate on a wide range of hardware ranging from old "black and white" displays to modern colour ones, and it is fact of life that the hardware on these machines varies. Some machines support a range of graphics options simultaneously: for example they can have some windows operating in "greyscale" mode alongside others in full colour; they may also provide " overlay " planes. Most modern machine provide a range of visual types and depths (# bit-planes ).
To make some sort of sense of all this the X11 protocol groups graphics capability into six categories of "visual": two greyscale and four colour.
| Visual type | What it is | Description and usage |
| StaticGray | Preset ("static") range of greyscale shades |
|
| GrayScale | Configurable range of greyscale shades |
|
| StaticColor | Preset ("static") range of colour shades |
|
| PseudoColor | Configurable range of colour shades |
|
| TrueColor | Preset linear ramp of red, green and blue shades |
|
| DirectColor | Configurable ramps of red, green and blue shades |
|
What visuals does the Oasys LS-DYNA Environment use?
This depends upon the application, whether you are working in 2D or 3D, and what is available on the selected display.
T/HIS 2D "XY" plotting using X11 graphics only.
|
D3PLOT and PRIMER 3D graphics using OpenGL and X11.
|
How does OpenGL work with X11?
Initially the client process opens a conventional X11 connection with the server, then it requests a further OpenGL connection on top of this. Broadly speaking:
- The X11 server manages the windows themselves (sizing, placement, redraw requets), and all mouse and keyboard events.
- The OpenGL connection provides a parallel path for rendering high speed graphics in the window(s).
Where the graphics are being displayed on the local machine a "direct" OpenGL rendering connection is used to give the fastest possible graphics data transfer between client process and display. This bypasses the X11 server.
Where OpenGL graphics are being rendered over a network then an "indirect" OpenGL rendering connection is used:
- The remote X server must have the OpenGL/X (GLX) extension installed. If it doesn't have this the connection will be refused.
- X11 protocol requests are "overloaded" with OpenGL rendering data and sent to the remote server.
- The GLX extension in that server turns them into local rendering requests on the remote machine.
Using OpenGL over a network generates more traffic than "raw" X11 graphics. This isn't surprising: a coordinate in X11 is an (X,Y) data pair expressed as two "short" (16 bit) integers. The same coordinate in OpenGL is an (X,Y,Z) triplet expressed as 3 "floating" (32 bit) numbers - 3 times as much data. For this reason networked OpenGL graphics is best used with "objects" stored in the server, as this requires geometry information to be sent only once. "Objects" are described below.
What are OpenGL "objects"?
Normally OpenGL rendering requests are sent to the display, drawn and then forgotten. If the image needs to be redrawn, for example due to rotation, then the requests must be regenerated, resent, and so on. When rendering takes place on a local display, via a "direct" rendering connection, then this method gives the best trade-off between speed and memory consumption.
However if you are displaying remotely over a network then the continual re-transfer of the same data in order to draw successive frames is slow, and a method of storing the graphics data in the server would give an obvious efficiency gain. OpenGL "objects" provide this capability:
- Graphics data requests ("move to a point", "draw a line", "change colour", etc) are stored locally in an "object".
- To display that object again the only command required is "redraw the object".
- Redrawing from a stored object tends to be faster than from explicit requests.
If it is faster why don't all OpenGL applications use objects all the time, even when rendering locally?
- Objects use a lot of memory.
The application programmer has no control over how graphics data are stored in objects, and cannot therefore practise any storage economies that are made possible by their knowledge of how their data are organised.
It is not difficult to write a data storage scheme that is much (eg 2x or 3x) more compact than that afforded by objects. This translates into huge savings of memory which, if they stop the machine using virtual memory (swapping), more than offset any speed gains from using objects.
- Objects are slow to create initially.
The first pass, in which the data is sent to populate the object, is quite slow. This is a considerable price to pay if the image is only to be displayed once, as any savings only come from the 2nd and subsequent renderings of it.
Of the Oasys LS-DYNA Environment programs only D3PLOT permits the use of "objects" for data display, and it is recommended that this mode is used only when OpenGL graphics are being used on a remote server over a network. The default "vector" mode in D3PLOT, in which it manages the storage of its own graphics data "vectors", should be used on local displays.