Re: glDrawPixels speed.

New Message Reply Date view Thread view Subject view Author view

Rob Jenkins (robj++at++quid)
Fri, 31 Jan 1997 10:44:29 -0800


Steve - if this doesn't cover some specific case you have, let me know. I
'spect GL_RGBA and some glDisables will help.

Allen Akin put this in the FAQs, it covers all platforms so can serve as
reference to all ( actually it's the answer to 'Why is OpenGL's glDrawPixels
slower than IrisGL's lrectwrite?' but covers Steve's question:

-----------------------------
Q:'Why is OpenGL's glDrawPixels slower than IrisGL's lrectwrite?'

A:It's not, for the most common cases. After all, similar microcode and the
same hardware are used for both commands. However, there are three issues to
keep in mind.

First, some midrange and low-end SGI graphics adaptors (particularly XS, XZ,
Elan, and Extreme) transfer ABGR-ordered images much faster than they transfer
RGBA-ordered images. The normal image format in IrisGL was ABGR, while in
OpenGL it's RGBA. So to achieve the same performance in OpenGL that you did in
IrisGL on those machines, you need to use ABGR-format images in OpenGL. The
ABGR extension available in Irix 5.3 and later releases allows you to do this.
See ``man glintro'' for background information on using OpenGL extensions, and
``man gldrawpixels'' for details on ABGR. Note that RealityEngine, IMPACT, and
all future machines will process RGBA data at least as fast as ABGR, so RGBA is
the way to go for new code.

Second, some OpenGL pixel data types are faster than others. For most machines,
unsigned byte RGBA (or ABGR) is the fastest full-color type. Unsigned byte and
unsigned short are usually the fastest gray-scale types. Signed integer types
are slower.

Third, OpenGL pixel operations have a much richer set of features than IrisGL,
and if any of those features are enabled, then image transfer can be
significantly slower. Always disable the features that you don't need. The
following code fragment disables features that are likely to make glDrawPixels
slow:

/* * Disable stuff that's likely to slow down glDrawPixels. * (Omit as much of
this as possible, when you know in advance * that the OpenGL state will already
be set correctly.) */
glDisable(GL_ALPHA_TEST); glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST);
glDisable(GL_DITHER); glDisable(GL_FOG); glDisable(GL_LIGHTING);
glDisable(GL_LOGIC_OP); glDisable(GL_STENCIL_TEST); glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D); glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
glPixelTransferi(GL_RED_SCALE, 1); glPixelTransferi(GL_RED_BIAS, 0);
glPixelTransferi(GL_GREEN_SCALE, 1); glPixelTransferi(GL_GREEN_BIAS, 0);
glPixelTransferi(GL_BLUE_SCALE, 1); glPixelTransferi(GL_BLUE_BIAS, 0);
glPixelTransferi(GL_ALPHA_SCALE, 1); glPixelTransferi(GL_ALPHA_BIAS, 0);

/* * Disable extensions that could slow down glDrawPixels. * (Actually, you
should check for the presence of the proper * extension before making these
calls. I've omitted that * code for simplicity.) */

#ifdef GL_EXT_convolution glDisable(GL_CONVOLUTION_1D_EXT);
glDisable(GL_CONVOLUTION_2D_EXT); glDisable(GL_SEPARABLE_2D_EXT); #endif

#ifdef GL_EXT_histogram glDisable(GL_HISTOGRAM_EXT);
glDisable(GL_MINMAX_EXT); #endif

#ifdef GL_EXT_texture3D glDisable(GL_TEXTURE_3D_EXT); #endif

-- 
________________________________________________________________
Rob Jenkins mailto:robj++at++csd.sgi.com
Silicon Graphics, Mtn View, California, USA
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:54:30 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.