⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opengl-x11-overlays.html

📁 QT 下载资料仅供参考
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/doc/opengl-x11-overlays.doc:1 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>How to use X11 overlays with the Qt OpenGL extension</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><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><p> <p> X11 overlays are a powerful mechanism for drawingannotations etc., on top of an image without destroying it, thus savinga great deal of image rendering time. For more information, consult the highlyrecommended book <em>OpenGL Programming for the X Window System</em> (MarkKilgard, Addison Wesley Developers Press 1996).<p> <b>Warning:</b> From version 5.0 onwards, the Qt OpenGL Extension includesdirect support for the use of OpenGL overlays. For many uses ofoverlays, this makes the technique described below redundant. See the<a href="opengl-overlay-example.html">overlay</a> example program. Thefollowing is a discussion on how to use non-QGL widgets in overlayplanes.<p> In the typical case, X11 overlays can easily be used together with thecurrent version of Qt and the Qt OpenGL Extension. The followingrequirements apply:<p> <ol type=1><li> Your X server and graphics card/hardware must support overlays. For many X servers, overlay support can be turned on witha configuration option; consult your X server installationdocumentation.<p> <li> Your X server must (be configured to) use an overlay visual as thedefault visual. Most modern X servers do this, since this has theadded advantage that pop-up menus, overlapping windows etc., will<em>not</em> destroy underlying images in the main plane, therebyavoiding expensive redraws.<p> <li> The best (deepest) visual for OpenGL rendering is in the mainplane. This is the normal case. Typically, X servers that supportoverlays provide a 24 bit deep TrueColor visual in the main plane,and an 8 bit PseudoColor (default) visual in the overlay plane.</ol><p> The provided example program <a href="opengl-overlay-example.html">X11overlay</a> will check for these and report if anything is wrong. See <a href="#x11visuals">About X11 Visuals</a>, below for moreinformation.<p> <h2> How it works</h2><a name="1"></a><p> Given the above, a <a href="qglwidget.html">QGLWidget</a> will by default use the main planevisual, while all other widgets will use the overlay visual. Thus, wecan place a normal widget on top of the QGLWidget, and do drawing onit, without destroying the image in the OpenGL window. In other words,we can use all the drawing capabilities of <a href="qpainter.html">QPainter</a> to draw theannotations, rubberbands, etc. For the typical use of overlays,this is much easier than using OpenGL for rendering the annotations.<p> An overlay plane has a specific color called the transparentcolor. Pixels drawn in this color will not be visible; instead theunderlying OpenGL image will show through. In the example program<a href="opengl-overlay-example.html">X11 overlay</a>, the file<tt>main.cpp</tt> contains a routine that returns a <a href="qcolor.html">QColor</a> containing thetransparent color. For the overlay widget, you will typically want toset the background color to the transparent color, so that the OpenGLimage shows through except where explicitly overpainted.<p> Note: to use this technique, you must not use the "ManyColor" or"TrueColor" ColorSpec for <a href="qapplication.html">QApplication</a>, because this will forcethe normal Qt widgets to use a TrueColor visual, which will typicallybe in the main plane, not in the overlay plane as desired.<p> <a name="x11visuals"></a><h2> About X11 visuals</h2><a name="2"></a><p> The utilities directory contains two small programs that can help youdetermine the capabilities of your X server. These programs are fromthe OpenGL book mentioned above, see utilities/NOTICE for copyrightinformation. The full set of example programs from this book isavailable at <a href="ftp://ftp.sgi.com/pub/opengl/opengl_for_x/">ftp://ftp.sgi.com/pub/opengl/opengl_for_x/</a>.<p> <tt>glxvisuals</tt> will list all the GL-capable visuals the X serverprovides, together with the depth and other GL-specific informationfor each. Note especially the column "lvl"; a number in this columnmeans the visual is in an overlay plane.<p> <tt>sovinfo</tt> will list all available visuals, and provides specialtransparency information for overlay visuals.<p> The <a href="opengl-overlay-example.html">X11 overlay</a> exampleprogram will output what visual is used for the normal Qt widgets, andwhat visual is used by the <a href="qglwidget.html">QGLWidget</a>.<p> <!-- eof --><p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright &copy; 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -