PDA

View Full Version : < problem> supported OpenGL version by Qt



public
24th January 2011, 13:04
Неllo. I have the problem. I cannot get supported OpenGL version by Qt QtOpenGL module on the Windows XP. This must be 1.1 by WGL.



#include <QtGui>
#include <QIODevice>

void getOGLVersion();

int main(int argc, char** argv)
{
QApplication app(argc, argv);

getOGLVersion();

//...

return app.exec();
}

void getOGLVersion()
{
int i=(int)QGLFormat::openGLVersionFlags();

QFile f("info.txt");
f.open(QIODevice::WriteOnly);
QTextStream out(&f);
out << hex << i;
f.close();
}


I must get constant table number in OpenGLVersionFlag, but this constant does not exist in table. I get: "3f" on my platform. I need help...

For example, I have for OpenSuse 11.2 and other old computer: "1f". This value does not exist also in table of enum OpenGLVersionFlag. Why? Where is the error or?

public
24th January 2011, 16:45
?...?...?...

wysota
24th January 2011, 17:25
Why are you casting the flags to int? What do you expect to get? 0x3f indicates you have OpenGL 2.0 present. 0x1f is the same minus 0x20 which means OpenGL 1.5 is present.


OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags();
if(flags & QGLFormat::OpenGL_Version_1_5) qDebug() << "1.5 or higher";
if(flags & QGLFormat::OpenGL_Version_2_0) qDebug() << "2.0 or higher";
// etc.

public
24th January 2011, 18:21
I have understood. It is sum 0x01+0x02+0x04+0x08+0x10+0x20=0x3f
Thank you! :)