Rendering the contents of a QGLWidget into a high resolution image

Zein Salah <[email protected]>
Newsgroups gmane.games.devel.opengl
Organization Fat City Network Services, San Diego, California
Message-ID <[email protected]>
Hello, 

My vewier renders models in a QGLWidget. what I want is to render the
current contents of the QGLWidget into a high resolution image and
save it to disk. I tried this by rendering into a QPixmap as follows:


QGLWidget *drawArea = m_QGLViewer->getDrawArea();
   QPixmap pix = drawArea->renderPixmap ( 1000, 1000, false );
   QImage img = pix.convertToImage();


   QFileDialog mQFileDialog;
   mQFileDialog.setMode(QFileDialog::AnyFile);
   QString s = mQFileDialog.getSaveFileName( "d:/", "Images (*.bmp);;
*.*", this ) ;
    if ( !s.isEmpty() ) {
       const char  *fName = s.latin1();
       if (fName != 0) 
          img.save(fName,"BMP",100);       
   }



m_QGLViewer is my viewer.
m_QGLViewer->getDrawArea() returns the QGLQidget where rendering occurs.


UNFORTUNATELY, I am getting only a white image!!! could anybody
perhapse guess what the error is? Does any body habe a better idea to
achieve the goal?


Many thanks,
yein
----- 
FAQ and OpenGL Resources at:
  http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

-- 
Author: Zein Salah
  INET: [email protected]

Fat City Hosting, San Diego, California -- http://www.fatcity.com
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [email protected] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.