Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

The QGLColormap class is used for installing custom colormaps into aQGLWidget.More...

Detailed Description

QGLColormap provides a platform independent way of specifying and installing indexed colormaps for aQGLWidget. QGLColormap is especially useful when using theOpenGL color-index mode.

Under X11 you must use an X server that supports either aPseudoColor orDirectColor visual class. If your X server currently only provides aGrayScale,TrueColor,StaticColor orStaticGray visual, you will not be able to allocate colorcells for writing. If this is the case, try setting your X server to 8 bit mode. It should then provide you with at least aPseudoColor visual. Note that you may experience colormap flashing if your X server is running in 8 bit mode.

The size() of the colormap is always set to 256 colors. Note that under Windows you can also install colormaps in child widgets.

This class usesimplicit sharing as a memory and speed optimization.

Example of use:

#include <QApplication>#include <QGLColormap>int main(int argc,char*argv[]){QApplication app(argc, argv);    MySuperGLWidget widget;// a QGLWidget in color-index modeQGLColormap colormap;// This will fill the colormap with colors ranging from// black to white.constint size=256;for (int i=0; i< size;++i)        colormap.setEntry(i,qRgb(i, i, i));    widget.setColormap(colormap);    widget.show();return app.exec();}

See alsoQGLWidget::setColormap() andQGLWidget::colormap().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp