[osg-users] OSG and Qt GLdouble typedef conflicts with OpenGL ES2

41 views
Skip to first unread message

Preet

unread,
Dec 12, 2012, 12:59:30 AM12/12/12
to OpenSceneGraph Users
Hiya

I'm using OSG with Qt to create an OpenGL ES 2 application. GL ES2 does not have GLdoubles.

When building with against ES2, Qt typedefs GLdouble to GLfloat. OSG typedefs GLdouble to just 'double'. As a result I get an error when trying to compile my application.

How do I get around this?


Preet

Robert Osfield

unread,
Dec 12, 2012, 3:51:14 AM12/12/12
to OpenSceneGraph Users
Hi Preet,

On 12 December 2012 05:59, Preet <prismati...@gmail.com> wrote:
Hiya

I'm using OSG with Qt to create an OpenGL ES 2 application. GL ES2 does not have GLdoubles.

When building witHh against ES2, Qt typedefs GLdouble to GLfloat. OSG typedefs GLdouble to just 'double'. As a result I get an error when trying to compile my application.

How do I get around this?


It will be an order of include issue, so just be careful which order you include files, or keep the Qt GL code seperate from the OSG Qt code.  Personally I'm surprised by the Qt downcasting GLdoube to GLfloat, this could break codes that rely on doubles.  On the OSG side we generally use floats for all key data that gets passed to OpenGL, it tends to be just things like glu (which is now part of the OSG) that uses doubles.

Robert.

Preet

unread,
Dec 13, 2012, 7:06:50 PM12/13/12
to OpenSceneGraph Users
Hi Robert,

Thanks for the quick reply. Just for anyone else who runs into this, another way to get aorund this without changing order of includes is just to add the osg defines before Qt is included in the application:

#define GL_DOUBLE 0x140A
#define GLdouble double

It was a bit of a pain to change up order of includes everywhere in my application. Since both OSG and Qt have to check whether or not GLdouble is defined by the GL implementation, I think its safe to do this [and it seems to be working fine].


Regards,

Preet


_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Reply all
Reply to author
Forward
0 new messages