Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
documentation [2007/10/04 18:35]
admin
documentation [2016/01/18 17:58]
admin [Additional functions]
Line 9: Line 9:
 ==== Requirements ==== ==== Requirements ====
  
-Installer requires recent versions of [[http://​www.python.org|Python]] ​([[http://​www.python.org/​ftp/​python/​2.5.1/​python-2.5.1.msi|v2.5]])+Installer requires recent versions of [[http://​www.python.org|Python]],​ 
-[[http://​trolltech.com/​developer/​downloads/​qt/​windows|Qt]] ​([[ftp://​ftp.trolltech.com/​qt/​source/​qt-win-opensource-4.3.1-mingw.exe|v4.3.1]]) ​and [[http://​www.riverbankcomputing.co.uk/​pyqt/​download.php|PyQt]] ​([[http://​www.riverbankcomputing.com/​Downloads/​PyQt4/​GPL/​PyQt-Py2.5-gpl-4.3.1-1.exe|v4.3]]).+[[http://​trolltech.com/​developer/​downloads/​qt/​windows|Qt]] and [[http://​www.riverbankcomputing.co.uk/​pyqt/​download.php|PyQt]].
  
 To run the examples, you will have to install [[http://​sourceforge.net/​project/​showfiles.php?​group_id=5988&​package_id=6035|PyOpenGL]]. This last package uses [[http://​peak.telecommunity.com/​dist/​ez_setup.py|easy_install]] tool to be installed. To run the examples, you will have to install [[http://​sourceforge.net/​project/​showfiles.php?​group_id=5988&​package_id=6035|PyOpenGL]]. This last package uses [[http://​peak.telecommunity.com/​dist/​ez_setup.py|easy_install]] tool to be installed.
Line 22: Line 22:
 # installing PyOpenGL # installing PyOpenGL
 C:​\Python25\easy_install.exe PyOpenGL</​code>​ C:​\Python25\easy_install.exe PyOpenGL</​code>​
 +
 +
 +
 +
  
 ==== Install ==== ==== Install ====
  
-You can then simply install the ''​exe''​ installer that you can find [[http://​gforge.inria.fr/​frs/​download.php/​2247/​PyQGLViewer-0.1.0-Py2.5-Qt4.2.3-QGLViewer2.2.5-1.exe|here]] ​+On windows, you may simply install the last ''​exe''​ installer that you can find [[http://​gforge.inria.fr/​frs/​?​group_id=773|here]]. However, distribution are not frequent.
  
 To test it, you may launch examples [Start Menu]/​Programs/​PyQGLViewer/​examples. To test it, you may launch examples [Start Menu]/​Programs/​PyQGLViewer/​examples.
 +
 +You can look at the OpenAlea distribution of PyQGLViewer. See the [[http://​openalea.gforge.inria.fr/​|OpenAlea website]].
 +
 +In particular for Linux (Ubuntu mainly) you can install it this way:
 +<code bash>
 +sudo add-apt-repository ppa:​christophe-pradal/​openalea
 +sudo add-apt-repository ppa:​christophe-pradal/​vplants
 +sudo apt-get install pyqglviewer
 +</​code>​
 +
 +It will install a libQGLViewer package and PyQGLViewer. ​
 +
 +For windows,​after download and installing easy_install. You can type
 +<code bash>
 +easy_install -f http:://​openalea.geforge.inria.fr/​pi openalea.deploy
 +alea_install pyqglviewer
 +</​code>​
 +Or use the normal installation of openalea et vplants.
 +
 +This may changed in the future. So look at the OpenAlea documentation to have an update procedure.
  
 ===== How to build and install the project from sources ===== ===== How to build and install the project from sources =====
 +
 +
 +
 +As a first step, you need of course to download and unzip the [[http://​gforge.inria.fr/​frs/?​group_id=773|sources]] of ''​PyQGLViewer''​.
 +
 +Unzip the archive on your disk. For instance
 +<code bash>​unzip PyQGLViewer-x.x.zip </​code>​
 +
 +A directory ''​PyQGLViewer/''​ should be created.
  
  
Line 36: Line 69:
 ==== Requirements ==== ==== Requirements ====
  
-This project requires a recent version of SIP (tested with 4.5.2, 4.6 and 4.7), Qt4 and PyQt4.+This project requires a recent version of SIP, Qt4 and PyQt4.
  
 <note important> ​ <note important> ​
Line 44: Line 77:
 === Building a custom version of QGLViewer === === Building a custom version of QGLViewer ===
  
-First, you need to build a customized version of +To build ''​PyQGlViewer''​, you need to build a customized version of 
-libQGLViewer. Actually, it has been build from version 2.2.6-3. You should download a version of the sources:+libQGLViewer. You should ​first download a version of the sources:
  
 [[http://​artis.imag.fr/​~Gilles.Debunne/​QGLViewer/​download.html|http://​artis.imag.fr/​~Gilles.Debunne/​QGLViewer/​download.html]] [[http://​artis.imag.fr/​~Gilles.Debunne/​QGLViewer/​download.html|http://​artis.imag.fr/​~Gilles.Debunne/​QGLViewer/​download.html]]
- 
-for linux, archive is: 
-[[http://​artis.imag.fr/​Members/​Gilles.Debunne/​QGLViewer/​src/​libQGLViewer-2.2.6-3.tar.gz|http://​artis.imag.fr/​Members/​Gilles.Debunne/​QGLViewer/​src/​libQGLViewer-2.2.6-3.tar.gz]] 
- 
-and for windows 
-[[http://​artis.imag.fr/​Members/​Gilles.Debunne/​QGLViewer/​src/​libQGLViewer-2.2.6-3.zip 
-|http://​artis.imag.fr/​Members/​Gilles.Debunne/​QGLViewer/​src/​libQGLViewer-2.2.6-3.zip]] 
  
 Unzip the archive on your disk. For instance Unzip the archive on your disk. For instance
-<code bash>tar xvzf libQGLViewer-2.2.x-x.tar.gz </​code>​+<code bash>tar xvzf libQGLViewer-x.x.x.tar.gz </​code>​
  
-A directory ''​libQGLViewer-2.2.x-x''​ should be created+A directory ''​libQGLViewer-x.x.x''​ should be created. You have to compile the sources it. To be compatible with SIP, 
 +you first need to patch these sources. ​
  
-The patch file ''​libQGLViewer-2.2.x-x-py.patch''​ can been found in ''​PyQGLViewer/​src''​ dir. +The patch file ''​libQGLViewer-x.x.x-py.patch''​ can been found in ''​PyQGLViewer/​src''​ dir. 
  
 <note info> ​ <note info> ​
 For info, it has been build with the following command For info, it has been build with the following command
-<code bash>​diff -abur libQGLViewer-2.2.x-x libQGLViewer-2.2.x-x-py > libQGLViewer-2.2.x-x-py.patch </​code>​+<code bash>​diff -abur ../​libQGLViewer-x.x.x > libQGLViewer-x.x.x-py.patch </​code>​
  
 For windows, the ''​patch''​ and ''​diff''​ tools can in the [[http://​gnuwin32.sourceforge.net/​packages.html|gnuwin32 project]] For windows, the ''​patch''​ and ''​diff''​ tools can in the [[http://​gnuwin32.sourceforge.net/​packages.html|gnuwin32 project]]
Line 71: Line 98:
 </​note>​ </​note>​
  
-To apply this patch, you should go in the parent directory of ''​libQGLViewer-2.2.x-x''​+To apply this patch, you should go in the parent directory of ''​libQGLViewer-x.x.x''​
 and invoke the command and invoke the command
-<code bash>​patch -p 0 PyQGLViewer/​src/​libQGLViewer-2.2.x-x-py.patch </​code>​+<code bash>cd libQGLViewer-x.x.x 
 +patch -p 0 -i ../PyQGLViewer/​src/​libQGLViewer-x.x.x-py.patch ​ </​code>​ 
 + 
 +<note important>​  
 +The patch file has been built on windows sources. The end of line character is different on unix systems. 
 +On linux, you may thus have to convert first the patch file to unix convention with the following comand. 
 + 
 +<code bash>​dos2unix libQGLViewer-x.x.x-py.patch </code
 + 
 +</​note>​ 
 + 
 +<​note>​  
 +Previous patches with lower versions than 2.3.4 where built from above repository. Thus to apply them you had to call 
 +<code bash>​patch -p 0 -i PyQGLViewer/​src/​libQGLViewer-x.x.x-py.patch ​ </​code>​ 
 +However they were not reusable from one version to the other. 
 +</note>
  
 Source are now ready to compile. ​ Source are now ready to compile. ​
-Go into ''​libQGLViewer-2.2.x-x/​QGLViewer''​ dir +Go into ''​libQGLViewer-x.x.x/​QGLViewer''​ dir 
-<code bash>cd libQGLViewer-2.2.x-x/QGLViewer+<code bash>cd libQGLViewer-x.x.x/QGLViewer
 qmake-qt4 QGLViewer.pro qmake-qt4 QGLViewer.pro
 make         # or nmake make         # or nmake
Line 83: Line 125:
 </​code>​ </​code>​
 On windows to install the lib you should copy the ''​QGLViewer2.dll''​ On windows to install the lib you should copy the ''​QGLViewer2.dll''​
-in library repository such as ''​C:\WINDOWS\system32''​+in library repository such as ''​%QTDIR%\bin''​ 
 + 
 +<code bash>​copy release\QGLViewer2.dll %QTDIR%\bin 
 +copy release\QGLViewer2.lib %QTDIR%\lib 
 +</​code>​
  
-To have designer plugin (required if you will used pyuic), you should go to ''​libQGLViewer-2.2.x-x/​designerPlugin''​+To have designer plugin (required if you will used pyuic), you should go to ''​libQGLViewer-x.x.x/​designerPlugin''​
 and invoke similar command and invoke similar command
 <code bash>cd ../​designerPlugin <code bash>cd ../​designerPlugin
Line 94: Line 140:
  
 libQGLViewer is now compiled and usable. libQGLViewer is now compiled and usable.
- 
- 
  
  
Line 105: Line 149:
  
 You should be root on linux to make it work. You can specify the  You should be root on linux to make it work. You can specify the 
-source repository of ''​libQGLViewer-2.2.x-x''​ with ''​-Q''​ option.+source repository of ''​libQGLViewer-x.x.x''​ with ''​-Q''​ option.
 For instance ​ For instance ​
-<code bash>​python configure.py -Q ../​libQGLViewer-2.2.x-x </​code>​+<code bash>​python configure.py -Q ../​libQGLViewer-x.x.x </​code>​
  
 <​note>​ You may specify extra include and lib directories with -I and -L flags <​note>​ You may specify extra include and lib directories with -I and -L flags
-<code bash>​python configure.py -Q ../​libQGLViewer-2.2.x-x -I /​extra/​inc/​dir -L /​extra/​lib/​dir+<code bash>​python configure.py -Q ../​libQGLViewer-x.x.x -I /​extra/​inc/​dir -L /​extra/​lib/​dir
 </​code>​ </​code>​
 </​note>​ </​note>​
Line 119: Line 163:
 </​code>​ </​code>​
  
-You can then test the new module with all examples 
-that you'll find in the directory ''​PyQGLViewer/​examples''​. 
  
-Good luck.+==== Testing PyQGLViewer ====
  
 +Once installed, you may want to see if your build work. 
  
 +You can find classic examples of ''​libQGLViewer''​ translated for python and ''​PyQGLViewer'' ​
 +in the directory ''​PyQGLViewer/​examples/''​. To test them, go in that directory and invoke for instance
 +
 +<code bash>​python simpleViewer.py</​code>​
 +
 +To test integration in ''​designer'':​
 +
 +<code bash>​python interface.py</​code>​
 +
 +To test texture 3D:
 +
 +<code bash>​python texture3D.py</​code>​
 +
 +Enjoy.
  
  
Line 161: Line 218:
 We plan to generate and present a complete python API documentation of the library ​ We plan to generate and present a complete python API documentation of the library ​
 that integrates all these details in the future. that integrates all these details in the future.
 +
 +
  
  
Line 186: Line 245:
 === Version === === Version ===
  
-You can check the version of the QGLViewer with global hexadecimal value ''​QGLViewerVersion''​.+You can check the version of the QGLViewer with the global hexadecimal value ''​QGLViewerVersion''​.
 Moreover, the following convenience function gives the version as a string: Moreover, the following convenience function gives the version as a string:
  
Line 192: Line 251:
     """​ Return version of QGLViewer in a string format """</​code>​     """​ Return version of QGLViewer in a string format """</​code>​
  
 +You can also check the version of the wrappers with the global hexadecimal value ''​_ _version_ _''​
 +or the function ''​PyQGLViewerVersionString''​ for the string version.
 +
 +
 +=== Texture3D ===
 +
 +Creating 3D textures requires to manipulate memory buffer. This is not very compatible with Python
 +high level phylosophy. So we implement the binding of a list of QImage as a 3D texture.
 +
 +<code python>​def QGLViewer.bindTexture3D([QImage] images, target = GL_TEXTURE_3D,​ format = GL_RGBA):
 +    """​ Generates and binds a 3D GL texture construct from a list of QImage """​
 +    Return texture id </​code>​
 +
 +The generated texture id is returned and can be used in later ''​glBindTexture()''​ calls. ​
 +
 +The target parameter specifies the texture target. The default target is ''​GL_TEXTURE_3D''​.
 +
 +The format parameter sets the internal format for the texture. The default format is ''​GL_RGBA8''​.
  
 +No mipmap generation is supported. And, in opposite to ''​QGLWidget.bindTexture''​ function, the 3D texture which
 +is generated here is not cached. It have to be deleted at the end with ''​glDeleteTexture([id])''​.
  
 
Back to top
documentation.txt · Last modified: 2016/01/25 16:35 by admin
Valid CSS Driven by DokuWiki Valid XHTML 1.0