January 7, 2013

DamianPrg DamianPrg
Lab Rat
16 posts

Qt 5 - OpenGL Problem

Page  
1

Hello.

My problem is that I cannot use OpenGL 2 functions, some which I can use are glClear, glClearColor, but I cant use glBegin for example.

I added QT += opengl in project file.

Can anyone help? Thanks

31 replies

January 8, 2013

ZapB ZapB
Hobby Entomologist
1422 posts

What do you mean by “can’t use”? Do you get a compile error, link error, runtime error?

 Signature 

Nokia Certified Qt Specialist
Interested in hearing about Qt related work

January 9, 2013

DamianPrg DamianPrg
Lab Rat
16 posts
ZapB wrote:
What do you mean by “can’t use”? Do you get a compile error, link error, runtime error?

When I use glBegin, glVertex3f I get identifer ‘X’ not found.

X – function which I want to call (OpenGL function).

January 10, 2013

ZapB ZapB
Hobby Entomologist
1422 posts

Oh boy this really needs to go into an FAQ somewhere. Let me guess, you are using the pre-compiled Qt5 SDK on Windows? If so that is the cause of your problem. Let me explain.

The precompiled binary packages ship with Qt5 configured for OpenGL ES 2 and using the ANGLE layer which implements ES 2 on top of DirectX. This was done to ensure that QtQuick2 works on all windows machines, even those with crappy Intel OpenGL drivers.

To get access to glBegin() etc which are not part of OpenGL ES 2 you need to build your own Qt5 and pass in the -opengl desktop option to configure.

Qt 5.0.1 should hopefully also ship with such a pre-compiled Qt. Please go and vote for this bug https://bugreports.qt-project.org/browse/QTBUG-28715

 Signature 

Nokia Certified Qt Specialist
Interested in hearing about Qt related work

January 10, 2013

DamianPrg DamianPrg
Lab Rat
16 posts

ZapB wrote:
Oh boy this really needs to go into an FAQ somewhere. Let me guess, you are using the pre-compiled Qt5 SDK on Windows? If so that is the cause of your problem. Let me explain.

The precompiled binary packages ship with Qt5 configured for OpenGL ES 2 and using the ANGLE layer which implements ES 2 on top of DirectX. This was done to ensure that QtQuick2 works on all windows machines, even those with crappy Intel OpenGL drivers.

To get access to glBegin() etc which are not part of OpenGL ES 2 you need to build your own Qt5 and pass in the -opengl desktop option to configure.

Qt 5.0.1 should hopefully also ship with such a pre-compiled Qt. Please go and vote for this bug https://bugreports.qt-project.org/browse/QTBUG-28715

Ok thanks, I will try to compile it by myself, Thank again :-)

January 10, 2013

utcenter utcenter
Hobby Entomologist
809 posts

People still use glBegin? Don’t!!!

January 10, 2013

DamianPrg DamianPrg
Lab Rat
16 posts
utcenter wrote:
People still use glBegin? Don’t!!!

Often I use modern opengl (3.2), but for simple 2d editor, I should be allright with VA and fixed OpenGL 2.1.

January 10, 2013

utcenter utcenter
Hobby Entomologist
809 posts

The fixed function pipeline is left only for the sake of backward compatibility, only for code that already exists, if you write new code, it is very counter-productive to use it. You don’t really gain anything by using it, you lose out on many features that are beneficial even in 2d, and in many cases, performance is actually worse, plus you lose portability.

January 10, 2013

ZapB ZapB
Hobby Entomologist
1422 posts

If you are writing new code then I would also recommend avoiding the old fixed function pipeline stuff. Note that some vendors (notably Apple) do not implement the compatibility profile. So if you need a 3.2 context on OS X you can only use the Core profile. Just something to bear in mind.

 Signature 

Nokia Certified Qt Specialist
Interested in hearing about Qt related work

January 10, 2013

DamianPrg DamianPrg
Lab Rat
16 posts
ZapB wrote:
If you are writing new code then I would also recommend avoiding the old fixed function pipeline stuff. Note that some vendors (notably Apple) do not implement the compatibility profile. So if you need a 3.2 context on OS X you can only use the Core profile. Just something to bear in mind.

Anyway if i want to use OpenGL 3.2+, i need compiile qt by myself.

January 16, 2013

mgonzalo mgonzalo
Lab Rat
5 posts

Hi guys!

I’ve got exactly the same problem as DamianPrg.

Maybe this is a stupid question, but I am a very beginner, anyway : what do you mean by saying that you need to compile Qt by yourself ?

January 16, 2013

DamianPrg DamianPrg
Lab Rat
16 posts

mgonzalo wrote:
Hi guys!

I’ve got exactly the same problem as DamianPrg.

Maybe this is a stupid question, but I am a very beginner, anyway : what do you mean by saying that you need to compile Qt by yourself ?

You can compile it by yourself, I tried but didn’t work. Some problem with configure.
Or you can wait for next release of Qt 5, and maybe there will be OpenGL desktop instead of GL ES 2.

Note: If you want compile it by yourself, it will take some time, on good machine about 1h :-)

January 16, 2013

ZapB ZapB
Hobby Entomologist
1422 posts

Well, just that you need to compile your own build of the Qt libraries to enable Desktop OpenGL on windows at present. Helpful instructions can be found at http://qt-project.org/wiki/Building_Qt_5_from_Git

 Signature 

Nokia Certified Qt Specialist
Interested in hearing about Qt related work

January 16, 2013

DamianPrg DamianPrg
Lab Rat
16 posts

http://www.youtube.com/watch?v=K0O6mvD6uk4 – It also can help you :-)

January 16, 2013

sierdzio sierdzio
Area 51 Engineer
4109 posts

Qt is a set of libraries and tools. What you download from Qt Project web site is – most probably – a pack of precompiled libraries, ready to be used. Necessarily, this general package is compiled with default, fit-for-all settings.

However, Qt is a big project, and can be compiled in thousands of ways (by passing flags to configure script) and for some usages it’s better to define those flags as you want to.

Qt Project is open sourced, you can download sources yourself and take a look (link [qt-project.org]).

EDIT whoosh, I was waaaay too slow on this one ;)

 Signature 

(Z(:^

January 16, 2013

DamianPrg DamianPrg
Lab Rat
16 posts

  1. C:\qt5>configure -developer-build -opensource -opengl desktop -nomake examples -
  2. nomake tests
  3. + C:/qt5/qtbase/configure -developer-build -opensource -opengl desktop -nomake e
  4. xamples -nomake tests
  5. 'C:\qt5\qtbase\\configure.exe' is not recognized as an internal or external comm
  6. and,
  7. operable program or batch file.
  8. *** qtbase/configure exited with non-zero status.
  9.  
  10. C:\qt5>

This is what I get when I try to configure. Note that i have Perl, Python installed. Source code is downloaded from http://qt-project.org/downloads

Page  
1

  ‹‹ Error sending Iplimage using TCP      QX11EmbedContainer not working ››

You must log in to post a reply. Not a member yet? Register here!