[Qt-interest] Saving image rendered in openGL widget in different resolutions
anjani gupta
anjanigupta_dce at yahoo.com
Mon Feb 16 12:24:28 CET 2009
Hi,
I tried using QGLWidget::renderPixmap( ), but I am getting black image, it does not display rendered widgets.
Code snippet:
<code>
QGLWidget* main_window;
//Assign value to main_window
...
main_window->raise();
main_window->repaint();
QPixmap image = main_window->renderPixmap(800,600);
image.save("filename","JPG"));
</code>
This saves an empty black image in 'filename.jpg'
Thanks in advance!
Regards,
Anjani
--- On Fri, 2/13/09, Fabio Dago <fabio.dago at sir.to.it> wrote:
From: Fabio Dago <fabio.dago at sir.to.it>
Subject: Re: [Qt-interest] Saving image rendered in openGL widget in different resolutions
To: anjanigupta_dce at yahoo.com, qt-interest at trolltech.com
Date: Friday, February 13, 2009, 9:02 PM
You can use this:
QPixmap QGLWidget::renderPixmap <qglwidget.html#renderPixmap> ( int w =
0, int h = 0, bool useContext = false )
Regards.
Fabio
anjani gupta ha scritto:
> Hi,
> I want to save openGL image rendered on main window in different file
formats with different resolutions.
> To save image in different format, I am using the following code:
> <code>
> QGLWidget* main_window;
> //Assign value to main_window
> ...
> main_window->raise();
> main_window->repaint();
> QPixmap image = QPixmap::grabWindow(main_window->winId());
> image.save("filename","TIF"));
> </code>
> I want to save image in different resolutions.Is there some efficient way
to save image in different resolutions?
> Thanks in advance!
> Regards,
> Anjani
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com Version: 8.0.234 / Virus Database:
270.10.23/1948 - Release Date: 02/12/09 07:20:00
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090216/626751ab/attachment.html
More information about the Qt-interest-old
mailing list