PDA

View Full Version : I want to write to console



8Observer8
7th August 2014, 17:27
Hi,

I build my application how "release" and add all .dll's. When I run my application from console I don't see ouput:




#include <QGLFormat>
#include <QGLWidget>
#include <QString>
#include <iostream>
#include <QApplication>

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

std::cout << "Hello" << std::endl;
fflush(stdout);

QGLFormat format;
format.setVersion( 4, 3 );
QGLFormat::setDefaultFormat( format );

QGLWidget w;
w.makeCurrent();

QString vendor( QLatin1String( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) ) );
std::cout << "Vendor: " << vendor.toStdString() << std::endl;

QString renderer( QLatin1String( reinterpret_cast<const char*>( glGetString( GL_RENDERER ) ) ) );
std::cout << "Renderer: " << renderer.toStdString() << std::endl;

QString versionOfGL( QLatin1String(reinterpret_cast<const char*>( glGetString( GL_VERSION ) ) ) );
std::cout << "Version: " << versionOfGL.toStdString() << std::endl;

QString versionGLSL( QLatin1String(reinterpret_cast<const char*>( glGetString( GL_SHADING_LANGUAGE_VERSION ) ) ) );
std::cout << "GLSL: "<< versionGLSL.toStdString() << std::endl;

return app.exec();
}

anda_skoa
7th August 2014, 18:51
Since you wrote .dll I assume you are on Windows.
Have you added


CONFIG += console

to your .pro file?

Cheers,
_

8Observer8
7th August 2014, 19:21
Yes, it works but very long in first time :(

Added after 16 minutes:

It is not problem. Thank you!

I have Asus X53S. When I run this application I see:


Vendor: Intel
Renderer: Intel(R) HD Graphics Family
Version: 3.0.0 - Build 8.15.10.2291
GLSL: 1.30 - Intel Build 8.15.10.2291

When I right click on .exe and select "Run with graphics processor" -> "High-performence NVIDIA processor" I see:


Vendor: NVIDIA Corporation
Renderer: GeForce GT 540M/PCI/SSE2
Version: 4.1.0
GLSL: 4.10 NVIDIA via Cg compiler

How to check second variant for Qt by default?

8Observer8
8th August 2014, 05:08
Changing graphics processor depends on OS