在OSX上使用SDL2创建OpenGL 3.x上下文(Macbook Air 2012) [英] OpenGL 3.x context creation using SDL2 on OSX (Macbook Air 2012)

查看:96
本文介绍了在OSX上使用SDL2创建OpenGL 3.x上下文(Macbook Air 2012)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,Macbook Air 2012支持OpenGL 3.2.但是,在使用SDL 2.0创建OpenGL上下文时,该上下文仅为opengl版本2.1.

As far as I'm aware, the Macbook Air 2012 supports OpenGL 3.2. When using SDL 2.0 to create the OpenGL context, however, the context is only opengl version 2.1.

SDL 2.0是否可以创建GL 3.2上下文?

Is it possible for SDL 2.0 to create a GL 3.2 context?

推荐答案

对于截至10月10日(星期三)仍然有此问题的每个人,SDL2允许您在运行Mac OS X 10.7(Lion)的Mac上创建OpenGL 3.2上下文.及以上. 您只需要添加以下代码:

For everyone who still has this problem as of Wednesday, Oct 10th, SDL2 allows you to create an OpenGL 3.2 context on Macs running Mac OS X 10.7 (Lion) and up. You just need to add this code:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);

如果您正在运行OS X 10.10,或者上述解决方案仍不能解决问题,请从

If you're running OS X 10.10, or the solution above still does not resolve the problem, changing the second line of the above example from

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);

可能对您有用.

这篇关于在OSX上使用SDL2创建OpenGL 3.x上下文(Macbook Air 2012)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆