Hi David,
On 2 March 2012 09:02, David Garcia <[email protected]> wrote:
>
> Hi Robert,
>
> Find attached my modifications to compile OSG under MAC OS X with GL3. It
> compiles OK but unfortunatelly I got errors when executing the sample app:
Do you mean the osgsimplegl3 sample app? Another application?
> Warning: TexGen::apply(State&) - not supported.
> Warning: Material::apply(State&) - not supported.
> Warning: TexGen::apply(State&) - not supported.
> Warning: detected OpenGL error 'invalid enumerant' at after
> RenderBin::draw(..)
None of the TexGen and Material state attributes are supported by core
GL3 so using these state attributes in the scene graph driving a GL3
application is inappropriate.
>
> In any case it creates the right context:
> glVersion=3.2, isGlslSupported=YES, glslLanguageVersion=1.5
>
> The changes are:
> 1) In GL I add two includes, three defines for missing symbols and an ifdef
> __APPLE__
>
> #if defined(OSG_GL3_AVAILABLE)
> #ifdef __APPLE__
> #include <OpenGL/OpenGL.h>
> #include <OpenGL/gl3.h>
> #define GLint64EXT GLint64
> #define GLuint64EXT GLuint64
> #define GL_BGRA_EXT GL_BGRA
> #else
> #include <GL3/gl3.h>
> #define GL3_PROTOTYPES 1
> #endif
Why did you swap the ordering of the #define GL3_PROTOTYPES 1 in the
#else section?
Why do you include OpenGL/OpenGL.h? This would include lots of OpenGL
features that are inappropriate to a GL3 application. What errors do
you get if you just include gl3.h?
> 2) Setting the pixel format as Stephan suggests. I have protect the access to
> NSOpenGLProfileVersion3_2Core with an ifdef, different from the
> implementation in Win32.
>
> In bool GraphicsWindowCocoa::realizeImplementation():
> #if defined(OSG_GL3_AVAILABLE)
> if( _traits->glContextVersion == "3.2" ){
> OSG_NOTIFY( osg::INFO ) << "GL3: Attempting to create OpenGL3
> context." << std::endl;
> OSG_NOTIFY( osg::INFO ) << "GL3: version: " <<
> _traits->glContextVersion << std::endl;
>
> attr[i++] = NSOpenGLPFAOpenGLProfile;
> attr[i++] = NSOpenGLProfileVersion3_2Core;
> }
> #endif
What of the values of NSOpenGLProfileVersion are supported? Is this a
#define? Could we avoid having the #if defined(..) here and just
detect enable the 3_2 profile when the glContextVersion requests it?
I'm a bit concerned about the tying of version number to 3.2 and this
in turn requiring calling code to specifically ask for 3.2, but only
for OSX. I'd like to make things so they are more portable and
robust. For instance if one asks for 3.1 and only 3.2 is available it
should be safe to just level the 3.2 profile handle it. Only if one
asks for something greater than 3.2 might one decide to issue a
warning/error.
> 3) In osgsimplegl3, when compiling for Mac, the minimum version is 3.2
>
> #ifdef __APPLE__
> const std::string version( "3.2" );
> #else
> const std::string version( "3.1" );
> #endif
I'd very much like to avoid pushing platform specifics into sample codes.
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org