PDA

View Full Version : Qt datatypes with GLM and OpenGL



tmason
02-12-2015, 07:30 AM
Hello,

I am wondering if anyone has used Qt datatypes (QMatrix4x4, QMatrix3x3, QVector3D, QVector4D, etc.) with OpenGL.

I know that Qt has it's own way of dealing with OpenGL but I have an existing working program that I built using GLM that I need to port over.

Ideally, I would like to use GLM datatypes but the problem is that Qt's shader management classes (QOpenGLShaderProgram and QOpenGLShader) doesn't seem to accept pointers in their setters (for example, I didn't find the setUniform() function that accepts a pointer to a float array).

Hopefully someone has experience with this and can shed some light; I'd rather use GLM's datatypes since I have a working system using that already.

However, since Qt is where I need to go (I need the toolbar/menu/UI functionality Qt provides) I am willing to convert if necessary.

Thank you.

Alfonse Reinheart
02-12-2015, 08:48 AM
Just because you're using Qt doesn't mean you have to use Qt for everything. If you want to use Qt to simply create and manage the OpenGL context, while doing all of your OpenGL stuff yourself, you can do that.

You don't have to use Qt's shader classes just because you used Qt to set up OpenGL.

tmason
02-12-2015, 12:44 PM
I agree! The issue comes into play using Qt's shader management classes, etc.

What I don't want to happen is needing to convert between GLM and Qt all of the time; especially in the frame loop.


Just because you're using Qt doesn't mean you have to use Qt for everything. If you want to use Qt to simply create and manage the OpenGL context, while doing all of your OpenGL stuff yourself, you can do that.

You don't have to use Qt's shader classes just because you used Qt to set up OpenGL.

Alfonse Reinheart
02-12-2015, 01:10 PM
I agree! The issue comes into play using Qt's shader management classes, etc.

What I don't want to happen is needing to convert between GLM and Qt all of the time; especially in the frame loop.

I went to the doctor and told him that it hurts when I raise my arm like this. He said, "so don't raise your arm like that."

If you don't want to convert between GLM and Qt all the time... stop using Qt's shader management classes that make you convert between GLM and Qt all the time.