source: trunk/doc/html/opengl-x11-overlays.html@ 203

Last change on this file since 203 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 5.9 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/opengl-x11-overlays.doc:36 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>How to use X11 overlays with the Qt OpenGL extension</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>How to use X11 overlays with the Qt OpenGL extension</h1>
33
34
35
36<p> X11 overlays are a powerful mechanism for drawing
37annotations etc., on top of an image without destroying it, thus saving
38a great deal of image rendering time. For more information, consult the highly
39recommended book <em>OpenGL Programming for the X Window System</em> (Mark
40Kilgard, Addison Wesley Developers Press 1996).
41<p> <b>Warning:</b> From version 5.0 onwards, the Qt OpenGL Extension includes
42direct support for the use of OpenGL overlays. For many uses of
43overlays, this makes the technique described below redundant. See the
44<a href="opengl-overlay-example.html">overlay</a> example program. The
45following is a discussion on how to use non-QGL widgets in overlay
46planes.
47<p> In the typical case, X11 overlays can easily be used together with the
48current version of Qt and the Qt OpenGL Extension. The following
49requirements apply:
50<p> <ol type=1>
51<li> Your X server and graphics card/hardware must support overlays.
52For many X servers, overlay support can be turned on with
53a configuration option; consult your X server installation
54documentation.
55<p> <li> Your X server must (be configured to) use an overlay visual as the
56default visual. Most modern X servers do this, since this has the
57added advantage that pop-up menus, overlapping windows etc., will
58<em>not</em> destroy underlying images in the main plane, thereby
59avoiding expensive redraws.
60<p> <li> The best (deepest) visual for OpenGL rendering is in the main
61plane. This is the normal case. Typically, X servers that support
62overlays provide a 24 bit deep TrueColor visual in the main plane,
63and an 8 bit PseudoColor (default) visual in the overlay plane.
64</ol>
65<p> The provided example program <a href="opengl-overlay-example.html">X11
66overlay</a> will check for these and report if anything is wrong.
67See <a href="#x11visuals">About X11 Visuals</a>, below for more
68information.
69<p> <h2> How it works
70</h2>
71<a name="1"></a><p> Given the above, a <a href="qglwidget.html">QGLWidget</a> will by default use the main plane
72visual, while all other widgets will use the overlay visual. Thus, we
73can place a normal widget on top of the QGLWidget, and do drawing on
74it, without destroying the image in the OpenGL window. In other words,
75we can use all the drawing capabilities of <a href="qpainter.html">QPainter</a> to draw the
76annotations, rubberbands, etc. For the typical use of overlays,
77this is much easier than using OpenGL for rendering the annotations.
78<p> An overlay plane has a specific color called the transparent
79color. Pixels drawn in this color will not be visible; instead the
80underlying OpenGL image will show through. In the example program
81<a href="opengl-overlay-example.html">X11 overlay</a>, the file
82<tt>main.cpp</tt> contains a routine that returns a <a href="qcolor.html">QColor</a> containing the
83transparent color. For the overlay widget, you will typically want to
84set the background color to the transparent color, so that the OpenGL
85image shows through except where explicitly overpainted.
86<p> Note: to use this technique, you must not use the "ManyColor" or
87"TrueColor" ColorSpec for <a href="qapplication.html">QApplication</a>, because this will force
88the normal Qt widgets to use a TrueColor visual, which will typically
89be in the main plane, not in the overlay plane as desired.
90<p> <a name="x11visuals"></a>
91<h2> About X11 visuals
92</h2>
93<a name="2"></a><p> The utilities directory contains two small programs that can help you
94determine the capabilities of your X server. These programs are from
95the OpenGL book mentioned above, see utilities/NOTICE for copyright
96information. The full set of example programs from this book is
97available at <a href="ftp://ftp.sgi.com/pub/opengl/opengl_for_x/">ftp://ftp.sgi.com/pub/opengl/opengl_for_x/</a>.
98<p> <tt>glxvisuals</tt> will list all the GL-capable visuals the X server
99provides, together with the depth and other GL-specific information
100for each. Note especially the column "lvl"; a number in this column
101means the visual is in an overlay plane.
102<p> <tt>sovinfo</tt> will list all available visuals, and provides special
103transparency information for overlay visuals.
104<p> The <a href="opengl-overlay-example.html">X11 overlay</a> example
105program will output what visual is used for the normal Qt widgets, and
106what visual is used by the <a href="qglwidget.html">QGLWidget</a>.
107<p>
108<!-- eof -->
109<p><address><hr><div align=center>
110<table width=100% cellspacing=0 border=0><tr>
111<td>Copyright &copy; 2007
112<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
113<td align=right><div align=right>Qt 3.3.8</div>
114</table></div></address></body>
115</html>
Note: See TracBrowser for help on using the repository browser.