OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Error Compiling OSG GL3 on Win7/VS 2008


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
zonk
Appreciator


Joined: 23 May 2009
Posts: 621

PostPosted: Mon Dec 13, 2010 8:42 pm    Post subject:
Error Compiling OSG GL3 on Win7/VS 2008
Reply with quote

Hi,

I tried to compile OSG withGL3 on windows and VS 2008 fo testing purposes.

I disabled the other GL options as describte in an other thread.

VS failed to compile in Matrix_implementation.cpp:
Code:

 if (fabs(length2) <= std::numeric_limits<double>::min())
 ...


The error output is about the min macro and invalid token right to ':Crying or Very sad (line 70+)

Does anyone know what this error could be about? Has anyone used GL3 successfully on a windows machine?

Thank you!

Cheers,
Torben
Back to top
View user's profile Send private message
Skylark (Jean-S├ębastien Guay)
Professional


Joined: 05 Jan 2009
Posts: 2249

PostPosted: Mon Dec 13, 2010 8:49 pm    Post subject:
Error Compiling OSG GL3 on Win7/VS 2008
Reply with quote

Hi Torben,

Quote:
The error output is about the min macro and invalid token right to ':Crying or Very sad (line 70+)

Does anyone know what this error could be about? Has anyone used GL3 successfully on a windows machine?

I haven't built OSG with GL3, but when MSVC complains about min/max,
it's usually because someone somewhere included windows.h without first
defining WIN32_LEAN_AND_MEAN or NOMINMAX (the former implies the
latter). This happens because somewhere in the headers included by
windows.h, min and max are defined as macros. So anywhere code uses the
names min or max after that, it will be replaced by the preprocessor and
then anything before (like std::numeric_limits<double>:: in the line you
quoted) will cause a compiler error.

I guess you'll have to find where windows.h was included (any of the
headers included in Matrix_implementation.h, and headers included by
those, etc.) and add the appropriate define to stop it from defining the
min and max macros.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay
http://www.cm-labs.com/
http://whitestar02.webhop.org/


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
zonk
Appreciator


Joined: 23 May 2009
Posts: 621

PostPosted: Mon Dec 13, 2010 10:12 pm    Post subject:
Reply with quote

Hi J-S,

you are right using NOMINMAX avoids the problem. I tracked it down to osg/GL and the inclusion of gl3.h:
Code:

#elif defined(OSG_GL3_AVAILABLE)

    #define GL3_PROTOTYPES 1
    #include < GL3/gl3.h >

    #ifndef GL_APIENTRY
        #define GL_APIENTRY APIENTRY
    #endif // GL_APIENTRY

#else


With definintion NOMINMAX in front of the include it works, defining NOMINMAX after the gl3.h include, it failed.

In the gl3.g it checks for win and defines WIN32_LEAN_AND_MEAN.

In my case this is not enough, only with defining NOMINMAX, it compiles (at least the osg module, some plugins still fail but I will test that tomorrow.)

To avoid modifications in gl3.h i modified my osg/GL:
Code:

...
#elif defined(OSG_GL3_AVAILABLE)
   #ifdef WIN32
      #ifndef NOMINMAX
         #define NOMINMAX
      #endif
   #endif

    #define GL3_PROTOTYPES 1
    #include < GL3/gl3.h >

    #ifndef GL_APIENTRY
        #define GL_APIENTRY APIENTRY
    #endif // GL_APIENTRY

#else
...


Is this a valid fix ready to submit, or is it to much hack to be ready for merging?

In the next days I hope to solve the confict between tesselator and unit to solve this GL3 issue for the next dev release.


Thanks for your help,
Torben
Back to top
View user's profile Send private message
Paul Martz
Guest





PostPosted: Mon Dec 13, 2010 10:51 pm    Post subject:
Error Compiling OSG GL3 on Win7/VS 2008
Reply with quote

On 12/13/2010 3:12 PM, Torben Dannhauer wrote:
Quote:
#ifdef NOMINMAX
#define NOMINMAX

I assume you mean "#ifndef" above?

--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/


------------------
Post generated by Mail2Forum
Back to top
Skylark (Jean-S├ębastien Guay)
Professional


Joined: 05 Jan 2009
Posts: 2249

PostPosted: Mon Dec 13, 2010 10:55 pm    Post subject:
Error Compiling OSG GL3 on Win7/VS 2008
Reply with quote

Hi Torben,

Perhaps moving this to the CMake files would make sense?

I just checked the root CMakeLists.txt, and it has a section:

IF (WIN32)

...

# Both Cygwin and Msys need -DNOMINMAX ???
IF(UNIX)
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF()

...

ENDIF()

Removing the IF(UNIX) from the above would also define NOMINMAX for MSVC
(i.e. it would be defined for all Windows compilers, including Cygwin
and MinGW which fall under the IF(UNIX) test and MSVC which falls under
the IF(MSVC) test just above those lines).

Can you try this?

Thanks,

J-S
--
______________________________________________________
Jean-Sebastien Guay
Only registered users can see emails on this board!
Get registred or enter the forums!

http://www.cm-labs.com/
http://whitestar02.webhop.org/


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
zonk
Appreciator


Joined: 23 May 2009
Posts: 621

PostPosted: Tue Dec 14, 2010 6:54 am    Post subject:
Reply with quote

Hi Paul, Hi J-S

yes you are right, I meant #ifndef, sorry for the typo Smile


Yes I'll move it to the cmake file as it does not touch the source files, but I have no clue about if my changes could introduce bugs on other build systems than MSVC, so I decided to ask Smile

Today evening I'll move it to the cmakelists.txt and then try to solve the issues with tesselator and unit.


So far, thank you! Smile

Cheers,
Torben
Back to top
View user's profile Send private message
zonk
Appreciator


Joined: 23 May 2009
Posts: 621

PostPosted: Wed Dec 15, 2010 9:25 am    Post subject:
Reply with quote

Hi Paul, Hi J-S,

the CMAKE modification works.

All other compile errors in a lot of files are cause on ambiguous symbols caused by wingdi.h. THis file is included in windows.h, which is in cluded in the gl3.h. To test if it is the reason, I modified gl3.h and disabled the include of windows.h.

Now the ambiguous symbols are disappared, but OSG has hundrets of linker errors, because all the _gl* functions are missing. It seems caused by gl.h because gl.h and gl3.h defines the same functions and it throws arrors without defining the function.

Do I need gl.h if I use gl3.h?

@Paul: You seem to have a running GL3 OSG. Is your OS windows? If yes, what ist build environment?


Thank you!

Cheers,
Torben
Back to top
View user's profile Send private message
zonk
Appreciator


Joined: 23 May 2009
Posts: 621

PostPosted: Wed Dec 15, 2010 11:15 am    Post subject:
Solved!
Reply with quote

Hi Paul, J-S

I applied 2 modifications, and it nearly works:

Mod 1: your suggested CMAKE modification
Mod 2: I extended the osg/GL includefile to define some windows constants before including GL3/gl3.h to aviod the name confilcts in the same way like it is done prior to the GL2 include:
Code:

#elif defined(OSG_GL3_AVAILABLE)
   // Under Windows avoid including <windows.h>
    // to avoid name space pollution, but Win32's <GL/gl.h>
    // needs APIENTRY and WINGDIAPI defined properly.
    // XXX This is from Win32's <windef.h>
    #ifndef APIENTRY
        #define GLUT_APIENTRY_DEFINED
        #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
            #define WINAPI __stdcall
            #define APIENTRY WINAPI
        #else
            #define APIENTRY
        #endif
    #endif

     // XXX This is from Win32's <windef.h>
    #ifndef CALLBACK
        #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
            #define CALLBACK __stdcall
        #else
            #define CALLBACK
        #endif
    #endif

    // XXX This is from Win32's <wingdi.h> and <winnt.h>
    #ifndef WINGDIAPI
        #define GLUT_WINGDIAPI_DEFINED
        #define DECLSPEC_IMPORT __declspec(dllimport)
        #define WINGDIAPI DECLSPEC_IMPORT
    #endif
   
    // XXX This is from Win32's <ctype.h>
    #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&((__GNUC__ == 3)||(__GNUC__ == 4)))
        typedef unsigned short wchar_t;
        #define _WCHAR_T_DEFINED
    #endif




    #define GL3_PROTOTYPES 1
    #include <GL3/gl3.h>

    #ifndef GL_APIENTRY
        #define GL_APIENTRY APIENTRY
    #endif // GL_APIENTRY

#else


No the compile works, and most of the linking as well.

Only the Qtosg Module faisl to link, because it includes Qts OpenGL module, wich includes gl.h

The resulting definition conflict of gl3.h and gl.h ends in a lot of compile errors in osgQt.

What would be the approriate way to solve this issue? According to this Qt issue report http://bugreports.qt.nokia.com/browse/QTBUG-8611 Qt currently does not support gl3.h usage.

So currently the only option is to disable osgQt while using GL3.

I'll submit my two modified files, afterwards the following steps are required for windows+MSVC users:
1. Download gl3.h from www.opengl.org/registry and put it into <your DevEnvIncludeDir>/GL3/gl3.h
2. Configure CMake to disable all OSG_GLx_AVAILABLE
3. Configure CMake to disable OSG_GL_DISPLAYLISTS_AVAILABLE
4. Configure CMake to disable OSG_GL_FIXED_FUNCTION_AVAILABLE
5. Configure CMake to disable OSG_GL_MATRICES_AVAILABLE
6. Configure CMake to disable OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE
7. Configure CMake to disable OSG_GL_VERTEX_FUNCS_AVAILABLE
8. Configure CMake to ENable OSG_GL3_AVAILABLE
9. Configure CMake to disable Qt usage, because currently Qt is not GL3 capable.

The examples compile with GL3. My only problem is: Is there a simple example using GL3?

All osg example and even osgviewer announce that is is not a valid OpenGL 3 Version number:
Code:

GL3: Non-GL3 version number: 1.0


Cheers,
Torben
Back to top
View user's profile Send private message
Paul Martz
Guest





PostPosted: Wed Dec 15, 2010 1:31 pm    Post subject:
Error Compiling OSG GL3 on Win7/VS 2008
Reply with quote

On 12/15/2010 2:25 AM, Torben Dannhauer wrote:
Quote:
@Paul: You seem to have a running GL3 OSG. Is your OS windows? If yes, what ist build environment?

Yes, it was on Windows, which, of course, only support GL 1.1 native.

When I had this working, I was using gl3.h only for function prototype
definitions, then filling in the necessary function pointers. As a result, there
were no undefined symbols.

--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/


------------------
Post generated by Mail2Forum
Back to top
cody
Newbie


Joined: 07 Feb 2017
Posts: 1

PostPosted: Tue Feb 07, 2017 12:38 pm    Post subject:
Re: Solved!
Reply with quote

Hi,

i got the same Error when building with VS2012:
"GL3: Non-GL3 version number: 1.0",
Failed to load libEGLd.dll (Couldn't find module),
class QWindowsEGLStaticContext [...]: Faile to load and resolve libEGL functions"

As you suggested I built OSG again, disabling all OSG_GL_XXX_AVAILABLE, disabling OSG_USE_QT (I use Qt 5.5 builded before), but enabling OSG_GL3_AVAILABLE.
What about the gl3.h - do I really need it to be downloaded externally, and where to put it?

What might be the problem?
I don't know where to look out.

Thanks in advance,
Cody
Back to top
View user's profile Send private message
dieslower81
User


Joined: 15 Feb 2010
Posts: 39

PostPosted: Tue Oct 03, 2017 6:38 pm    Post subject:
Reply with quote

Hi,

I'm also having a problem with GL3 on windows.

When I build OSG with GL3 available and run an osg example I get an error:
GL3: Non-GL3 version number: 1.0

It looks like it is coming from the Statistics Handler.

Is there a way to make OSG detect GL3 on windows? It is obviously there since it is included with the support of latest NVIDA cards.


...

Thank you!

Cheers,
Maxim
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Shared openGL Context generating Glyp... pioupiou General 0 Fri Jul 19, 2019 3:23 pm View latest post
No new posts OpenGL Error 'invalid value' when usi... Blanky General 1 Thu Jun 27, 2019 12:10 am View latest post
No new posts openGL error 'stack overflow' at afte... nebsar General 7 Sun Dec 23, 2018 6:05 am View latest post
No new posts Compiling vertext shader fails on Intel loopy General 7 Fri Dec 14, 2018 7:28 pm View latest post
No new posts OpenGL viewport error (with Oculus) Riccardo Corsi General 6 Wed Oct 17, 2018 10:44 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP