View Full Version : Qt and OpenGL, Really Basic Question!

Cpp Deever
02-09-2009, 10:23 AM
Hello all!
I'm a C++ programmer.
i want to develop a simple app by Qt in windows.
I've tried OpenGL Qt tutorials and demos, its name is HelloGl.

this is code:
#include <QtGui>
#include <QtOpenGL>
#include <math.h>
#include "glwidget.h"
GLWidget::GLWidget(QWidget *parent)
: QGLWidget(parent)
object = 0;

When i've tried to compile it, a fatal error occurs!
Line 2! QtOpenGL not found!
i've found it Qt\4.4.3\include\QtOpenGL but how should i use it!
I know DirectX SDK should install in design time, I cannot find any SDK for OpenGL, I found some interface at this address http://www.opengl.org/sdk/

I'm really confused, how can i develop with OpenGL, there's not any kind of SDK!
Please help me!

02-09-2009, 10:29 AM
This is not related to OpenGL. Configure correctly paths in your development environment, IDE or project.

02-09-2009, 12:36 PM
QtOpenGL not related to OpenGL ? interesting...
Anyways, you must add QT += opengl in your .pro for qmake to find the headers and link properly.

02-09-2009, 12:53 PM

Please disregard the dletozeun's comment, unfortunately some forum members don't have anything better to do.

How did you installed Qt?

It looks like you didn't setted it up correctly.

What compiler are you using?

An easy way to have it installed into your system without much hassle is to use the new QtCreator.

Otherwise I would advise you to follow the installation instructions


And the OpenGL tutorials.


Cpp Deever
02-09-2009, 01:04 PM
hi dude,

I've no problem with Qt 4.4.3.
I think it's ok, i've not any problem with it. i have only problem with opengl, now i want to know, if i want to develop an application and use OpenGl in it, should i have a SDK and use it?
like DirectX SDK?!
and where can i find its sdk?

02-09-2009, 02:00 PM
No need for an extra sdk, pjmlp gave a link with multiple opengl examples with Qt. Download one, it should compile out of the box. if not, then it means you did not setup Qt correctly, ie. missing include headers and such.

02-09-2009, 03:40 PM
Cpp Deever, I sincerely apologize for having been so harsh, my answer was poorly formulated. I meant that your problem is more related to your Qt setup than OpenGL.


I assume you are working on visual studio, have you checked in your project properties that paths related to header files are correct?

This tutorial may interest you:
Setting up a Qt project in Visual Studio .NET (http://ldmartin68.com/QTSetup4VSNET.html)

Cpp Deever
02-10-2009, 10:03 PM
tank you dletozeun and pjmlp.
how this is possible develop an opengl application without any sdk?
I've installed Qt Commercial 4.4.3, is the sdk inside it?

02-11-2009, 02:20 AM
how this is possible develop an opengl application without any sdk?
Because opengl is not direct3d.
You only need .h headers for the interface and good drivers for the runtime library implementation.

02-11-2009, 07:15 AM
Did you finally succeed to configure your project?

If you absolutely want to an OpenGL SDK, there are actually some people that are (still?) working on a unofficial one. If it is released one day, it will be probably too late for you but you may want to bring some suggestion to their attention.

and the opengl thread:

Cpp Deever
02-11-2009, 09:25 PM
tanx dletozeun.
it's nice guide.