当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - OpenGL 4.1 SDL2 Mac OS

问题描述:

I'm trying to create OpenGL 4.1 core context on Mac OS Yosimite (10.10.2) with SDL2.

But all I managed to get is 3.2 context with GLSL 150 (!). My GL initialization code looks like this:

 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);

SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);

SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);

Videocard: AMD Radeon HD 6750M 512 MB

网友答案:

I was going to add a comment but don't have enough reputation yet. I think you have likely not added the OpenGL framework to your project, or you could be including the wrong OpenGL .h file.

To add the framework: Go to your project settings, then Build Phases, then Link Binary with Libraries and then add the OpenGL framework.

What .h file are you using? I had problems creating a context with OpenGL.h but no problems with gl3.h

分享给朋友:
您可能感兴趣的文章:
随机阅读: