#define GL_CLAMP_TO_EDGE 0x812FOpenGLWidget::OpenGLWidget(QWidget *parent) : QGLWidget(parent){ setMouseTracking(true); QSettings settings("settings.conf", QSettings::IniFormat); Scale_frequency = settings.value(VER + "GUI/Scale_frequency", 0.395734).toFloat(); Scale_dBm = settings.value(VER + "GUI/Scale_dBm", 34.4251).toFloat(); Translate_frequency = settings.value(VER + "GUI/Translate_frequency", -3.72921).toFloat(); Translate_dBm = settings.value(VER + "GUI/Translate_dBm", 12.1542).toFloat(); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updt())); timer->start(40.0);}OpenGLWidget::~OpenGLWidget(){ }void OpenGLWidget::initializeGL(){ glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglClearColor(QColor(100.0, 100.0, 100.0)); // Light values and coordinates glEnable(GL_DEPTH_TEST); // Hidden surface removal // Сглаживание точек glEnable(GL_POINT_SMOOTH); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); // Generate texture textureID[0] = bindTexture(QPixmap(QString("69383_1310988233_picture1.jpg")), GL_TEXTURE_2D); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glEnable(GL_TEXTURE_2D);}void OpenGLWidget::resizeGL(int nWidth, int nHeight){ Client_Width = nWidth; Client_Height = nHeight; glViewport(0, 0, Client_Width, Client_Height);//set field of view glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, Client_Width, 0, Client_Height, 1, - 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity();}void OpenGLWidget::paintGL(){ qglClearColor(QColor(100.0, 100.0, 100.0)); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, Client_Width, 0, Client_Height, 1, -1); // glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(1.0, 1.0, 1.0, 1.0); glBindTexture(GL_TEXTURE_2D, textureID[0]); glBegin (GL_QUADS); glTexCoord2f(0.0, 0.0); glVertex2f (0.0, 0.0); glTexCoord2f(1.0, 0.0); glVertex2f (128.0, 0.0); glTexCoord2f(1.0, 1.0); glVertex2f (128.0, 128.0); glTexCoord2f(0.0, 1.0); glVertex2f (0.0, 128.0); glEnd(); swapBuffers();}