Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Any ideas how makefiles work for opengl
Semi Annoying i feel :( but i got another question any ideas how make files work i need to change some of the text in my proj file to use opengl with headers and i dont really understand it i can reread and try there but it would be awesome if i could get some first hand answering
edit : sorry let me rephrase i need to know how to make QT Work with qtopengl Headers i read up that it was to do with 'MAKE' files or something any ideas
EDIT: split of "this thread":http://developer.qt.nokia.com/forums/viewthread/7309/ , Gerolf
dialingo last edited by
Avoid writing Makefiles if possible. Write .pro files and use qmake to generate your Makefile.
To add an includepath:
@INCLUDEPATH += C:/mylibs/extra_headers@
To link additional libraries:
@LIBS += -L/usr/local/lib -lmath@
Eddy last edited by
i would suggest to start another topic with your second question. That way you will get more attention in the forum.
Did you succeed to get the examples now?
Edit : thanks Gerolf
ludde last edited by
Not sure what you are trying to do, but to create a Qt project that works with OpenGL you just have to add
@QT += opengl@
to your .pro file.
And, of course, include the header files you need from your source code, e.g.
okay im back sorry for the long wait there! okay i dont even know where to put the QT += opengl part in the pro file it self i know where the file is i got it selected but where exactly on the pro file its self
and include the header files? what like if im using opengl with qt i put that into the include code part
and Qmake? what where do i get it how do i use it and the hole nine yards
Anywhere in the .pro file will do but the QT variable normally gets placed outside of any scopes in the .pro file.
Create a new project in Qt Creator, add QT+=opengl to the generated .pro file and build it. Qt Creator will take care of running qmake and compiling the project for you.
then i can just start writing opengl code into Main.qml?
Wha? You need to put OpenGL code into a C++ file since it needs to be compiled (OK there is a capability of QML in a special plugin to embed GLSL shaders directly into yoru QML items but that is very new and unsupported).
Take a look at the OpenGL examples that ship with Qt itself.
Oh okay :D cool so you make another Source file and Call it whateva.cpp then inside that you type a bunch of opengl code press run and it works ? :D lol im just trying to make shore i get this 100% exact
do i need to have any headers ? with the cpp?
Well I would start off with learning C++ before you dive into OpenGL. Once you are comfortable with C++ then take a look at Qt and finally learn about OpenGL.
Qt ships with a huge number of examples and demos. Take a look at those and the documentation that comes with them (hint use qtdemo to launch the demos and the docs).
using namespace std;
int main ()
cout << "im talking in c++ :P";
im fine with c++
im still learning opengl :) i just need to be told the meaning and exact information too fully understand which then misconcepts alot too that im a noob lol too most people dont worry about it
[EDIT: code formatting, please wrap in @-tags, Volker]
ludde last edited by
To use OpenGL with Qt, you need a QGLWidget. Have a look at the "documentation":http://doc.qt.nokia.com/latest/qglwidget.html, it will tell you most things you need. If that's not enough, have a look at an example, e.g. "Hello GL":http://doc.qt.nokia.com/latest/opengl-hellogl.html.
Take a look at (or get an svn checkout of) this section of my repository to see how I have ported the first few examples from the OpenGL SuperBible book to Qt.