[MonoDevelop] OpenGL 3.2 and GLSL 1.5 on Lion 10.7.2 using Monomac

Michael Hutchinson m.j.hutchinson at gmail.com
Wed Oct 19 19:50:04 EDT 2011


Forwarding to Mono OSX list since that's the best place to discuss MonoMac.

On Tue, Oct 18, 2011 at 8:37 PM, Eric Hosick
<erichosick at interfacevision.com> wrote:
> Hi All,
> I'm not sure where to talk about this or if I should fork or what but here
> we go.
>
> When running in Lion 10.7.2, the following call:
> string version = GL.GetString(StringName.Version);
> returned "2.1 ATI-7.12.9"
> With a few additions to Monomac I was able to get the following:
>
> string version = GL.GetString(StringName.Version); // version = 3.2
> ATI-7.12.9
>
> Ok. So the file NSOpenGL.h had the following:
>
> #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
>
> /* NSOpenGLPFAOpenGLProfile values */
>
> enum {
>
> NSOpenGLProfileVersionLegacy    = 0x1000,   /* choose a Legacy/Pre-OpenGL
> 3.0 Implementation */
>
> NSOpenGLProfileVersion3_2Core   = 0x3200    /* choose an OpenGL 3.2 Core
> Implementation      */
>
> };
>
> #endif
>
> and an addition to NSOpenGLPixelFormat of:
>
> #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
>
> NSOpenGLPFAOpenGLProfile      =  99, /* specify an OpenGL Profile to use
>         */
>
> I edited src/AppKit/Enums.cs adding the following few things:
>
> public enum NSOpenGLPixelFormatAttribute {
>
> ...
>
> OpenGLProfile = 99,
>
> ...
>
> }
>
> public enum NSOpenGLPFAOpenGLProfile {
>
> VersionLegacy    = 0x1000, // choose a Legacy/Pre-OpenGL 3.0 Implementation
>
> Version3_2Core   = 0x3200 // choose an OpenGL 3.2 Core Implementatio
>
> }
>
> Made monomac and tested it with NeHeLesson7 (directly referencing to the
> monomac.dll) and changing the following in MyOpenGLView.InitGL():
>
> From:
>
> var attribs = new object[] { NSOpenGLPixelFormatAttribute.Accelerated,
> NSOpenGLPixelFormatAttribute.NoRecovery,
> NSOpenGLPixelFormatAttribute.DoubleBuffer,
> NSOpenGLPixelFormatAttribute.ColorSize, 24,
> NSOpenGLPixelFormatAttribute.DepthSize, 16 };
>
> To:
>
> var attribs = new object[] { NSOpenGLPixelFormatAttribute.OpenGLProfile,
> NSOpenGLPFAOpenGLProfile.Version3_2Core,
> NSOpenGLPixelFormatAttribute.DoubleBuffer,
> NSOpenGLPixelFormatAttribute.DepthSize, 16 };
>
> Of course, a lot of stuff in OpenGL 3.2 is deprecated so if you do this most
> demos will not work. But it does let you use 1.5 of GLSL!
>
> If there is anything I can do to help put this into the MonoMac base, please
> let me know.
>
> If I overlooked something, please let me know.
>
> Take care,
>
> Eric
>
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>
>



-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list