PDA

View Full Version : Qt 5.7 version widget promoting to opengl



Latha Rani
6th July 2017, 11:59
Hi,
I promoted Qt (5.7.0 version) widget to opengl.Opengl window is creating but openl commands are not working ex:glcolor(),glclearcolor(),glBegin() etc., and also i am not able to do initializeGL(),PaintGL() functions .Whether Qt 5.7.0. version will support to work on opengl or not?

high_flyer
6th July 2017, 12:34
At least for me your question is not clear.
Since you are using the term "promoting" I assume you mean the designer feature of promoting widgets.
If this is the case, it seems you don't understand what promotion does.
Promotion is simply a tool to allow designer to generate the correct headers and class names that are already defined in your project but that are not available to designer.
Promotion has no functional influence on your code.

Latha Rani
6th July 2017, 12:53
Before i have worked on opengl for drawing on QT 4.5 version,that was working fine.But the same code applying on the Qt 5.7.0. version platform it is not working.How to use opengl code or commands on Qt 5.7.0 platform.
Ex:
void GLWidget:: initializeGL()
{
glClearColor(0.0,0.0,0.0,0.0);
glPushMatrix();
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_BLEND);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glPolygonMode(GL_NONE,GL_LINE);

do_Actual_Drawing();

glDisable(GL_LINE_SMOOTH);
glDisable(GL_POINT_SMOOTH);
glDisable(GL_POLYGON_SMOOTH);
glDisable(GL_BLEND);
glPopMatrix();

}
Above code is wrking on Qt4.5 but not working on QT 5.7.0 version.
How to write opengl code on Qt 5.7.0 version ?

high_flyer
6th July 2017, 14:39
What does "not working" mean exactly?
Does it not build`
Does it build, but not behave the same way?

I didn't do anything with GLWidget since Qt5x, so I can't say from experience, but from the docs it doesn't look that much has changed in how you should use it.