supertuxkart-sourceforge-migration / stk-migration-test

0 stars 0 forks source link

OpenGL 3 on OSX #820

Open supertuxkart-sourceforge-migration opened 10 years ago

supertuxkart-sourceforge-migration commented 10 years ago

Author: auria

version 130 in shaders causes trouble on OSX.

Apparently on OSX when creating the GL canvas, one must explicitely request it to support OpenGL 3 : http://stackoverflow.com/questions/19865463/opengl-4-1-under-mavericks/19868861#19868861

When you request your pixel format using one of the lower-level APIs on OS X, you need to add the following to your attribute list in order to use a core profile:

CGL:

  kCGLPFAOpenGLProfile,     kCGLOGLPVersion_3_2_Core

NSOpenGL:

  NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core

http://stackoverflow.com/questions/20264814/glsl-version-130-on-mac-os-x-causes-error

OS X is different, it does not support compatibility profiles.
You either get the legacy OpenGL 2.1 implementation or the core 3.2 (3.3/4.1 in OS X 10.9) implementation
but you can never mix-and-match features from both.
Furthermore, unless you modify your code to ask for a core
profile, you will be limited to OpenGL 2.1 by default.

Migrated-From: https://sourceforge.net/apps/trac/supertuxkart/ticket/1142

supertuxkart-sourceforge-migration commented 10 years ago

Author: auria In lib/irrlicht/source/Irrlicht/MacOSX/CIrrDerviceMaxOSX.mm, there is the following code :

NSOpenGLPixelFormatAttribute windowattribs[=
{
NSOpenGLPFANoRecovery,
NSOpenGLPFAAccelerated,
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)depthSize,
NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)CreationParams.Bits,
NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)alphaSize,
NSOpenGLPFASampleBuffers, (NSOpenGLPixelFormatAttribute)1,
NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute)CreationParams.AntiAlias,
NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)(CreationParams.Stencilbuffer?1:0),
NSOpenGLPFADoubleBuffer,
(NSOpenGLPixelFormatAttribute)nil
};

we could try

NSOpenGLPixelFormatAttribute windowattribs[](]) =
{
NSOpenGLPFANoRecovery,
NSOpenGLPFAAccelerated,
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)depthSize,
NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)CreationParams.Bits,
NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)alphaSize,
NSOpenGLPFASampleBuffers, (NSOpenGLPixelFormatAttribute)1,
NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute)CreationParams.AntiAlias,
NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)(CreationParams.Stencilbuffer?1:0),
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAOpenGLProfile, (NSOpenGLPixelFormatAttribute)NSOpenGLProfileVersion3_2Core,
(NSOpenGLPixelFormatAttribute)nil,
};