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

Eric Hosick erichosick at interfacevision.com
Tue Oct 18 15:37:20 EDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20111019/0b8f528e/attachment.html 


More information about the Monodevelop-list mailing list