Re: [info-performer] glReadPixels

Date view Thread view Subject view Author view

From: Benedikt Kessler (bjk++at++munich.sgi.com)
Date: 09/06/2004 02:49:13


Bonjour!

Probably you should replace GL_UNPACK_ALIGNMENT by GL_PACK_ALIGNMENT if the WriteImage function does not accept any gaps between the lines (which I assume due to the memory allocation you're doing).

Also does the size of your viewport (that was probably set byglViewport) match the size you get from your _viewer? Probably you want to use the width/height (and offsets) of your viewport.

Also you don't need the glFinish call.

Bye! Benedikt

Myriam Lajon wrote:
>
> I try to create images from buffer
> I use Performer 3.1.1.
>
> Images created are ok if I do not resize the window. If I do, it's like the
> row size is different from the real size or the first pixel is not at the
> right place! :
>
> --/-----
> -/-----/
> /-----/- (one or two lines cross the image)
>
> Here is my code : (called before or after swap buffer is done, result is the
> same)
> Call at each step:
>
> glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
>
> // window size
> int x = _viewer->GetWidth();
> int y = _viewer->GetHeight();
>
> glPixelStorei(GL_PACK_ROW_LENGTH,x);
>
> int val = 3*(x+1)*(y+1);
> char * pixels = new char[val];
>
> glReadBuffer(GL_FRONT);
> glFinish();
> glReadPixels (0, 0, x, y, GL_RGB, GL_UNSIGNED_BYTE, pixels);
>
> // method call to create image in RGB format
> (*WriteImage)(name,(unsigned char*)pixels,x,y,3);
>
> pixels = 0;
> delete [] pixels;
>
> Thanks for help
> Myriam
>
> -----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
> -----------------------------------------------------------------------

-- 
+---------------------------------+----------------------------------+
|Benedikt J. Kessler              | Silicon Graphics GmbH            |
|Advanced Media Products          | Am Hochacker 3 - Technopark      |
|SGI                              | 85630 Grasbrunn-Neukeferloh, FRG |
|    ---  __o       ,__o          |                                  |
| ------_ \<,_    _-\_<,          | Phone: (+49) 89 46108-366 or -0  |
|----- (*)/ (*)  (*)/'(*)         | Fax:   (+49) 89 46107-366        |
+---------------------------------+----------------------------------+
|E-Mail: bjk++at++sgi.com            Web (private): http://sgiweb.org/bjk |
|   Web: http://www.sgi.de                                           |
+--------------------------------------------------------------------+


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Sep 06 2004 - 02:49:45 PDT