Article View: comp.windows.x
Article #38299Re: Having hard time using XGetImage with glDrawPixels in OpenGL
From: Michael I. Gold
Date: Mon, 19 May 1997 00:00
Date: Mon, 19 May 1997 00:00
29 lines
2178 bytes
2178 bytes
Shuky Rosinger <rosinger@numbat.cs.rmit.edu.au> writes: | Hi all, | | I am having a very hard time drawing pixel data with glDrawPixels onto | an OpenGL scene. I use glDrawPixels with GL_RGB, GL_UNSIGNED_BYTE. The | image is retrieved with XGetImage. | | The resulting image in the OpenGL scene is somehow not synchronized (has | the effect of a TV has bad horizontal sync or vertical sync). A few things to check: 1) Pixel data has a default per-row alignment of 4 bytes; hence RGB data might be misaligned per-row, giving the image a "sheared" appearence. Try setting: glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 2) The format returned by XGetImage may not be what you expect - always check the red_mask, green_mask, and blue_mask fields to see the pixel layout. You may have to reformat the data. I would expect a 16-bit drawable to return data in 2 bytes per pixel, so you'll have to extract and expand the data to fit unsigned byte RGB format. -- Michael I. Gold Silicon Graphics Inc. http://reality.sgi.com/gold And my mama cried, "Nanook a no no! Don't be a naughty eskimo! Save your money, don't go to the show!" Well I turned around and I said, "Ho! Ho!"
Technical Details
Message-ID:
<5lpugl$gqg@fido.asd.sgi.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<337FFE27.E564C73@numbat.cs.rmit.edu.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f6cac,610edefeb235a8b3 X-Google-Attributes: gidf6cac,public X-Google-Thread: 1667f1,610edefeb235a8b3 X-Google-Attributes: gid1667f1,public X-Google-Thread: 103734,610edefeb235a8b3 X-Google-Attributes: gid103734,public X-Google-Thread: 1082b0,610edefeb235a8b3 X-Google-Attributes: gid1082b0,public X-Google-Thread: f65bb,610edefeb235a8b3 X-Google-Attributes: gidf65bb,public X-Google-Thread: f4bda,610edefeb235a8b3 X-Google-Attributes: gidf4bda,public From: Michael I. Gold <gold@asd.sgi.com.spam-free> Subject: Re: Having hard time using XGetImage with glDrawPixels in OpenGL Date: 1997/05/19 Message-ID: <5lpugl$gqg@fido.asd.sgi.com> X-Deja-AN: 242418876 References: <337FFE27.E564C73@numbat.cs.rmit.edu.au> Organization: Silicon Graphics, Inc. Mountain View, CA Newsgroups: comp.windows.x,comp.os.linux.x,comp.graphics.api.opengl,comp.windows.x.i386unix,fj.windows.x,de.comp.os.linux.x