OpenGL - ARB extension

2019-08-07 08:30发布

I am using MacBook Pro (13-inch, Mid 2010) and I work with OpenGL. I noticed, some of functions miss in library. I found specifications on the internet about my hardware and it says: "support OpenGL 3.3". It was strange so I printed my OpenGL version and IT IS 2.1, NO 3.3!. (Then I found, newest MacBooks (2014) have the same OpenGL version 2.1, WTF)

Then I almost jumped from window. (JK)

I googled something about 2.1 with some extension ARB, but there is no documentation, no usage, nobody uses it. Can anybody explain me please, what is that? How to use it? What is the difference?

I read (If I understand well), instead of new OpenGL 3.X, there is ARB extension which is similar or something. I hope, if they write to the specification it supports version 3.3, ARB should be the same (the same functions at least).

I would be glad, if somebody explains me what is going on.

Question:

I have problem with multisample texture for FBO drawing. It can be created by function glTexImage2DMultisample with parameter GL_TEXTURE_2D_MULTISAMPLE. It is from version 3.2 or grater.

So what should I use, or is it possible to do it with ARB?

I found GL_ARB_multisample in library. What is that? Any usage? All functions I found on the internet are missing. There are some definitions like GL_MULTISAMPLE_ARB in header. I tried to enable it by glEnable (GL_MULTISAMPLE is defined too), it doesn't work.

Please help me. :(

Edit:

If you know different way to solve this, I would be happy.

Original question: OpenGL - FBO and alpha blending

1条回答
仙女界的扛把子
2楼-- · 2019-08-07 09:33

You must switch OpenGL context from Legacy to Core profile. Core profile requires some changes in your code. You must migrate your code and shaders, because it's new version of OpenGL and GLSL. Check official video, how to migrate and rewrite functions to validate code for new version. Apple Developer Site - OpenGL (The video on the right side).

The important thing, you must do, is add #import <OpenGL/gl3.h> and all functions will be visible for use.

To get it to work, and debug shaders it's necessary set up NSOpenGLPixelFormat. Add NSOpenGLPFAOpenGLProfile key with NSOpenGLProfileVersion3_2Core value to NSOpenGLPixelFormatAttribute array:

NSOpenGLPixelFormatAttribute attribs[] = {
    // ...
    NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
    // ...
};

This helps you to debug your code.

Thanks a lot for help and I hope, this helps you.

查看更多
登录 后发表回答