PDA

View Full Version : OpenGL



muykim
7th December 2017, 05:29
I'm new to Qt, and I'd like to learn about opengl to do a 3d plotting for my project. I tried following the tutorial online, but somehow there are errors to my code. I couldn't figure out what's wrong with it since I'm pretty new to Qt. I know that there are some examples online on opengl, but those aren't really helpful to me. Can anyone point me to a place on where to start learning about opengl in qt? It'll also help if there is an opengl example code.

high_flyer
7th December 2017, 09:33
If you are new both to Qt and OpenGL I'd suggest you start with OpenGL first with not connection to Qt.
Once you are proficient with OpneGL look at the specifics of using it with Qt.

muykim
7th December 2017, 09:54
Thank you. I'll take a look at that. Also, I tried to follow the code again for the opengl, and I got this error on gluPerspective. I searched the internet for the solution, and most people suggest to add LIBS -lGLU and #include <GL/glut.h>. However, this method does not work for me. Do you have any idea why or how to solve the problem?

high_flyer
7th December 2017, 15:53
Please understand that most of us are not telepaths or remote viewers.
Saying you have some errors is saying nothing.
Post the code, and the resulting errors, then, maybe, we might help you.
But again, even if we can, it will only hold until the next error you get.
This is not way to work - you need to learn first.

john_god
10th December 2017, 18:16
Hi

I have this Qt OpenGL tutorials, I'm trying to make them very newbie friendly with lots of comments https://bitbucket.org/joaodeusmorgado/opengltutorials check them out if you find them usefull.

You really dont need to use gluPerspective, that's not part of Opengl library, its part of glut libray, a helper library with math functions and others to use with OpenGL. AFAIK glut is deprecated. Since you're using Qt, you have all the helper functions you need, replace gluPerspective with QMatrix4x4::perspective(...).

That's the beauty of using Qt, you will hardly need any other helper libraries, Qt got you covered for almost all libraries you will need, like matrix and image manipulation.

If you're serious about learning OpenGL, I would recomend starting with Anton Gerlan book, the best book for newbies and very cheap too. A book is much better to learn than trying to figure out hard stuff like OpenGL, with lots of info all scattered around the web, imho.

Cheers