| |||
| Classes - Annotated - Tree - Functions - Home - Structure | |||
The QGLColormap class is used for installing custom colormaps into widgets. More...
#include <qglcolormap.h>
QGLColormap provides a platform independent way of specifying and installing indexed colormaps into QGLWidgets. QGLColormap is especially useful when using the OpenGL color-index mode.
Under X11 you will have to use an X server that supports either a GrayScale, PseudoColor or DirectColor visual class. If your X server currently only provides a TrueColor, StaticColor or StaticGray visual, you will not be able to allocate colorcells for writing. If your X server does not provide one of the needed visuals, try setting up your X server in 8 bit mode. It should then provide a you with at least a PseudoColor visual. Note that you may experience colormap flashing if your X server is running in 8 bit mode.
Under Windows the size of the colormap is always set to 256 colors.
This class uses explicit sharing (see Shared Classes).
Example of use:
#include <qapplication.h>
#include <qglcolormap.h>
int main()
{
QApplication a( argc, argv );
MySuperGLWidget widget( 0 );
QGLColormap colormap;
// This will fill the colormap with colors ranging from
// black to white.
for ( int i = 0; i < colormap->size(); i++ )
colormap->setRgb( i, qRgb( i, i, i ) );
widget.setColormap( colormap );
widget.show();
return a.exec();
}
See also QGLWidget::setColormap() and QGLWidget::colormap().
The most common reason for a colormap to be invalid under X11, is that the X server does not support the visual class that is needed for a read/write colormap. An empty colormap (no color values set) is also considered to be invalid.
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.
| Copyright © 2000 Trolltech | Trademarks | Qt version main-beta1
|