Without debugging code is not executed ?!?
-
Hi
I'm playing with QtOpenGL examples. I've changed Hello world example to:@GLWidget::GLWidget(QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
format().setProfile(QGLFormat::CoreProfile);
format().setVersion(4,0);
cout << format().profile()<<endl;
cout << "HIIIIIII!!!!!!!!!!!!!" << endl;@Now when I set trap before format().set.... it execute also couts (sic!) before it stops.
And if I do not set trap whole code is not executed at all. (strings are not send to cout).What is wrong?
PS How to set version of OGL in constructor of QGLWidget? Above code do not work (format().profile() return 0 -> no OGL3+)
Win7, ati hd 5720 with catalyst 10.9, OGL 4.0 working
-
I think, your app is not a console app, right? If it is not, cout will not be send to commandline (not on windows, don't know exactly on Linux).
I'm pretty sure, your code is executed. -
[quote author="przemo_li" date="1292506244"]Hi
I'm playing with QtOpenGL examples. I've changed Hello world example to:@GLWidget::GLWidget(QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
format().setProfile(QGLFormat::CoreProfile);
format().setVersion(4,0);
cout << format().profile()<<endl;
cout << "HIIIIIII!!!!!!!!!!!!!" << endl;@Now when I set trap before format().set.... it execute also couts (sic!) before it stops.
And if I do not set trap whole code is not executed at all. (strings are not send to cout).What is wrong?
PS How to set version of OGL in constructor of QGLWidget? Above code do not work (format().profile() return 0 -> no OGL3+)
Win7, ati hd 5720 with catalyst 10.9, OGL 4.0 working[/quote]
Under windows
@
CONFIG += console
@
in your .pro file to link against console libraries. Moreover, I don't get what you're trying to do there: format() returns the current format by value, it's pointless to call setters on it. -
[quote author="Gerolf Reinwardt" date="1292506462"]I think, your app is not a console app, right? If it is not, cout will not be send to commandline (not on windows, don't know exactly on Linux).[/quote]On Linux the text will be sent to stdout. Whether it's shown or not depends on whether the program is started from console or not.
-
Yes, but also in windows without use a console.
If you run a gui in qtcreator and in the code write some printf() function in output of qtcreator you see the printf() output.[quote author="Franzk" date="1292532802"]
[quote author="Gerolf Reinwardt" date="1292506462"]I think, your app is not a console app, right? If it is not, cout will not be send to commandline (not on windows, don't know exactly on Linux).[/quote]On Linux the text will be sent to stdout. Whether it's shown or not depends on whether the program is started from console or not.
[/quote] -
[quote]format() returns the current format by value, it's pointless to call setters on it.[/quote]
That means you have to
@GLWidget::GLWidget(QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
QGLFormat f = format();
f.setProfile(QGLFormat::CoreProfile);
f.setVersion(4,0);
setFormat(f);
...
}@ -
bq. Stuk wrote:
Yes, but also in windows without use a console.
If you run a gui in qtcreator and in the code write some printf() function in output of qtcreator you see the printf() output.QtCreator connects to stdout of the process. That is always possible if you start processes,a slo with QProcess. But on a windows console, if you start non console apps, the console does not connect to the stdout as it just creates the process and gets back to the console.
-
@QGLFormat f = format();
f.setProfile(QGLFormat::CoreProfile);
f.setVersion(4,0);
setFormat(f);@Works :)
cout do not :( (only when debugging)
@CONFIG+= console@
Make no effect.Anyway I'll try Qt way to log errors. And now I know how to set OGL properly.
Thx to all. -
QtOpenGl depends on QtGui libs. The console option strips the latter out.
-
[quote author="Volker" date="1292586765"]QtOpenGl depends on QtGui libs. The console option strips the latter out.[/quote]Probably fixable by doing @QT += gui@ then.